/* Navigation Styles */

/* ============ HEADER PRINCIPAL ============ */
.main-header {
    background: #0d1b2a;
    color: white;
    padding: 0.8rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0;
    min-height: 70px;
}

/* Logo com fundo circular branco */
.bm-logo {
    flex-shrink: 0;
}

.bm-logo-link {
    display: block;
    text-decoration: none;
}

.bm-logo-circle {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(255,255,255,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bm-logo-circle:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255,255,255,0.3);
}

.bm-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Barra de Pesquisa */
.search-bar {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 0.8rem 3rem 0.8rem 1rem;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    background: rgba(255,255,255,0.95);
    color: #333;
}

.search-bar button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #1b4965;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

.search-bar button:hover {
    background: #2c5f7a;
}

/* Navegação Desktop */
.main-nav {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    flex-shrink: 0;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    white-space: nowrap;
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: #5fa8d3;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown .dropbtn {
    cursor: pointer;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #0d1b2a;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 1001;
    border-top: 3px solid #5fa8d3;
}

.dropdown-content a {
    color: white !important;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: #1b4965;
    color: #5fa8d3 !important;
}

.dropdown-content.show {
    display: block;
}

/* Autocomplete Styles */
.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-bottom: none;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0 0 5px 5px;
}

.autocomplete-item {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #d4d4d4;
    color: #333;
    text-align: left;
    display: flex;
    align-items: center;
}

.autocomplete-item:hover {
    background-color: #e9e9e9;
}

.autocomplete-item.autocomplete-active {
    background-color: #1b4965 !important;
    color: #ffffff;
}

.autocomplete-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-right: 10px;
    border-radius: 3px;
}

.autocomplete-item span {
    font-weight: bold;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    transition: background 0.3s ease;
    color: white;
}

.user-toggle:hover {
    background: #1b4965;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: #5fa8d3;
    color: #0d1b2a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    padding: 0.5rem;
    min-width: 200px;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    color: #0d1b2a;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.3s ease;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: #f0f0f0;
}

.dropdown-item.logout {
    color: #e74c3c;
}

.dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0.5rem 0;
}

/* Auth Links */
.auth-links {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-outline {
    border: 1px solid #5fa8d3;
    color: #5fa8d3;
    background: transparent;
}

.btn-outline:hover {
    background: #5fa8d3;
    color: white;
}

.btn-primary {
    background: #5fa8d3;
    color: white;
    border: 1px solid #5fa8d3;
}

.btn-primary:hover {
    background: #4a97c2;
    border-color: #4a97c2;
}

.btn-block {
    width: 100%;
    text-align: center;
}

/* Cart Link */
.cart-link {
    position: relative;
    color: white;
    padding: 0.6rem;
    border-radius: 8px;
    transition: background 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 1.2rem;
}

.cart-link:hover {
    background: #1b4965;
}

.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: #5fa8d3;
    color: #0d1b2a;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid #0d1b2a;
}

/* Menu Hambúrguer Mobile */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    color: white;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: #1b4965;
}

.hamburger {
    width: 25px;
    height: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ============ MENU MOBILE SIDEBAR ============ */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.mobile-menu-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100%;
    background: white;
    z-index: 1000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
}

.mobile-menu-sidebar.active {
    left: 0;
}

.mobile-menu-header {
    padding: 1.5rem;
    background: #0d1b2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: white;
}

/* Logo com círculo branco no menu mobile */
.mobile-logo-circle {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.mobile-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mobile-logo span {
    font-weight: 600;
    font-size: 1.1rem;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.3s ease;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.mobile-user-info {
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 1rem;
}

.mobile-user-avatar {
    width: 50px;
    height: 50px;
    background: #5fa8d3;
    color: #0d1b2a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

.mobile-user-details h4 {
    margin: 0;
    color: #0d1b2a;
    font-size: 1rem;
}

.mobile-user-email {
    color: #666;
    font-size: 0.85rem;
    display: block;
    margin-top: 0.2rem;
}

.mobile-auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: #f0f7ff;
    color: #1b4965;
}

.mobile-nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.mobile-nav-link.logout {
    color: #e74c3c;
}

.mobile-dropdown {
    margin-bottom: 0.5rem;
}

.mobile-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    width: 100%;
    background: none;
    border: none;
    color: #333;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 1rem;
}

.mobile-dropdown-toggle:hover {
    background: #f0f7ff;
    color: #1b4965;
}

.mobile-dropdown-toggle i:last-child {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.mobile-dropdown-toggle.active i:last-child {
    transform: rotate(180deg);
}

.mobile-dropdown-content {
    display: none;
    padding-left: 2rem;
    padding-top: 0.5rem;
}

.mobile-dropdown-content.active {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.mobile-dropdown-link {
    padding: 0.6rem 1rem;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.mobile-dropdown-link:hover {
    background: #f5f5f5;
    color: #1b4965;
}

.mobile-menu-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 1rem 0;
}

.mobile-menu-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.mobile-cart-info {
    padding: 1rem;
}

.mobile-cart-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #333;
    text-decoration: none;
    padding: 0.8rem;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.mobile-cart-link:hover {
    background: #e9ecef;
    color: #1b4965;
}

.mobile-cart-count {
    margin-left: auto;
    background: #5fa8d3;
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

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

/* Tablet (1024px) */
@media (max-width: 1024px) {
    .header-content {
        gap: 1rem;
    }
    
    .main-nav {
        gap: 1rem;
    }
    
    .nav-link {
        font-size: 0.85rem;
    }
    
    .search-bar {
        max-width: 350px;
    }
}

/* Mobile (768px) - Todos os componentes na mesma linha */
@media (max-width: 768px) {
    .main-header {
        padding: 0.5rem 0;
    }

    .header-content {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.5rem;
        min-height: 60px;
        flex-wrap: nowrap;
        width: 100%;
    }
    
    /* Logo - Primeira posição */
    .bm-logo {
        flex-shrink: 0;
        order: 1;
    }
    
    .bm-logo-circle {
        width: 50px;
        height: 50px;
        padding: 6px;
    }
    
    /* Barra de Pesquisa - Segunda posição, ocupa espaço disponível */
    .search-bar {
        order: 2;
        flex: 1;
        max-width: none;
        min-width: 0;
        margin: 0;
    }
    
    .search-bar input {
        padding: 0.6rem 2.5rem 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .search-bar button {
        padding: 0.5rem 0.9rem;
        right: 3px;
    }
    
    .search-bar button i {
        font-size: 0.9rem;
    }
    
    /* Header Actions - Terceira posição */
    .header-actions {
        order: 3;
        display: flex;
        align-items: center;
        gap: 0.4rem;
        flex-shrink: 0;
    }
    
    /* Carrinho - Dentro de header-actions */
    .cart-link {
        padding: 0.5rem;
        font-size: 1.1rem;
    }
    
    .cart-count {
        min-width: 16px;
        height: 16px;
        font-size: 0.65rem;
        border-width: 1.5px;
    }
    
    /* Menu Hambúrguer - Dentro de header-actions */
    .mobile-menu-toggle {
        display: flex;
        padding: 0.5rem;
    }
    
    .hamburger {
        width: 22px;
        height: 18px;
    }
    
    /* Esconde elementos de desktop */
    .main-nav,
    .user-menu,
    .auth-links,
    .user-name {
        display: none;
    }
}

/* Mobile Pequeno (480px) */
@media (max-width: 480px) {
    .main-header {
        padding: 0.4rem 0;
    }

    .header-content {
        min-height: 55px;
        gap: 0.4rem;
    }
    
    .bm-logo-circle {
        width: 45px;
        height: 45px;
        padding: 5px;
    }
    
    .search-bar input {
        font-size: 0.8rem;
        padding: 0.55rem 2.2rem 0.55rem 0.7rem;
    }
    
    .search-bar button {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .header-actions {
        gap: 0.3rem;
    }
    
    .cart-link {
        font-size: 1rem;
        padding: 0.45rem;
    }
    
    .cart-count {
        min-width: 15px;
        height: 15px;
        font-size: 0.6rem;
    }
    
    .mobile-menu-toggle {
        padding: 0.45rem;
    }
    
    .hamburger {
        width: 20px;
        height: 16px;
    }
    
    .hamburger span {
        height: 2.5px;
    }
    
    .mobile-menu-sidebar {
        width: 280px;
    }
    
    .mobile-logo-circle {
        width: 35px;
        height: 35px;
    }
}

/* Mobile Muito Pequeno (360px) */
@media (max-width: 360px) {
    .header-content {
        gap: 0.3rem;
        min-height: 50px;
    }
    
    .bm-logo-circle {
        width: 42px;
        height: 42px;
        padding: 4px;
    }
    
    .search-bar input {
        font-size: 0.75rem;
        padding: 0.5rem 2rem 0.5rem 0.6rem;
    }
    
    .search-bar input::placeholder {
        font-size: 0.7rem;
    }
    
    .search-bar button {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }
    
    .header-actions {
        gap: 0.25rem;
    }
    
    .cart-link {
        font-size: 0.95rem;
        padding: 0.4rem;
    }
    
    .cart-count {
        min-width: 14px;
        height: 14px;
        font-size: 0.55rem;
    }
    
    .mobile-menu-toggle {
        padding: 0.4rem;
    }
    
    .hamburger {
        width: 18px;
        height: 15px;
    }
    
    .hamburger span {
        height: 2px;
    }
    
    .mobile-menu-sidebar {
        width: 260px;
    }
}