/* Navigation Styles - Prefixo barra- para evitar conflitos */
.barra-header {
    background: var(--color-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: all var(--transition);
    width: 100%;
}

.barra-header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

.barra-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem var(--spacing-sm);
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

.barra-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    z-index: 1002;
}

.barra-logo-img {
    height: 40px;
    width: auto;
    transition: height var(--transition);
}

/* Barra de Pesquisa */
.barra-search-container {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

.barra-search-form {
    display: flex;
    overflow: hidden;
    position: relative;
}

.barra-search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
}

.barra-search-input-wrapper input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-light);
    font-size: var(--font-size-base);
    font-family: var(--font-primary);
    transition: all var(--transition);
    background: var(--color-light-gray);
    min-width: 0;
    width: 100%;
    border-radius: 50px;
}

.barra-search-input-wrapper input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(142, 125, 190, 0.1);
    background: var(--color-white);
}

.barra-search-submit {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gradient-primary);
    border: none;
    color: var(--color-white);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.barra-search-submit:hover {
    background: var(--color-primary-dark);
    transform: translateY(-50%) scale(1.05);
}

/* Autocomplete */
.barra-search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1002;
    border: 1px solid var(--color-light);
}

.barra-search-autocomplete.active {
    display: block;
}

.barra-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--color-light-gray);
}

.barra-autocomplete-item:last-child {
    border-bottom: none;
}

.barra-autocomplete-item:hover,
.barra-autocomplete-item.selected {
    background: var(--gradient-light);
}

.barra-autocomplete-icon {
    color: var(--color-primary-light);
    font-size: 0.9rem;
}

.barra-autocomplete-text {
    flex: 1;
}

.barra-autocomplete-name {
    color: var(--color-gray);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.barra-autocomplete-category {
    color: var(--color-primary-light);
    font-size: 0.75rem;
}

.barra-autocomplete-highlight {
    color: var(--color-primary);
    font-weight: 600;
    background: var(--gradient-light);
    padding: 0 2px;
    border-radius: 2px;
}

.barra-autocomplete-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--color-gray);
    font-size: 0.9rem;
}

/* Barra de Categorias */
.barra-categories {
    background: var(--color-light-gray);
    border-bottom: 2px solid var(--color-light);
    padding: 0;
    position: relative;
    z-index: 998;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.barra-categories-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.barra-categories-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary-light) transparent;
}

.barra-categories-nav::-webkit-scrollbar {
    height: 4px;
}

.barra-categories-nav::-webkit-scrollbar-track {
    background: transparent;
}

.barra-categories-nav::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: 4px;
}

.barra-categories-nav::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

.barra-category-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    color: var(--color-gray);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.barra-category-link::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--gradient-primary);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    border-radius: 3px 3px 0 0;
}

.barra-category-link:hover {
    color: var(--color-primary);
    background: var(--gradient-light);
}

.barra-category-link:hover::before {
    width: 100%;
}

.barra-category-link i {
    font-size: 1rem;
    opacity: 0.8;
}

.barra-category-link:hover i {
    opacity: 1;
    transform: scale(1.1);
}

/* Ações do Header */
.barra-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-shrink: 0;
}

.barra-cart-btn {
    position: relative;
    color: var(--color-gray);
    font-size: 1.25rem;
    transition: color 0.3s ease;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.barra-cart-btn:hover {
    color: var(--color-primary);
    background: rgba(142, 125, 190, 0.1);
}

.barra-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-primary);
    color: var(--color-white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.barra-user-menu {
    position: relative;
}

.barra-user-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--color-light);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--color-dark-gray);
    font-family: var(--font-secondary);
}

.barra-user-toggle:hover {
    border-color: var(--color-primary);
    background: var(--gradient-light);
}

.barra-user-avatar {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-sm);
    font-family: var(--font-secondary);
}

.barra-user-name {
    font-size: 0.9rem;
    color: var(--color-gray);
    font-weight: 500;
}

.barra-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1001;
    overflow: hidden;
    border: 1px solid var(--color-light);
    display: none;
}

.barra-user-dropdown.active {
    display: block;
}

.barra-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--color-gray);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--color-light-gray);
}

.barra-dropdown-item:last-child {
    border-bottom: none;
}

.barra-dropdown-item:hover {
    background: var(--gradient-light);
    color: var(--color-primary);
}

.barra-dropdown-divider {
    height: 1px;
    background: var(--color-light);
    margin: 0.5rem 0;
}

.barra-auth-links {
    display: flex;
    gap: 0.75rem;
}

.barra-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: var(--font-secondary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--border-radius-full);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.barra-btn-primary {
    background: var(--gradient-primary);
    color: var(--color-white);
    border: none;
}

.barra-btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(142, 125, 190, 0.3);
}

.barra-btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.barra-btn-outline:hover {
    background: var(--gradient-light);
    transform: translateY(-1px);
}

/* Menu Hambúrguer Mobile */
.barra-toggle {
    display: none;
    background: none;
    border: 2px solid var(--color-light);
    border-radius: 12px;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 1002;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 48px;
    height: 48px;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 5px;
}

.barra-toggle:hover {
    border-color: var(--color-primary);
    background: rgba(142, 125, 190, 0.08);
    transform: scale(1.05);
}

.barra-bar {
    display: block;
    width: 22px;
    height: 2.5px;
    background: var(--color-primary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
    transform-origin: center;
}

.barra-toggle.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
    transform: scale(1.05);
}

.barra-toggle.active .barra-bar {
    background: var(--color-white);
}

.barra-toggle.active .barra-bar:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
    width: 22px;
}

.barra-toggle.active .barra-bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.barra-toggle.active .barra-bar:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
    width: 22px;
}

/* ===== MENU MOBILE ===== */
.barra-nav-menu {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: var(--color-white);
    z-index: 1003; /* MAIOR Z-INDEX QUE O OVERLAY */
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
}

.barra-nav-menu.active {
    display: block;
    transform: translateX(0);
}

.barra-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: var(--gradient-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.barra-mobile-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-white);
}

.barra-mobile-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--color-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.barra-mobile-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.barra-mobile-links {
    padding: 1rem 0;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.barra-mobile-divider {
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gradient-light);
    border-top: 1px solid var(--color-light);
    border-bottom: 1px solid var(--color-light);
    margin-top: 0.5rem;
}

.barra-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--color-gray);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
}

.barra-nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: var(--gradient-light);
    transition: width 0.3s ease;
    z-index: -1;
}

.barra-nav-link:hover::before {
    width: 100%;
}

.barra-nav-link:hover {
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    padding-left: 2rem;
}

.barra-nav-link i {
    width: 1.25rem;
    font-size: 1.1rem;
    color: var(--color-primary-light);
    transition: all 0.2s ease;
}

.barra-nav-link:hover i {
    color: var(--color-primary);
    transform: scale(1.1);
}

.barra-mobile-user {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-light-gray);
}

.barra-mobile-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.barra-mobile-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    color: var(--color-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.barra-mobile-user-name {
    font-size: 0.95rem;
    color: var(--color-gray);
    font-weight: 500;
}

/* Overlay - DEVE VIR ATRÁS DO MENU */
.barra-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002; /* Z-INDEX MENOR QUE O MENU */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.barra-overlay.active {
    display: block;
    opacity: 1;
}

/* ===== RESPONSIVIDADE ===== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .barra-content {
        padding: 1rem;
        gap: 1rem;
    }
    
    .barra-categories-content {
        padding: 0 1rem;
    }
    
    .barra-category-link {
        padding: 0.875rem 1rem;
        font-size: 0.85rem;
    }
    
    .barra-auth-links {
        gap: 0.5rem;
    }
    
    .barra-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

/* Mobile (até 768px) */
@media (max-width: 768px) {
    .barra-content {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
        flex-wrap: wrap;
        height: auto;
        min-height: 70px;
    }
    
    .barra-logo {
        order: 1;
        flex-shrink: 0;
    }
    
    .barra-toggle {
        display: flex;
        order: 2;
        margin-left: auto;
    }
    
    .barra-search-container {
        order: 4;
        flex: 1 0 100%;
        margin-top: 0.75rem;
        max-width: 100%;
        margin: 0;
    }
    
    .barra-actions {
        order: 3;
        gap: 1rem;
    }
    
    .barra-categories {
        display: none;
    }
    
    .barra-user-name {
        display: none;
    }
    
    .barra-auth-links {
        display: none;
    }
    
    .barra-logo-img {
        height: 32px;
    }
    
    .barra-user-toggle {
        padding: 0.5rem;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
    }
    
    .barra-cart-btn {
        font-size: 1.1rem;
    }
    
    .barra-cart-count {
        top: -6px;
        right: -6px;
        min-width: 16px;
        height: 16px;
        font-size: 0.65rem;
    }
    
    /* Menu mobile ajustado */
    .barra-mobile-links {
        max-height: calc(100vh - 64px);
    }
    
    .barra-nav-link {
        padding: 0.875rem 1.25rem;
    }
    
    .barra-mobile-divider {
        padding: 0.625rem 1.25rem;
    }
    
    .barra-mobile-user {
        padding: 0.875rem 1.25rem;
    }
}

/* Mobile pequeno (até 480px) */
@media (max-width: 480px) {
    .barra-content {
        padding: 0.625rem 0.875rem;
    }
    
    .barra-logo-img {
        height: 28px;
    }
    
    .barra-search-input-wrapper input {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
    }
    
    .barra-search-submit {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .barra-user-toggle {
        width: 40px;
        height: 40px;
    }
    
    .barra-user-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .barra-nav-menu {
        width: 90%;
        max-width: 280px;
    }
    
    .barra-toggle {
        width: 44px;
        height: 44px;
    }
    
    .barra-bar {
        width: 20px;
    }
}

/* Desktop - manter comportamento original */
@media (min-width: 769px) {
    .barra-toggle {
        display: none !important;
    }
    
    .barra-nav-menu {
        display: none !important;
    }
    
    .barra-overlay {
        display: none !important;
    }
    
    .barra-mobile-close {
        display: none !important;
    }
}

/* Header scroll effect */
.barra-header.scrolled .barra-logo-img {
    height: 35px;
}

@media (max-width: 480px) {
    .barra-header.scrolled .barra-logo-img {
        height: 30px;
    }
}