/* ===== HEADER STYLES ===== */
/* Variables inherited from style.css :root — do not duplicate here */

/* Neuromarketing: Thin warm accent bar at the very top */
body::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 50%, var(--gold) 100%);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
}

/* Base reset inherited from style.css — do not duplicate here */

/* Topbar */
.topbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: rgba(255,255,255,0.85);
    font-size: 0.78rem;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.topbar a { color: rgba(255,255,255,0.85); transition: color var(--transition); text-shadow: 0 0 8px rgba(255,255,255,0.05); }
.topbar a:hover { color: var(--gold); text-shadow: 0 0 10px rgba(245,158,11,0.25); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar i { margin-right: 5px; color: var(--gold); filter: drop-shadow(0 0 3px rgba(245,158,11,0.2)); }

/* Navbar principale — sticky with backdrop-blur (reduces bounce rate) */
.navbar {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 1px 3px rgba(11,37,89,0.06), 0 4px 12px rgba(11,37,89,0.04);
    border-bottom: 1px solid rgba(11,37,89,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: box-shadow 0.35s ease, background 0.35s ease, border-color 0.35s ease;
}
.navbar.scrolled {
    box-shadow: 0 4px 20px rgba(11,37,89,0.1), 0 1px 4px rgba(11,37,89,0.06);
    background: rgba(255,255,255,0.98);
    border-bottom-color: rgba(11,37,89,0.08);
}
.navbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    gap: 8px;
    overflow: visible;
}

/* Logo */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.logo-svg {
    height: 48px;
    width: auto;
    transition: transform 0.3s ease;
}
.navbar-brand:hover .logo-svg {
    transform: scale(1.03);
}
@media (max-width: 768px) {
    .logo-svg { height: 42px; }
}
@media (max-width: 480px) {
    .logo-svg { height: 36px; }
}
/* Legacy fallback */
.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--white);
    font-weight: 800;
    letter-spacing: -1px;
    box-shadow: 0 3px 10px rgba(10,22,40,0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.navbar-brand:hover .logo-icon {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(10,22,40,0.4);
}
.logo-text { line-height: 1.2; }
.logo-text .brand-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}
.logo-text .brand-slogan {
    display: block;
    font-size: 0.65rem;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Search bar — icon toggle mode */
.navbar-search {
    position: relative;
    flex-shrink: 0;
}
.search-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gray-100);
    border: none;
    color: var(--primary);
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.search-toggle:hover {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(11,37,89,0.2);
}
.search-form {
    display: none;
    align-items: center;
    background: var(--white);
    border-radius: 50px;
    padding: 5px 6px 5px 16px;
    border: 2px solid var(--accent);
    box-shadow: 0 6px 24px rgba(11,37,89,0.12);
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 520px;
    max-width: calc(100vw - 32px);
    z-index: 1100;
    animation: searchDrop 0.2s ease-out;
}
@keyframes searchDrop {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.navbar-search.open .search-toggle { display: none; }
.navbar-search.open .search-form { display: flex; }
/* Backdrop when search is open */
.navbar-search.open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.15);
    z-index: 1099;
    backdrop-filter: blur(2px);
}
.search-close {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
    flex-shrink: 0;
}
.search-close:hover { color: var(--accent-buy); }
.search-form:focus-within {
    border-color: var(--accent);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(255,107,53,0.12), 0 0 20px rgba(255,107,53,0.08), 0 4px 16px rgba(255,107,53,0.06);
}
.search-form input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: var(--gray-800);
}
.search-form input::placeholder { color: var(--gray-600); }
.search-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: background var(--transition), transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}
.search-btn:hover {
    background: var(--accent-buy);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255,107,53,0.3);
}

/* ===== Live Search Autocomplete ===== */
.search-autocomplete {
    position: fixed;
    top: 96px;
    left: 50%;
    transform: translateX(-50%);
    width: 520px;
    max-width: calc(100vw - 32px);
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(10,22,40,0.18);
    border: 1px solid var(--gray-200);
    z-index: 2000;
    display: none;
    overflow: hidden;
    max-height: 420px;
    overflow-y: auto;
    animation: acFadeIn 0.2s ease;
}
@keyframes acFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.search-autocomplete.active { display: block; }
.ac-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-600);
    padding: 10px 16px 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--gray-100);
}
.ac-group-label:first-child { border-top: none; }
.ac-group-label i { font-size: 0.65rem; color: var(--primary); }
.ac-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.ac-item:hover, .ac-item.ac-active {
    background: var(--gray-50);
}
.ac-item-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--gray-100);
    flex-shrink: 0;
}
.ac-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--primary);
}
.ac-item-body { flex: 1; min-width: 0; }
.ac-item-title {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ac-item-title mark {
    background: #fef3c7;
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}
.ac-item-excerpt {
    font-size: 0.72rem;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ac-item-price {
    font-size: 0.78rem;
    font-weight: 700;
    color: #f59e0b;
    flex-shrink: 0;
}
.ac-footer {
    padding: 10px 16px;
    text-align: center;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}
.ac-footer a {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}
.ac-footer a:hover { color: var(--accent-buy); }
.ac-loading {
    padding: 20px;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.82rem;
}
.ac-loading i { animation: spin 1s linear infinite; margin-right: 6px; }
/* @keyframes spin defined in style.css */

/* Nav links */
.navbar-nav {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 2px;
    flex-shrink: 1;
    min-width: 0;
}
.navbar-nav .nav-link {
    padding: 6px 9px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-800);
    border-radius: 8px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
/* Micro-animation: underline slide-in on hover */
.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), left 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.navbar-nav .nav-link:hover::after {
    width: 60%;
    left: 20%;
}
.navbar-nav .nav-link:hover {
    background: rgba(11,37,89,0.06);
    color: var(--primary);
}
.navbar-nav .nav-link.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(11,37,89,0.2);
}
.navbar-nav .nav-link.active::after {
    width: 60%;
    left: 20%;
    background: var(--white);
}

/* Nav actions (panier + compte) */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.btn-cart {
    position: relative;
    background: var(--gray-100);
    border: none;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--primary);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}
.btn-cart:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11,37,89,0.2);
}
.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
    animation: cartBadgePulse 2s ease-in-out infinite;
    box-shadow: 0 2px 6px rgba(255,107,53,0.4);
}
@keyframes cartBadgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,107,53,0.4); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(255,107,53,0); }
}
.btn-account {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
}
.btn-account:hover {
    background: var(--accent-buy);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255,107,53,0.3);
}
.btn-account.logged { background: var(--accent-trust); }
.btn-account.logged:hover { background: #3a9a35; }
.dd-arrow { font-size: 0.6rem; margin-left: 2px; transition: transform 0.2s; }

/* User Dropdown */
.user-dropdown { position: relative; }
.user-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(11,37,89,0.15), 0 2px 8px rgba(11,37,89,0.06);
    min-width: 260px;
    z-index: 2000;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    animation: acFadeIn 0.2s ease;
}
.user-dropdown.open .dropdown-menu { display: block; }
.user-dropdown.open .dd-arrow { transform: rotate(180deg); }
.dropdown-header {
    padding: 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}
.dropdown-header strong { display: block; font-size: 0.9rem; color: var(--gray-800); }
.dropdown-header small { display: block; font-size: 0.75rem; color: var(--gray-600); margin-top: 2px; }
.dropdown-role {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--accent-trust);
    color: #fff;
}
.dropdown-divider { height: 1px; background: var(--gray-200); margin: 0; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.83rem;
    color: var(--gray-800);
    transition: background 0.15s;
    text-decoration: none;
}
.dropdown-item:hover { background: var(--gray-50); color: var(--accent-buy); }
.dropdown-item i { width: 18px; text-align: center; color: var(--gray-600); }
.dropdown-item:hover i { color: var(--accent-buy); }
.dropdown-item.text-danger { color: #dc3545; }
.dropdown-item.text-danger i { color: #dc3545; }

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
    background: none;
    border: none;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}
.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.3s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); background: var(--accent); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); background: var(--accent); }

/* Mobile menu */
.mobile-menu {
    display: none;
    background: var(--white);
    border-top: 2px solid var(--gray-100);
    padding: 16px 20px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.25,0.8,0.25,1), opacity 0.3s ease, padding 0.3s ease;
}
.mobile-menu.open {
    display: block;
    max-height: 85vh;
    opacity: 1;
    box-shadow: 0 8px 24px rgba(11,37,89,0.08) inset;
}
.mobile-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: var(--gray-800);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all var(--transition);
}
.mobile-menu .nav-link:hover,
.mobile-menu .nav-link.active {
    background: var(--primary);
    color: var(--white);
}
.mobile-search {
    margin-bottom: 14px;
    display: flex;
    gap: 8px;
}
.mobile-search input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    outline: none;
}
.mobile-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255,107,53,0.1);
}
.mobile-search button {
    padding: 10px 16px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Flash messages */
.flash-container {
    max-width: 1280px;
    margin: 16px auto 0;
    padding: 0 20px;
}
.flash {
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    animation: fadeInDown 0.3s ease;
}
/* @keyframes fadeInDown defined in style.css */
.flash-success { background: #ecfdf5; color: #065f46; border-left: 4px solid #10b981; }
.flash-error   { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.flash-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.flash-info    { background: #eff6ff; color: #1e40af; border-left: 4px solid #3b82f6; }

@media (max-width: 992px) {
    .navbar-nav { display: none; }
    .hamburger { display: flex; }
    .logo-text .brand-slogan { display: none; }
}
@media (max-width: 576px) {
    .topbar-left { display: none; }
    .btn-account span { display: none; }
    .btn-account { padding: 8px; }
}
