/* ===================================================================
   ⚡ PERFORMANCE UI - Estilos de Otimização
   =================================================================== */

/* Universal Back Button - Estilos aplicados inline no JS para máxima performance */

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.search-modal {
    width: 100%;
    max-width: 700px;
    background: linear-gradient(145deg, rgba(26, 26, 26, 0.98), rgba(15, 15, 15, 0.95));
    border: 1px solid rgba(230, 126, 34, 0.3);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    transform: translateY(-20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-overlay.active .search-modal {
    transform: translateY(0);
}

/* Search Header */
.search-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: all 0.2s;
}

.search-input-wrapper:focus-within {
    border-color: var(--cor-primaria);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.2);
}

.search-icon {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.5);
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-close-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
}

.search-close-btn:hover {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.search-shortcuts {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.shortcut-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
}

.shortcut-hint kbd {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

/* Search Body */
.search-body {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar */
.search-body::-webkit-scrollbar {
    width: 8px;
}

.search-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.search-body::-webkit-scrollbar-thumb {
    background: rgba(230, 126, 34, 0.4);
    border-radius: 4px;
}

.search-body::-webkit-scrollbar-thumb:hover {
    background: rgba(230, 126, 34, 0.6);
}

/* Search Results */
.search-results {
    padding: 0.5rem;
}

.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
}

.search-empty svg {
    margin-bottom: 1rem;
    opacity: 0.3;
}

.search-empty p {
    margin: 0;
    font-size: 0.9375rem;
}

.search-empty strong {
    color: var(--cor-primaria);
}

/* Result Item */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.search-result-item:hover,
.search-result-item.selected {
    background: rgba(230, 126, 34, 0.1);
}

.search-result-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--cor-primaria);
    border-radius: 0 3px 3px 0;
}

.result-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(230, 126, 34, 0.15);
    border-radius: 10px;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 0.25rem;
    font-family: var(--font-destaque);
}

.result-title mark {
    background: rgba(230, 126, 34, 0.3);
    color: var(--cor-primaria);
    padding: 0 0.125rem;
    border-radius: 2px;
}

.result-description {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-category {
    flex-shrink: 0;
}

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-badge.techniques {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.category-badge.masters {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
}

.category-badge.articles {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.category-badge.achievements {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

.category-badge.shop {
    background: rgba(230, 126, 34, 0.2);
    color: #e67e22;
}

/* Search Footer */
.search-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.search-categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.category-filter {
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.category-filter:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.category-filter.active {
    background: linear-gradient(145deg, var(--cor-primaria), var(--cor-secundaria));
    border-color: var(--cor-primaria);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
}

/* Search FAB */
.search-fab {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--cor-primaria), var(--cor-secundaria));
    border: none;
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-fab:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 24px rgba(230, 126, 34, 0.6);
}

.search-fab:active {
    transform: scale(0.95);
}

.search-fab svg {
    width: 24px;
    height: 24px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .search-overlay {
        padding: 1rem 0.5rem;
        align-items: stretch;
    }

    .search-modal {
        max-width: 100%;
        border-radius: 12px;
    }

    .search-header {
        padding: 1rem;
    }

    .search-input-wrapper {
        padding: 0.625rem 0.875rem;
    }

    .search-input {
        font-size: 16px; /* Previne zoom no iOS */
    }

    .search-shortcuts {
        display: none; /* Esconde atalhos em mobile */
    }

    .search-body {
        max-height: 70vh;
    }

    .search-result-item {
        padding: 0.875rem;
    }

    .result-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .result-title {
        font-size: 0.9375rem;
    }

    .result-description {
        font-size: 0.8125rem;
    }

    .search-footer {
        padding: 0.875rem 1rem;
    }

    .category-filter {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .search-fab {
        bottom: 4.5rem;
        right: 1rem;
        width: 52px;
        height: 52px;
    }
}

/* Very Small Screens */
@media (max-width: 360px) {
    .search-categories {
        gap: 0.375rem;
    }

    .category-filter {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .search-overlay,
    .search-modal,
    .search-result-item,
    .category-filter,
    .search-fab {
        transition: none;
    }
}

/* Loading States */
.search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.search-loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid rgba(230, 126, 34, 0.2);
    border-top-color: var(--cor-primaria);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Accessibility */
.search-result-item:focus {
    outline: 2px solid var(--cor-primaria);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .search-modal {
        border-width: 2px;
    }

    .search-input-wrapper {
        border-width: 2px;
    }

    .category-filter {
        border-width: 2px;
    }
}

/* ===================================================================
   🎯 QUICK ACCESS MENU
   =================================================================== */

.quick-access-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    pointer-events: none;
}

.quick-access-menu.active {
    pointer-events: all;
}

.quick-access-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quick-access-menu.active .quick-access-overlay {
    opacity: 1;
}

.quick-access-items {
    position: absolute;
    bottom: 6rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-access-menu.active .quick-access-items {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.quick-access-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(145deg, rgba(26, 26, 26, 0.98), rgba(15, 15, 15, 0.95));
    border: 1px solid rgba(230, 126, 34, 0.3);
    border-radius: 50px;
    color: #ffffff;
    font-family: var(--font-destaque);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    white-space: nowrap;
}

.quick-access-item:hover {
    transform: translateX(-4px);
    border-color: var(--cor-primaria);
    box-shadow: 0 6px 16px rgba(230, 126, 34, 0.4);
}

.quick-access-item:active {
    transform: translateX(-2px) scale(0.98);
}

.qa-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.qa-label {
    flex: 1;
}

/* Animação staggered para os itens */
.quick-access-menu.active .quick-access-item:nth-child(1) {
    transition-delay: 0.05s;
}

.quick-access-menu.active .quick-access-item:nth-child(2) {
    transition-delay: 0.1s;
}

.quick-access-menu.active .quick-access-item:nth-child(3) {
    transition-delay: 0.15s;
}

.quick-access-menu.active .quick-access-item:nth-child(4) {
    transition-delay: 0.2s;
}

.quick-access-menu.active .quick-access-item:nth-child(5) {
    transition-delay: 0.25s;
}

/* Mobile */
@media (max-width: 768px) {
    .quick-access-items {
        bottom: 5rem;
        right: 1rem;
        gap: 0.625rem;
    }

    .quick-access-item {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .qa-icon {
        font-size: 1.25rem;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .quick-access-overlay,
    .quick-access-items,
    .quick-access-item {
        transition: none;
    }

    .quick-access-menu.active .quick-access-item {
        transition-delay: 0s;
    }
}
