/* Prevent horizontal scrolling on mobile */
html, body {
    overflow-x: hidden;
}

/* =========================================
   1. GLOBAL OVERRIDES (Kills the 'X' Button on Desktop)
   ========================================= */
.menu-toggle,
.mobile-menu-close,
.mobile-menu-overlay {
    display: none !important; /* Strictly hidden by default everywhere */
}

/* =========================================
   2. HEADER & NAVIGATION (PREMIUM STYLE)
   ========================================= */
.site-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 9999;
}

.header-flex { display: flex; justify-content: space-between; align-items: center; min-height: 80px; }
.header-right-section { display: flex; align-items: center; gap: 25px; }

/* Logo Setup */
.site-branding img, .custom-logo { max-width: 240px; height: auto; display: block; transition: opacity 0.3s ease; }
.site-branding img:hover { opacity: 0.9; }
.site-title { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px; }
.site-title a { text-decoration: none; color: inherit; }

/* =========================================
   3. DESKTOP MENU (min-width: 993px)
   ========================================= */
@media (min-width: 993px) {
    .main-navigation, .main-navigation ul { background: transparent !important; }
    .main-navigation { display: block; }
    .main-navigation ul { display: flex; list-style: none; margin: 0; padding: 0; align-items: center; gap: 5px; }
    .main-navigation li { position: relative; }
    .main-navigation a { display: block; padding: 10px 18px; text-decoration: none; font-size: 1rem; font-weight: 600; border-radius: 6px; background: transparent !important; transition: all 0.3s ease; }

    /* Desktop Dropdown (Sub-menu) */
    .main-navigation ul ul.sub-menu {
        position: absolute; top: 120%; left: 0; background-color: #ffffff !important; min-width: 240px;
        box-shadow: 0 15px 35px rgba(0,0,0,0.1); border-radius: 8px; display: flex; flex-direction: column;
        opacity: 0; visibility: hidden; transform: translateY(15px); transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); z-index: 999; padding: 10px 0;
    }
    .main-navigation li:hover > ul.sub-menu { opacity: 1; visibility: visible; transform: translateY(0); top: 100%; }
    .main-navigation ul ul.sub-menu a { padding: 10px 25px; font-size: 0.95rem; font-weight: 500; color: #333 !important; border-radius: 0; }
    .main-navigation ul ul.sub-menu a:hover { background-color: #f8f9fa !important; padding-left: 30px; }
}

/* =========================================
   4. SEARCH BAR (Desktop & Mobile)
   ========================================= */
.header-search { position: relative; display: flex; align-items: center; }
.header-search-icon { font-size: 1.25rem; text-decoration: none; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.05); transition: all 0.3s ease; }
.header-search-icon:hover { background: rgba(255, 255, 255, 0.1); transform: scale(1.05); }

.header-search-dropdown {
    position: absolute; top: 150%; right: 0; background: #ffffff; padding: 20px; width: 320px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15); border-radius: 12px; opacity: 0; visibility: hidden;
    transform: translateY(15px); transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); z-index: 1000;
}
.header-search-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0); }
.header-search-dropdown input[type="search"] { width: 100%; padding: 14px 20px; border: 2px solid #eaeaea; border-radius: 8px; font-family: inherit; font-size: 1rem; transition: border-color 0.3s; box-sizing: border-box; }
.header-search-dropdown input[type="search"]:focus { border-color: var(--wp--preset--color--primary, #0073aa); outline: none; }
.header-search-dropdown button { display: none; }

/* =========================================
   5. MOBILE RESPONSIVENESS (Off-Canvas Menu)
   ========================================= */
@media (max-width: 992px) {
    .header-flex { min-height: 70px; }
    
    /* Hamburger Button */
    .menu-toggle {
        display: flex !important; align-items: center; justify-content: center;
        background: transparent; border: none; font-size: 1.8rem;
        cursor: pointer; width: 45px; height: 45px; z-index: 10002;
        transition: opacity 0.3s ease;
    }
    
    /* Hide Hamburger when menu is open so 'X' is clickable */
    .menu-toggle[aria-expanded="true"] {
        opacity: 0;
        pointer-events: none;
    }
    
    /* Fixed 'X' button styling */
    .mobile-menu-close {
        display: flex !important; align-items: center; justify-content: center;
        position: absolute; top: 20px; right: 20px;
        background: rgba(255,255,255,0.1); border: none; border-radius: 50%;
        width: 40px; height: 40px; font-size: 2rem;
        cursor: pointer; line-height: 1; color: inherit; 
        transition: background 0.3s; z-index: 10003;
    }
    .mobile-menu-close:hover { background: rgba(255,255,255,0.2); }
    
    /* Dark Overlay WITHOUT Blur */
    .mobile-menu-overlay {
        display: block !important;
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.85);
        z-index: 10000; opacity: 0; visibility: hidden; transition: all 0.3s ease;
    }


    /* Sliding Panel Setup */
    .main-navigation {
        position: fixed; top: 0; bottom: 0; width: 320px; max-width: 85%;
        z-index: 10001; box-shadow: 0 0 30px rgba(0,0,0,0.5);
        overflow-y: auto; padding: 80px 25px 30px; 
        transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
        -webkit-backface-visibility: hidden;
    }

    /* Direction Selectors (Transform prevents side-scrolling) */
    .main-navigation.slide-left { left: 0; right: auto; transform: translateX(-105%); }
    .main-navigation.slide-left.toggled { transform: translateX(0); }
    .main-navigation.slide-right { right: 0; left: auto; transform: translateX(105%); }
    .main-navigation.slide-right.toggled { transform: translateX(0); }

    /* Mobile Menu Items - Uses 'inherit' so it pulls the white color from Customizer */
    .main-navigation ul { display: flex; flex-direction: column; width: 100%; padding: 0; margin: 0; list-style: none;}
    .main-navigation a { 
        display: block; padding: 16px 0; 
        border-bottom: 1px solid rgba(255,255,255,0.1); 
        font-size: 1.1rem; font-weight: 600; color: inherit !important;
    }
    
    /* Sub-menu inside Mobile */
    .main-navigation ul ul.sub-menu {
        position: static; opacity: 1; visibility: visible; transform: none;
        box-shadow: none; border: none; background: transparent; padding-left: 15px;
    }
    .main-navigation ul ul.sub-menu a { padding: 12px 0; font-size: 1rem; border-bottom: 1px dashed rgba(255,255,255,0.1); }
}

/* =========================================
   4. SEARCH BAR (Desktop & Mobile)
   ========================================= */


.header-search { position: relative; display: flex; align-items: center; }

/* The Search Icon in the Header */
.header-search-icon { 
    font-size: 1.25rem; text-decoration: none; display: flex; align-items: center; justify-content: center; 
    width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.05); transition: all 0.3s ease; 
}
.header-search-icon:hover { background: rgba(255, 255, 255, 0.1); transform: scale(1.05); }

/* =========================================
   6. MOBILE SEARCH BAR FIX
   ========================================= */
@media (max-width: 768px) {
    .header-search-dropdown {
        /* Changes from floating to a fixed, centered mobile layout */
        position: fixed;
        top: 85px; /* Pops up right below your header */
        left: 5%;
        right: auto;
        width: 90%; /* Fits perfectly on any phone screen */
        padding: 15px;
        box-sizing: border-box;
    }
    
    .header-search-dropdown form {
        width: 100%;
    }
    
    .header-search-dropdown input[type="search"],
    .header-search-dropdown input[type="text"],
    .header-search-dropdown .search-field {
        width: 100%; /* Ensures the input doesn't overflow */
    }
}

/* The Form Layout (Forces input and button side-by-side) */
.header-search-dropdown form {
    display: flex;
    gap: 10px;
    margin: 0;
}

/* The Text Input Field */
.header-search-dropdown input[type="search"],
.header-search-dropdown input[type="text"],
.header-search-dropdown .search-field { 
    flex-grow: 1; /* Forces input to take up maximum space */
    padding: 12px 15px; 
    border: 2px solid #eaeaea; 
    border-radius: 6px; 
    background-color: #f9f9f9;
    font-family: inherit; 
    font-size: 0.95rem; 
    color: #333;
    transition: all 0.3s ease; 
    box-sizing: border-box; 
}
.header-search-dropdown input[type="search"]:focus,
.header-search-dropdown input[type="text"]:focus { 
    border-color: var(--wp--preset--color--primary, #0073aa); 
    background-color: #ffffff;
    outline: none; 
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1); /* Nice premium glow effect */
}

/* The Submit Button */
.header-search-dropdown button,
.header-search-dropdown input[type="submit"],
.header-search-dropdown .search-submit { 
    background-color: var(--wp--preset--color--primary, #0073aa);
    color: #ffffff;
    border: none;
    padding: 0 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.header-search-dropdown button:hover,
.header-search-dropdown input[type="submit"]:hover { 
    background-color: #005a87;
    transform: translateY(-1px);
}

/* =========================================
   CATEGORY SECTION HEADERS & VIEW MORE
   ========================================= */
.category-header {
    display: flex;
    justify-content: space-between; /* Pushes items to opposite edges */
    align-items: flex-end; /* Aligns them at the bottom */
    margin-bottom: 25px;
    border-bottom: 1px solid #eaeaea; /* Light gray line under everything */
    padding-bottom: 10px;
}

/* Category Title Formatting */
.category-header .section-heading {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #111;
    position: relative;
}

/* The blue underline under just the word */
.category-header .section-heading::after {
    content: '';
    position: absolute;
    bottom: -11px; /* Overlaps the gray border perfectly */
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--wp--preset--color--primary, #0073aa);
}

/* View More Button Formatting */
.view-more-btn {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wp--preset--color--primary, #0073aa);
    text-decoration: none;
    padding: 6px 16px;
    border: 1px solid var(--wp--preset--color--primary, #0073aa);
    border-radius: 4px;
    transition: all 0.3s ease;
    white-space: nowrap; /* Prevents the text from stacking on mobile */
}

.view-more-btn:hover {
    background-color: var(--wp--preset--color--primary, #0073aa);
    color: #ffffff;
}