/**
 * Vina Header Styles
 * Complete header styling based on design
 */

/* Hide default theme header */
#site-header,
.site-header,
.dynamic-header,
.header-inner,
.site-branding {
    display: none;
}

.vina-header {
    position: relative;
    z-index: 1000;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
}

/* ==========================================================================
   Container Styles
   ========================================================================== */

.vina-header .container {
    max-width: 1320px;
    margin: 0 auto;
}

/* ==========================================================================
   Top Bar Styles
   ========================================================================== */

.header-top-bar {
    color: #7E7E7E;
    padding: 8px 20px;
    font-size: 14px;
    border-bottom: 1px solid #ECECEC;
}

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

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-link {
    color: #6c757d;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

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

.separator {
    color: #dee2e6;
    font-weight: 300;
}

.phone-number {
    color: var(--color-accent);
    font-weight: 700;
}

/* ==========================================================================
   Main Header Styles
   ========================================================================== */

.header-main {
    background: white;
    padding: 8px 20px;
    border-bottom: 1px solid #e9ecef;
}

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

/* Logo Section */
.header-logo {
    flex: 1;
}

.logo-wrapper {
    display: flex;
    align-items: center;
}

.logo-link {
    display: block;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.vina-logo {
    width: 236px;
    height: 64px;
    object-fit: cover;
    object-position: center;
}

/* User Menu Section */
.header-user-menu {
    display: flex;
    align-items: center;
    gap: 24px;
}

.language-selector {
    position: relative;
    display: flex;
    align-items: center;
}

.lang-select {
    color: var(--color-primary);
    font-weight: 400;
    font-size: 16px;
    line-height: 16px;
    cursor: pointer;
    appearance: none;
    outline: none;
    border: none;
    background: transparent;
    padding-right: 20px;
    min-width: 80px;
}

.lang-arrow {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    pointer-events: none;
}

.auth-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
}

.login-btn, .signup-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 16px;
    line-height: 16px;
    font-weight: 400;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    outline: none;
}

.login-btn {
    color: #108D52;
}

.login-btn:hover,
.login-btn:active,
.login-btn:focus {
    color: var(--color-accent);
    outline: none;
    box-shadow: none;
}

.signup-btn {
    background: var(--color-primary);
    color: white;
    padding: 12px;
    border-radius: 70px;
}

.signup-btn:hover,
.signup-btn:active,
.signup-btn:focus {
    background: var(--color-secondary);
    color: white;
    outline: none;
    box-shadow: none;
}

.user-icon {
    font-size: 16px;
}

.check-icon {
    font-size: 12px;
    margin-left: 2px;
}

/* ==========================================================================
   Navigation Bar Styles
   ========================================================================== */

.header-navigation {
    background: var(--color-secondary);
    padding: 0 20px;
}

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

.nav-left-group {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-right-group {
    display: flex;
    align-items: center;
}

/* Category Menu */
.category-menu-wrapper {
    position: relative;
}

/* Invisible bridge to connect button and dropdown for smooth hover */
.category-menu-wrapper::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 6px;
    background: transparent;
    z-index: 1002;
    pointer-events: auto;
}

.category-toggle {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(16, 141, 82, 0.12);
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
    border-radius: 0;
    padding: 0;
    padding-right: 34px;
    outline: none;
}

.category-toggle:hover,
.category-toggle:active {
    background: rgba(16, 141, 82, 0.12);
    outline: none;
    box-shadow: none;
}

.category-toggle:focus {
    background: rgba(16, 141, 82, 0.12);
    outline: none;
    box-shadow: none;
}

.hamburger-icon {
    background: rgba(16, 141, 82, 0.85);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 100%;
}

/* Category text in toggle button (All Categories) */
.category-toggle .category-text {
    font-size: 18px;
    font-weight: 600;
}

.dropdown-arrow {
    font-size: 16px;
    transition: transform 0.3s ease;
    transform: rotate(0deg);
}

/* Rotate arrow when dropdown is active (open) or button is hovered */
.category-toggle.active .dropdown-arrow,
.category-toggle:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.category-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 70vh;
    background: white;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    /* No transition by default - only when showing */
    transition: none;
    z-index: 1002;
    margin: 0;
    padding: 0;
    border-top: 1px solid #e9ecef;
    overflow-y: auto;
    box-sizing: border-box;
}

.category-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    /* Add transition only when showing (becoming active) */
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* Dropdown is triggered by hover on category toggle button */

.category-list {
    padding: 20px;
    max-width: 1320px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.category-item {
    border-radius: 8px;
    transition: all 0.3s ease;
}

.category-item:hover {
    border-color: #108D52;
    box-shadow: 0 4px 12px rgba(16, 141, 82, 0.15);
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 16px;
}

.category-link:hover {
    background: #f8f9fa;
    color: #108D52;
}

.category-name {
    font-weight: 500;
}

.category-count {
    font-size: 12px;
    color: #6c757d;
    font-weight: 400;
}

/* Main Navigation */
.main-navigation {
    display: flex;
    gap: 40px;
}

/* Navigation Item Wrapper */
.nav-item-wrapper {
    position: relative;
}

.nav-item-wrapper.has-dropdown {
    position: relative;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    padding: 8px 0;
}

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

.nav-link.current-menu-item,
.nav-link.current_page_item,
.nav-link.active {
    color: #ED3934;
    font-weight: 700;
}

.nav-link:focus {
    border: 0;
    outline: none;
    box-shadow: none;
}
.nav-link:active {
    border: 0;
    outline: none;
    box-shadow: none;
}

.nav-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.nav-link:hover .nav-arrow {
    transform: rotate(180deg);
}

/* Navigation Dropdown */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: white;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1002;
    margin-top: 8px;
    border: 1px solid #e9ecef;
}

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

.nav-dropdown-content {
    padding: 8px 0;
}

.nav-dropdown-link {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
}

.nav-dropdown-link:last-child {
    border-bottom: none;
}

.nav-dropdown-link:hover {
    background: #f8f9fa;
    color: #108D52;
    padding-left: 24px;
}

.nav-dropdown-link.current-menu-item {
    background: #f8f9fa;
    color: #108D52;
    font-weight: 600;
}

/* Premium Link */
.premium-link {
    margin-left: auto;
}

.premium-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ED3934;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s ease;
    padding: 8px 0;
    outline: none;
}

.premium-btn:hover,
.premium-btn:active,
.premium-btn:focus {
    color: #c41e3a;
    outline: none;
    box-shadow: none;
}

.flame-icon {
    font-size: 18px;
}

/* ==========================================================================
   Mobile Header Styles
   ========================================================================== */

/* Mobile Header Container */
.mobile-header {
    display: none;
    background: white;
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mobile-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 8px;
}

/* Mobile Logo */
.mobile-logo {
    display: flex;
    align-items: center;
}

.mobile-logo-link {
    display: block;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.mobile-logo-link:hover {
    opacity: 0.8;
}

.mobile-logo-image {
    height: 40px;
    width: auto;
    object-fit: contain;
    object-position: left center;
}

/* Mobile Right Menu */
.mobile-right-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Mobile Language Selector */
.mobile-language-selector {
    position: relative;
}

.mobile-lang-select {
    background: transparent;
    border: none;
    color: #108D52;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    padding-right: 16px;
    appearance: none;
    outline: none;
}

.mobile-lang-arrow {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: #108D52;
    font-size: 10px;
    pointer-events: none;
}

/* Mobile User Icon */
.mobile-user-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #108D52;
    cursor: pointer;
    transition: all 0.3s ease;
}


/* Mobile Hamburger Menu */
.mobile-hamburger {
    padding: 10px;
    border: none;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.10);
    outline: none;
}

.mobile-hamburger:hover,
.mobile-hamburger:active,
.mobile-hamburger:focus {
    background: white;
    box-shadow: 0 3px 8px 0 rgba(0, 0, 0, 0.10);
    outline: none;
}

.mobile-hamburger-line {
    width: 28px;
    height: 1px;
    background: var(--color-primary);
    border-radius: 1px;
    transition: all 0.3s ease;
}

.mobile-hamburger.active .mobile-hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

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

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

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100%;
    background: white;
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-menu-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f8f9fa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    font-size: 18px;
    outline: none;
}

.mobile-menu-close:hover,
.mobile-menu-close:active,
.mobile-menu-close:focus {
    outline: none;
    box-shadow: none;
}

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

.mobile-menu-section {
    margin-bottom: 30px;
}

.mobile-menu-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #108D52;
}

.mobile-menu-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-links li {
    margin-bottom: 8px;
}

.mobile-menu-links a {
    display: block;
    padding: 12px 0;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f8f9fa;
}

.mobile-menu-links a:hover {
    color: #108D52;
    padding-left: 10px;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 1200px) {
    .nav-content {
        gap: 24px;
    }
    
    .main-navigation {
        gap: 20px;
    }
}

@media (max-width: 992px) {
    .header-user-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
    
    .main-navigation {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
    
    .premium-link {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    /* Hide desktop header on mobile */
    .header-top-bar,
    .header-main,
    .header-navigation {
        display: none;
    }
    
    /* Show mobile header */
    .mobile-header {
        display: block;
    }
    
    /* Add padding to body to prevent content being hidden under fixed header */
    body {
        padding-top: 132px !important;
    }
    
    /* Mobile specific adjustments */
    .mobile-header {
        padding: 10px 16px;
    }
    
    .mobile-logo-image {
        height: 42px;
    }
    
    .mobile-right-menu {
        gap: 12px;
    }
    .mobile-lang-select {
        font-size: 16px;
    }
    
    /* Category dropdown panel on mobile */
    .category-dropdown {
        height: 70vh;
        top: 86px;
    }
    
    .category-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 10px;
        padding: 16px;
    }
    
    .category-link {
        padding: 12px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    
    .mobile-header {
        padding: 8px 12px;
    }
    
    .mobile-right-menu {
        gap: 8px;
    }
    
    .mobile-hamburger-line {
        width: 24px;
    }
    
    .mobile-menu {
        width: 90%;
    }
    
    .category-dropdown {
        top: 64px;
    }
}

/* ==========================================================================
   Animation and Effects
   ========================================================================== */

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-dropdown.active {
    animation: fadeInDown 0.3s ease;
}

/* Smooth transitions for interactive elements - applied selectively */
.category-toggle,
.login-btn,
.signup-btn,
.nav-link,
.premium-btn,
.mobile-hamburger,
.category-link,
.nav-dropdown-link {
    transition: color 0.3s ease, background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

/* Focus states for accessibility - removed outline */
.category-toggle:focus,
.login-btn:focus,
.signup-btn:focus,
.nav-link:focus,
.premium-btn:focus,
.mobile-hamburger:focus,
.mobile-menu-close:focus {
    outline: none;
    box-shadow: none;
}

/* Loading state for category dropdown */
.category-dropdown.loading {
    opacity: 0.7;
    pointer-events: none;
}

.category-dropdown.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #108D52;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Category Dropdown Container - Alibaba Style */
.category-dropdown-container {
    display: flex;
    max-width: 1320px;
    margin: 0 auto;
    height: 100%;
    padding: 0;
    box-sizing: border-box;
    /* Debug: Uncomment to see container boundaries */
    /* border: 2px solid red; */
}

/* Left Sidebar - Main Categories */
.category-sidebar {
    width: 280px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    overflow-y: auto;
    flex-shrink: 0;
    /* Debug: Uncomment to see sidebar boundaries */
    /* border: 2px solid green; */
}

.category-sidebar-title {
    padding: 20px 20px 15px;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e9ecef;
}

.star-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.star-icon svg {
    display: block;
}

.category-main-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-main-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    color: #333;
    font-size: 14px;
}

.category-main-item:hover {
    background: #ffffff;
    color: #108D52;
}

.category-main-item.active {
    background: #ffffff;
    color: #108D52;
    font-weight: 600;
    border-left: 4px solid #108D52;
    padding-left: 16px;
}

.category-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Category text in sidebar list items */
.category-main-item .category-text {
    flex: 1;
    font-size: 14px;
}

/* Right Content Area - Sub-categories */
.category-content {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
    /* Debug: Uncomment to see content boundaries */
    /* border: 2px solid orange; */
}

.category-section {
    display: none;
}

.category-section.active {
    display: block;
}

.category-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.category-section-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #333;
}

.browse-link {
    color: #108D52;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.browse-link:hover {
    color: #0d7341;
    text-decoration: underline;
}

/* Subcategory Grid */
.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 24px 16px;
}

.subcategory-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
    transition: transform 0.2s ease;
}

.subcategory-item:hover {
    transform: translateY(-3px);
}

.subcategory-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    position: relative;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.subcategory-item:hover .subcategory-icon {
    background: #e8f5e9;
    border-color: #108D52;
}

.icon-placeholder {
    font-size: 36px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Badges */
.hot-badge,
.arrow-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hot-badge {
    color: #ff6b35;
}

.arrow-badge {
    color: #108D52;
    font-size: 14px;
}

.subcategory-name {
    font-size: 14px;
    text-align: center;
    line-height: 1.4;
    color: #333;
    max-width: 100px;
}

.subcategory-item.view-all .subcategory-icon {
    background: #f0f0f0;
    border: 2px dashed #ccc;
}

.subcategory-item.view-all:hover .subcategory-icon {
    background: #e0e0e0;
    border-color: #108D52;
}

/* ==========================================
   DEBUG CSS - Uncomment to debug positioning
   ========================================== */
/*
.category-dropdown {
    border: 4px solid blue;
}

.category-dropdown-container {
    border: 2px solid red;
    background: rgba(255, 0, 0, 0.1);
}

.category-sidebar {
    border: 2px solid green;
}

.category-content {
    border: 2px solid orange;
}
*/

/* ==========================================
   DEBUG: Always show dropdown panel
   Option 1: Uncomment CSS below
   Option 2: Use JavaScript: window.vinaDebugDropdown(true) in browser console
   ========================================== */
/*
.category-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
}

.category-dropdown.active {
    opacity: 1;
    visibility: visible;
}
*/

/* Debug mode via body class */
body.debug-dropdown .category-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    z-index: 10000;
}
