/**
 * Header + nav chrome aligned with index.html (customer-facing subpages).
 * Load after subpages.css so these rules win where they overlap.
 */

.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--white);
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1200;
    border-radius: 4px;
    overflow: hidden;
}

.user-dropdown-content a {
    color: var(--dark-brown);
    padding: 10px 12px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    border-bottom: 1px solid var(--light-gray);
}

.user-dropdown-content a:last-child {
    border-bottom: none;
}

.user-dropdown-content a:hover {
    background-color: var(--gold);
}

.user-dropdown:hover .user-dropdown-content {
    display: block;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1100;
    display: none;
}

header {
    background-color: var(--cream);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header {
    padding: 12px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.logo img {
    height: 35px;
    transition: transform 0.3s ease;
}

.logo-text {
    font-family: "Playfair Display", serif;
    font-size: 1.5rem;
    color: var(--dark-brown);
    font-weight: 700;
}

.search-bar {
    display: flex;
    width: 40%;
    position: relative;
    justify-content: center;
    flex: 2;
}

.search-bar input {
    flex: 1;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid var(--medium-brown);
    border-right: none;
    border-radius: 4px 0 0 4px;
    outline: none;
    font-size: 0.9rem;
}

.search-bar button {
    padding: 0 10px;
    background-color: var(--medium-brown);
    color: var(--cream);
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.header-icons {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.header-icons > a {
    font-size: 1.1rem;
    position: relative;
    transition: color 0.3s ease;
}

.header-icons .auth-shortcut {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 10px;
    border: 1px solid var(--medium-brown);
    border-radius: 6px;
    line-height: 1;
}

.cart-count,
.wishlist-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: var(--gold);
    color: var(--dark-brown);
    font-size: 0.6rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.nav-desktop {
    background-color: var(--sage);
}

.nav-desktop .nav-links {
    display: flex;
    justify-content: center;
}

.nav-links li {
    position: relative;
}

.nav-links a {
    display: block;
    padding: 10px 12px;
    color: var(--cream);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--gold);
}

.dropdown {
    position: absolute;
    background-color: var(--cream);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.nav-links li:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown a {
    color: var(--dark-brown);
    padding: 8px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.85rem;
}

.dropdown a:hover {
    background-color: var(--gold);
    color: var(--dark-brown);
}

.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background-color: var(--sage);
    transition: left 0.3s ease;
    z-index: 2000;
    display: none;
    overflow-y: auto;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-close {
    color: var(--cream);
    font-size: 1.5rem;
    cursor: pointer;
}

.sidebar .nav-links {
    flex-direction: column;
    padding: 15px 0;
}

.sidebar .nav-links li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .nav-links a {
    color: var(--cream);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar .dropdown {
    position: static;
    background-color: rgba(0, 0, 0, 0.1);
    box-shadow: none;
    min-width: 100%;
    opacity: 1;
    visibility: visible;
    transform: none;
    display: none;
}

.sidebar .dropdown a {
    padding-left: 30px;
    font-size: 0.85rem;
}

.sidebar .nav-links li.active .dropdown {
    display: block;
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark-brown);
}

@media (min-width: 769px) {
    .sidebar {
        display: none;
    }

    .menu-toggle {
        display: none;
    }

    .nav-desktop {
        display: block;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        gap: 12px;
        justify-content: space-between;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        flex: 0 0 auto;
        order: 1;
    }

    .logo {
        flex: 1;
        justify-content: center;
        order: 2;
        min-width: 0;
    }

    .logo-text {
        font-size: 1.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-icons {
        flex: 0 0 auto;
        justify-content: flex-end;
        order: 3;
    }

    .search-bar {
        order: 4;
        width: 100%;
        margin-top: 10px;
        flex: none;
    }

    .nav-desktop {
        display: none;
    }

    .sidebar {
        display: block;
    }

    .search-results {
        max-height: 200px;
    }
}
