:root {
    --header-bg: #ffffff;
    --header-text: #333333;
    --top-bar-bg: #f8f9fa;
    --top-bar-text: #666666;
    --accent-color: #000000;
    --border-color: #e5e5e5;
    --search-bg: #f1f3f5;
}

/* Base Layout */
.modern-header-wrapper {
    font-family: 'Inter', sans-serif;
    background: var(--header-bg);
    box-shadow: 0 1px 0 var(--border-color);
    position: relative;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 1. Top Bar */
.header-top {
    background-color: var(--top-bar-bg);
    color: var(--top-bar-text);
    font-size: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.top-left,
.top-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-link {
    color: var(--top-bar-text);
    text-decoration: none;
    transition: color 0.2s;
}

.top-link:hover {
    color: var(--accent-color);
}

.separator {
    color: #ccc;
    font-size: 10px;
}

/* 2. Main Header */
.header-main {
    padding: 20px 0;
}

.header-main .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.brand-logo img {
    height: 40px;
    width: auto;
}

/* Search Bar */
.header-search {
    flex: 1;
    max-width: 600px;
}

.search-form .input-group {
    display: flex;
    background: var(--search-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    /* Prepare for focus */
    transition: all 0.2s;
}

.search-form .input-group:focus-within {
    background: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.search-input {
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 14px;
    width: 100%;
    outline: none;
    color: var(--header-text);
}

.btn-search {
    background: transparent;
    border: none;
    padding: 0 20px;
    color: #666;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.btn-search:hover {
    color: var(--accent-color);
}

/* Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--header-text);
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    /* Prevent layout shift */
}

.dropdown-toggle::after {
    display: none;
}

.action-item:hover,
.action-item[aria-expanded="true"] {
    background-color: #f8f9fa;
    border-color: #e9ecef;
}

.action-icon {
    position: relative;
    font-size: 24px;
    color: var(--header-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--accent-color);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3;
    max-width: 140px;
    /* Limit width */
}

.action-text .sub {
    font-size: 11px;
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.action-text .main {
    font-size: 14px;
    font-weight: 600;
    color: var(--header-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* 3. Navigation Bar */
.header-nav {
    background: #fff;
    height: 52px;
    display: flex;
    align-items: center;
    border-top: 1px solid var(--border-color);
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 25px;
}

.nav-item {
    position: relative;
    height: 52px;
    display: flex;
    align-items: center;
}

.nav-link-modern {
    text-decoration: none;
    color: var(--header-text);
    font-size: 14px;
    font-weight: 600;
    padding: 0 10px;
    display: flex;
    align-items: center;
    height: 100%;
    transition: color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: relative;
}

.nav-link-modern:hover {
    color: var(--accent-color);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-item:hover::after {
    width: 100%;
}

/* Dropdown */
.dropdown-menu {
    border-radius: 8px !important;
    margin-top: 0 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #f0f0f0 !important;
    padding: 10px !important;
    min-width: 220px;
}

.dropdown-item {
    padding: 8px 16px !important;
    font-size: 14px;
    border-radius: 6px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: var(--accent-color);
    transform: translateX(3px);
}

/* Mega Menu */
.mega-menu-item {
    position: static;
}

.mega-menu-dropdown {
    left: 0 !important;
    right: 0 !important;
    width: 100%;
    min-width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    padding: 20px !important;
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 18px 24px;
}

.mega-menu-column {
    min-width: 0;
}

.mega-menu-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f1f1f1;
}

.mega-menu-title:hover {
    color: var(--accent-color);
}

.mega-menu-sublist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-menu-sublist li+li {
    margin-top: 4px;
}

.mega-menu-link {
    display: block;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mega-menu-link:hover {
    color: #111;
    background: #f8f9fa;
    transform: translateX(2px);
}

/* Sticky State */
.modern-header-wrapper.sticky .header-main {
    display: none;
    /* Hide main part on scroll to save space, or keep it */
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--header-text);
}

@media (max-width: 991px) {

    .header-top,
    .header-search,
    .header-nav,
    .action-text {
        display: none !important;
    }

    .header-container {
        padding: 0 15px;
    }

    .header-main .header-container {
        gap: 10px;
    }

    .mobile-toggle {
        display: block;
    }

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

    .brand-logo img {
        height: 32px;
    }

    .mega-menu-dropdown {
        max-height: none;
        overflow: visible;
    }
}

/* Mobile Menu Overlay - ENHANCED */
/* Mobile Menu Overlay - PREMIUM REDESIGN */
#mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transform: translateX(100%);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.1);
}

#mobile-menu-overlay.active {
    right: 0;
    transform: translateX(0);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.menu-close-btn {
    background: #f1f3f5;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #000;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.menu-close-btn:active {
    transform: scale(0.9);
}

.mobile-menu-content {
    padding: 20px 25px;
    flex: 1;
}

/* Categories & Links */
.m-nav-item {
    margin-bottom: 5px;
}

.m-nav-link {
    display: flex;
    align-items: center;
    padding: 18px 0;
    text-decoration: none;
    color: #111;
    border-bottom: 1px solid #f0f0f0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
    transition: all 0.2s ease;
    background: transparent;
}

.m-nav-link:active {
    background-color: #f9f9f9;
    padding-left: 10px;
}

.m-text {
    flex: 1;
}

.m-arrow {
    color: #aaa;
    font-size: 20px;
}

/* Submenu Styling */
.m-submenu {
    padding-left: 20px;
    border-left: 2px solid #f0f0f0;
    margin-top: 5px;
    margin-bottom: 15px;
    display: none;
    /* Can be toggled via JS if needed, or CSS hover/active */
}

/* Force submenu open for now or rely on structure - assuming simple list for now as per helper */
.m-submenu .m-nav-link {
    padding: 12px 0;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px dashed #eee;
    color: #444;
}

/* User Section Card */
.user-section-card {
    background-color: #f8f9fa;
    border-radius: 16px;
    padding: 20px;
    margin-top: 30px;
}

.user-info-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.user-avatar-lg {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}

.user-details h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #000;
}

.user-details span {
    font-size: 13px;
    color: #777;
    margin-top: 2px;
    display: block;
}

.user-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-mobile-action {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.1s;
}

.btn-mobile-action:active {
    transform: scale(0.96);
}

.btn-m-primary {
    background: #000;
    color: #fff;
}

.btn-m-outline {
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #000;
}

/* Guest Button */
.btn-mobile-login {
    display: block;
    width: 100%;
    padding: 16px;
    background: #000;
    color: #fff;
    text-align: center;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    margin-top: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mobile-menu-footer {
    padding: 30px 25px;
    background-color: #fff;
    margin-top: auto;
}

.social-links {
    margin-top: 0;
}

.social-item {
    width: 44px;
    height: 44px;
    border-color: #eee;
    color: #333;
}

@media (max-width: 991px) {
    .desktop-nav {
        display: none;
    }
}

/* Hover Effects for Desktop Categories */
@media (min-width: 992px) {

    /* Categories Dropdown Hover */
    .nav-item.dropdown:hover>.dropdown-menu {
        display: block;
        animation: fadeUp 0.2s ease-out forwards;
        top: 100%;
        left: 0;
    }

    /* Account Dropdown Hover */
    .action-item.dropdown:hover>.dropdown-menu {
        display: block;
        animation: fadeUp 0.2s ease-out forwards;
        top: 100%;
        right: 0;
        left: auto;
    }

    /* Chevron Rotation */
    .nav-item:hover .bx-chevron-down {
        transform: rotate(180deg);
        transition: transform 0.2s;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}