/**
 * Header V2 Styles for Default Demo
 * 
 * Comprehensive styles for:
 * - Desktop header (logo, navigation, search, notifications, cart, avatar)
 * - Mobile header (hamburger, logo, cart)
 * - Mobile menu sidebar (profile, quick access, categories)
 * - 3-level mega menu with 2-column layout
 * - Avatar dropdown menu
 * - All interactive elements and animations
 * 
 * Features:
 * - Fully responsive (desktop/tablet/mobile)
 * - Sticky header support
 * - Admin bar compatibility
 * - Smooth animations and transitions
 * - No borders (clean minimalist design)
 * - Theme color integration via CSS variables
 * 
 * @package MLM
 * @version 2.0
 * @since 2.0
 */

/* ============================================
   CSS Variables (will be injected via inline style)
   ============================================ */
:root {
    --mlm-primary-color: #F97316;
    --mlm-secondary-color: #6B7280;
}

/* ============================================
   Desktop Header Base Styles
   ============================================ */
.mlm-header-v2 {
    position: relative;
    background-color: #fff;
    z-index: 1000;
    /* No box-shadow as requested */
    /* No border as requested */
}

.mlm-header-v2 .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

/* Logo */
.mlm-header-v2-logo {
    display: block;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.mlm-header-v2-logo:hover {
    opacity: 0.8;
    text-decoration: none;
}

.mlm-header-v2-logo img {
    max-height: 50px;
    width: auto;
    height: auto;
}

.mlm-header-v2-logo h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #1f2937;
}

/* ============================================
   Main Navigation Menu (3-level)
   ============================================ */
.mlm-header-v2-nav {
    display: flex;
    align-items: center;
}

.mlm-header-v2-menu-list {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mlm-header-v2-menu-item {
    position: relative;
}

.mlm-header-v2-menu-link {
    display: block;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 6px;
}

.mlm-header-v2-menu-link:hover {
    color: var(--mlm-primary-color);
    background-color: #f9fafb;
    text-decoration: none;
}

/* Mega Menu Dropdown (3-level) */
.mlm-header-v2-mega-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #fff;
    border: none;
    border-radius: 8px;
    min-width: 600px;
    max-width: 800px;
    padding: 20px;
    margin-top: 8px;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
    z-index: 1001;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mlm-header-v2-menu-item.menu-item-has-children:hover .mlm-header-v2-mega-menu,
.mlm-header-v2-menu-item.menu-item-has-children .mlm-header-v2-mega-menu.active {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Ensure mega menu stays visible when hovering over it */
.mlm-header-v2-mega-menu:hover {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mlm-mega-menu-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Right Column (Level 2 Categories) */
.mlm-mega-menu-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mlm-mega-menu-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
    /* No border as requested */
}

.mlm-mega-menu-category:hover {
    background-color: #f3f4f6;
    color: var(--mlm-primary-color);
    text-decoration: none;
}

.mlm-mega-menu-category.active {
    background-color: #eff6ff;
    color: var(--mlm-primary-color);
}

.mlm-mega-menu-arrow {
    margin-right: 8px;
    font-size: 18px;
    color: #9ca3af;
    transition: transform 0.3s ease;
}

.mlm-mega-menu-category:hover .mlm-mega-menu-arrow {
    transform: translateX(-3px);
}

/* Left Column (Level 3 Sub-items) */
.mlm-mega-menu-left {
    position: relative;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mlm-mega-menu-left::-webkit-scrollbar {
    width: 6px;
}

.mlm-mega-menu-left::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mlm-mega-menu-left::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.mlm-mega-menu-left::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.mlm-mega-menu-sub-panel {
    display: none;
}

.mlm-mega-menu-sub-panel.active {
    display: block;
}

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

.mlm-mega-menu-sub li {
    margin: 0;
    padding: 0;
}

.mlm-mega-menu-sub li a {
    display: block;
    padding: 8px 12px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.mlm-mega-menu-sub li a:hover {
    background-color: #f9fafb;
    color: var(--mlm-primary-color);
    text-decoration: none;
    padding-right: 16px;
}

/* ============================================
   Search Form
   ============================================ */
.mlm-header-v2-search {
    min-width: 300px;
    max-width: 400px;
}

.mlm-header-v2-search .input-group {
    background-color: #f5f5f5;
    border-radius: 12px;
    padding: 4px;
    transition: background-color 0.3s ease;
}

.mlm-header-v2-search .input-group:focus-within {
    background-color: #fff;
}

.mlm-header-v2-search .input-group-prepend {
    margin: 0;
}

.mlm-header-v2-search .input-group-prepend .input-group-text {
    color: #9ca3af;
    background-color: transparent;
    border: none;
    padding: 0;
    padding-left: 12px;
    padding-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mlm-header-v2-search .input-group-prepend svg {
    width: 18px;
    height: 18px;
    stroke: #9ca3af;
}

.mlm-header-v2-search .form-control {
    border: none;
    border-radius: 12px;
    padding: 8px 16px 8px 8px;
    font-size: 14px;
    background-color: transparent;
    color: #374151;
}

.mlm-header-v2-search .form-control::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.mlm-header-v2-search .form-control:focus {
    border: none;
    box-shadow: none;
    background-color: transparent;
    outline: none;
}

.mlm-header-v2-search .input-group:focus-within .input-group-prepend svg {
    stroke: #6b7280;
}

/* ============================================
   Notification Icon
   ============================================ */
.mlm-header-v2-notification-wrapper {
    position: relative;
}

.mlm-header-v2-notification-btn {
    color: #6b7280;
    transition: color 0.3s ease;
    position: relative;
}

.mlm-header-v2-notification-btn:hover {
    color: var(--mlm-primary-color);
}

.mlm-header-v2-notification-badge {
    top: 0;
    right: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    border: 2px solid #fff;
}

/* Notification Dropdown Panel */
.notification-dropdown-panel {
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    margin-top: 10px;
    position: absolute;
    right: 0;
    left: auto;
    width: 350px;
    max-width: 400px;
    display: none;
    visibility: hidden;
    opacity: 0;
    z-index: 9999;
    background-color: #fff;
}

@media (max-width: 768px) {
    .notification-dropdown-panel {
        left: 15px;
        right: 15px;
        width: auto;
        max-width: none;
    }
}

@media (min-width: 993px) {
    .notification-dropdown-panel {
        width: 400px;
    }
}

.notification-panel-header {
    border-bottom: 1px solid #f3f4f6;
}

.notification-panel-content {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.notification-panel-content::-webkit-scrollbar {
    width: 6px;
}

.notification-panel-content::-webkit-scrollbar-track {
    background: transparent;
}

.notification-panel-content::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.notification-panel-content::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.notification-card {
    transition: background-color 0.2s ease;
    padding: 12px 16px;
}

.notification-card:hover {
    background-color: #f9fafb;
}

.notification-card a {
    display: block;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    flex-shrink: 0;
}

.notification-icon svg {
    width: 20px;
    height: 20px;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.notification-date {
    font-size: 12px;
    color: #6b7280;
}

.notification-excerpt {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* ============================================
   Shopping Cart Icon
   ============================================ */
.mlm-header-v2-cart-btn {
    color: #6b7280;
    transition: color 0.3s ease;
    position: relative;
}

.mlm-header-v2-cart-btn:hover {
    color: var(--mlm-primary-color);
}

.mlm-header-v2-cart-badge {
    top: 0;
    right: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    border: 2px solid #fff;
}

/* ============================================
   Avatar Dropdown Menu
   ============================================ */
.mlm-header-v2-avatar-dropdown {
    position: relative;
}

.mlm-header-v2-avatar-btn {
    padding: 0;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    transition: border-color 0.3s ease;
}

.mlm-header-v2-avatar-btn:hover {
    border-color: var(--mlm-primary-color);
}

.mlm-header-v2-avatar-btn img {
    display: block;
    border-radius: 50%;
}

.mlm-header-v2-avatar-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 280px;
    max-width: 320px;
    margin-top: 8px;
    border: none;
    border-radius: 8px;
    z-index: 1002;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
}

.mlm-header-v2-avatar-menu[style*="display: block"],
.mlm-header-v2-avatar-menu:not([style*="display: none"]) {
    transform: translateY(0);
}

.mlm-header-v2-avatar-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    transition: all 0.3s ease;
}

.mlm-header-v2-avatar-menu-item:hover {
    background-color: #f9fafb;
    color: var(--mlm-primary-color);
    text-decoration: none;
}

.mlm-header-v2-avatar-menu-item svg {
    color: #6b7280;
    transition: color 0.3s ease;
}

.mlm-header-v2-avatar-menu-item:hover svg {
    color: var(--mlm-primary-color);
}

.mlm-header-v2-avatar-menu-item.text-danger {
    color: #dc2626;
}

.mlm-header-v2-avatar-menu-item.text-danger:hover {
    background-color: #fef2f2;
}

.mlm-header-v2-avatar-menu-item.text-danger svg {
    color: #dc2626;
}

/* ============================================
   Login/Register Button
   ============================================ */
.mlm-header-v2 .btn {
    border: none;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mlm-header-v2 .btn:hover {
    border: none;
    color: var(--mlm-primary-color);
    background-color: #f9fafb;
}

/* ============================================
   Backdrop for Mega Menu (Only below header)
   ============================================ */
.mlm-header-v2-mega-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    pointer-events: none;
}

.mlm-header-v2-mega-backdrop.active {
    display: block;
    pointer-events: auto;
    /* Backdrop should only appear below header */
    clip-path: polygon(0 100px, 100% 100px, 100% 100%, 0 100%);
    -webkit-clip-path: polygon(0 100px, 100% 100px, 100% 100%, 0 100%);
}

/* ============================================
   Backdrop for Avatar Menu
   ============================================ */
.mlm-header-v2-avatar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
}

.mlm-header-v2-avatar-backdrop.active {
    display: block;
}

/* ============================================
   Sticky Header
   ============================================ */
.mlm-header-v2.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Admin bar adjustment for sticky header */
body.admin-bar .mlm-header-v2.sticky {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .mlm-header-v2.sticky {
        top: 46px;
    }
}

/* Ensure content doesn't jump when header becomes sticky */
.mlm-header-v2.sticky {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0.9;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Note: Spacer for content is handled by JavaScript to prevent content jump */

/* ============================================
   Mobile Header Styles
   ============================================ */
.mlm-header-v2-mobile {
    position: relative;
    background-color: #fff;
    z-index: 1000;
    margin: 0 !important;
    padding: 0 !important;
    /* No border as requested */
}

.mlm-header-v2-mobile .container-fluid {
    margin: 0 !important;
    padding: 0 !important;
}

.mlm-header-v2-mobile .row {
    margin: 0 !important;
    padding: 0 !important;
}

.mlm-header-v2-hamburger {
    color: #374151;
    transition: color 0.3s ease;
}

.mlm-header-v2-hamburger:hover {
    color: var(--mlm-primary-color);
}

.mlm-header-v2-hamburger svg {
    width: 24px;
    height: 24px;
}

.mlm-header-v2-logo-mobile {
    display: block;
    text-decoration: none;
}

.mlm-header-v2-logo-mobile:hover {
    text-decoration: none;
}

.mlm-header-v2-logo-mobile img {
    max-height: 40px;
    width: auto;
    height: auto;
}

.mlm-header-v2-logo-mobile h1 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
}

.mlm-header-v2-cart-btn-mobile {
    color: #6b7280;
    transition: color 0.3s ease;
    position: relative;
}

.mlm-header-v2-cart-btn-mobile:hover {
    color: var(--mlm-primary-color);
}

.mlm-header-v2-cart-badge-mobile {
    top: 0;
    right: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    border: 2px solid #fff;
}

/* ============================================
   Mobile Menu Sidebar
   ============================================ */
.mlm-header-v2-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    bottom: 0;
    width: 85%;
    max-width: 400px;
    background-color: #fff;
    z-index: 10001;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.mlm-header-v2-mobile-menu.active {
    right: 0;
}

/* Admin bar adjustment for mobile menu */
body.admin-bar .mlm-header-v2-mobile-menu {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .mlm-header-v2-mobile-menu {
        top: 46px;
    }
}

/* Mobile Menu Profile Section */
.mlm-mobile-menu-profile {
    background-color: #fff;
}

.mlm-mobile-menu-profile a {
    color: #1f2937;
}

.mlm-mobile-menu-profile a:hover {
    text-decoration: none;
}

.mlm-mobile-menu-avatar img {
    border-radius: 50%;
    border: 2px solid #e5e7eb;
}

.mlm-mobile-menu-arrow {
    color: #9ca3af;
    transition: transform 0.3s ease;
}

.mlm-mobile-menu-profile a:hover .mlm-mobile-menu-arrow {
    transform: translateX(-3px);
}

/* Quick Access Section */
.mlm-mobile-menu-quick-access {
    background-color: #fff;
}

.mlm-mobile-menu-item {
    color: #374151;
    transition: all 0.3s ease;
}

.mlm-mobile-menu-item:hover {
    background-color: #f9fafb;
    color: var(--mlm-primary-color);
    text-decoration: none;
}

.mlm-mobile-menu-item svg {
    color: #6b7280;
    transition: color 0.3s ease;
}

.mlm-mobile-menu-item:hover svg {
    color: var(--mlm-primary-color);
}

.mlm-mobile-menu-item .mr-auto {
    margin-right: auto;
    color: #9ca3af;
    transition: transform 0.3s ease;
}

.mlm-mobile-menu-item-has-children.active > a .mr-auto {
    transform: rotate(-90deg);
}

/* Divider */
.mlm-mobile-menu-divider {
    height: 1px;
    background-color: #f3f4f6;
    margin: 8px 0;
}

/* Section Title */
.mlm-mobile-menu-section-title {
    background-color: #f9fafb;
    color: var(--mlm-primary-color);
}

/* Mobile Menu Navigation */
.mlm-mobile-menu-nav {
    background-color: #fff;
}

.mlm-mobile-menu-item-has-children {
    position: relative;
}

.mlm-mobile-menu-sub {
    display: none;
    background-color: #f9fafb;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mlm-mobile-menu-item-has-children.active .mlm-mobile-menu-sub {
    display: block;
    max-height: 1000px;
}

.mlm-mobile-menu-sub-item {
    color: #6b7280;
    transition: all 0.3s ease;
}

.mlm-mobile-menu-sub-item:hover {
    background-color: #f3f4f6;
    color: var(--mlm-primary-color);
    text-decoration: none;
    padding-right: 20px;
}

.mlm-mobile-menu-sub-level2 {
    display: none;
    background-color: #f3f4f6;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mlm-mobile-menu-item-has-children.active .mlm-mobile-menu-sub-level2 {
    display: block;
    max-height: 1000px;
}

/* ============================================
   Mobile Menu Backdrop
   ============================================ */
.mlm-header-v2-mobile-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mlm-header-v2-mobile-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Responsive Styles
   ============================================ */
@media (min-width: 992px) {
    .mlm-header-v2-mobile {
        display: none !important;
    }
    
    .mlm-header-v2-mobile-menu {
        display: none !important;
    }
    
    .mlm-header-v2-mobile-backdrop {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    .mlm-header-v2 {
        display: none !important;
    }
    
    /* Sticky mobile header */
    .mlm-header-v2-mobile {
        position: fixed;
        top: 0 !important;
        left: 0;
        right: 0;
        z-index: 1000;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        transform: translateY(0) !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Hide header when scrolling down */
    .mlm-header-v2-mobile.scrolled-down {
        transform: translateY(-100%) !important;
        box-shadow: none;
    }
    
    /* Show header when scrolling up */
    .mlm-header-v2-mobile.scrolled-up {
        transform: translateY(0) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        top: 0 !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Ensure inner elements don't add spacing */
    .mlm-header-v2-mobile .container-fluid,
    .mlm-header-v2-mobile .row {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Add minimal padding to row for content spacing */
    .mlm-header-v2-mobile .row {
        padding: 8px 15px !important;
    }
    
    /* Admin bar adjustment for mobile header */
    body.admin-bar .mlm-header-v2-mobile {
        top: 32px !important;
    }
    
    body.admin-bar .mlm-header-v2-mobile.scrolled-down {
        transform: translateY(calc(-100% - 32px)) !important;
    }
    
    body.admin-bar .mlm-header-v2-mobile.scrolled-up {
        top: 32px !important;
        transform: translateY(0) !important;
    }
    
    @media screen and (max-width: 782px) {
        body.admin-bar .mlm-header-v2-mobile {
            top: 46px !important;
        }
        
        body.admin-bar .mlm-header-v2-mobile.scrolled-down {
            transform: translateY(calc(-100% - 46px)) !important;
        }
        
        body.admin-bar .mlm-header-v2-mobile.scrolled-up {
            top: 46px !important;
            transform: translateY(0) !important;
        }
    }
    
    /* Add spacer for mobile header */
    body:not(.admin-bar) #primary.content-area {
        padding-top: 60px;
    }
    
    body.admin-bar #primary.content-area {
        padding-top: 92px;
    }
    
    @media screen and (max-width: 782px) {
        body.admin-bar #primary.content-area {
            padding-top: 106px;
        }
    }
    
    /* Add padding to body when mobile menu is open */
    body.mobile-menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
}

/* ============================================
   Search Results Dropdown
   ============================================ */
.mlm-search-results {
    top: 100%;
    right: 0;
    left: 0;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1003;
    border: none;
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background-color: #fff;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
}

.mlm-search-results.open {
    transform: translateY(0);
}

.mlm-search-results::-webkit-scrollbar {
    width: 6px;
}

.mlm-search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mlm-search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.mlm-search-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
