/* =========================================
   HEADER STYLES (Fixed Layout & Submenu)
   ========================================= */

.site-header {
    background-color: var(--header-bg);
    color: var(--text-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s;
    height: auto; 
}

.header-main {
    display: flex;
    align-items: center;
    padding: 10px 0;
    flex-wrap: wrap; 
    min-height: 70px;
}

/* --- BRANDING (Logo + Title Side-by-Side) --- */
.site-branding {
    display: flex;
    align-items: center;
    flex-direction: row !important; /* Force Side-by-Side */
    gap: 12px;
}

/* Logo Sizing */
.logo-container {
    line-height: 0;
    display: flex;
    align-items: center;
}

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

.logo-container img, 
.custom-logo-link img {
    height: 50px; /* Fixed Height */
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* Title Container */
.title-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

.site-branding h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    white-space: nowrap; 
    line-height: 1;
}
.site-branding a:hover { color: var(--primary-color); }


.site-description {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.2;
    opacity: 0.8;
}

/* --- DESKTOP NAVIGATION & SUBMENU FIX --- */
.main-navigation {
    margin-left: auto;
    margin-right: 20px;
}

.main-navigation ul {
    display: flex;
    gap: 25px;
    position: relative; 
    margin: 0;
    padding: 0;
}

/* Important: Parent LI relative positioning */
.main-navigation > ul > li {
    position: relative; 
    display: flex;
    align-items: center;
    height: 100%;
}

.main-navigation a {
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 0;
    display: block;
    line-height: 1.5;
}
.main-navigation a:hover { color: var(--primary-color); }

/* Submenu */
.main-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--header-bg);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    min-width: 200px;
    flex-direction: column;
    gap: 0;
    padding: 10px 0;
    z-index: 1001;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.main-navigation ul li {
    position: relative;
}

.main-navigation ul li:hover > ul {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

.main-navigation ul ul li {
    padding: 0 20px;
}

.main-navigation ul ul a {
    padding: 8px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.main-navigation ul ul li:last-child a {
    border-bottom: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.search-toggle, .theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 5px;
    transition: color 0.3s;
}
.search-toggle:hover, .theme-toggle:hover { color: var(--primary-color); }

/* Toggle Menu Hidden on Desktop */
.menu-toggle { display: none; }


/* =========================================
   MOBILE & TABLET RESPONSIVE LAYOUT (Fixed)
   ========================================= */

@media (min-width: 1025px) {
    .site-branding { order: 1; }
    .main-navigation { order: 2; }
    .header-actions { order: 3; }
}

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

    /* 1. BRANDING (Left) */
    .site-branding {
        order: 1;
        margin-right: auto;
        flex-grow: 0;
    }
    
    .site-branding h1 { font-size: 18px; }
    .logo-container img, .custom-logo-link img { height: 40px; }
    .site-description { display: none; } 

    /* 2. ACTIONS (Right) */
    .header-actions {
        order: 2;
        margin-right: 15px;
        gap: 10px;
    }

    /* 3. MENU TOGGLE (Right Corner) */
    .menu-toggle {
        display: flex; 
        align-items: center;
        justify-content: flex-start;
        order: 3;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0;
        color: var(--text-color);
        width: 30px; 
        height: 30px;
    }

    /* 4. NAVIGATION (Full Width Dropdown) */
    .main-navigation {
        order: 4;
        width: 100%;
        display: none; /* JS Toggle */
        margin: 0; 
        position: absolute;
        top: 100%;
        left: 0;
        background: var(--header-bg);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        z-index: 999;
    }

    .site-header.toggled .main-navigation, 
    #site-navigation.toggled {
        display: block;
    }
    
    .main-navigation ul {
        flex-direction: column;
        gap: 0;
    }
    
    .main-navigation > ul > li {
        display: block; /* Reset flex for mobile */
        height: auto;
        border-bottom: 1px solid var(--border-color);
        width: 100%;
    }
    
    .main-navigation ul li:last-child {
        border-bottom: none;
    }
    
    .main-navigation a {
        padding: 15px 20px;
        width: 100%;
    }
    
    /* Mobile Submenu */
    .main-navigation ul ul {
        position: static; /* Static for mobile stack */
        box-shadow: none;
        border-top: none;
        background-color: rgba(0,0,0,0.02);
        display: none; /* JS Toggle */
        padding-left: 20px;
        width: 100%;
        min-width: auto;
    }
    
    .main-navigation ul ul a {
        padding-left: 15px;
    }
}

/* Search Modal */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-modal.active { display: flex; opacity: 1; }

.search-modal-content {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    position: relative;
    text-align: center;
}

.search-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

.search-modal .search-form { display: flex; border-bottom: 2px solid rgba(255,255,255,0.5); }
.search-modal .search-field {
    width: 100%;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    padding: 15px 0;
    outline: none;
}
.search-modal .search-submit {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0 30px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-transform: uppercase;
}


/* --- Header Force Light Mode Fix (With Hover Effect) --- */

/* 1. Normal State: Title Black rahega */
html[data-theme="dark"] .site-header .site-title a {
    color: #000000 !important;    /* Normal Color: Black */
    transition: color 0.3s ease;  /* Smooth Animation add kiya */
    text-decoration: none;        /* Underline hatane ke liye (Optional) */
}

/* 2. Hover State: Mouse le jaane par Blue ho jayega */
html[data-theme="dark"] .site-header .site-title a:hover {
    color: var(--primary-color) !important;    /* Hover Color: Blue (Aapki theme match) */
}

/* =========================================
   📱 MOBILE ONLY: Fix Admin Bar Gap at Top
   ========================================= */
@media screen and (max-width: 782px) {
    #wpadminbar {
        top: 0 !important;       /* सबसे ऊपर चिपकाओ */
        position: fixed !important; /* अपनी जगह पर फिक्स रखो */
    }
}