/* ============================================
   MOBILE HEADER V2 - Clean Implementation
   ============================================ */

/* Ensure full width on mobile */
@media (max-width: 968px) {
    html,
    html:root {
        overflow-x: hidden !important;
    }
    
    body,
    html body {
        overflow-x: hidden !important;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 0 !important;
        /* padding-top will be set later for fixed header */
    }
    
    /* Main content wrapper */
    .main-content-wrapper {
        overflow-x: hidden !important;
    }
}

/* Mobile Header V2 - Sticky/Fixed header */
@media (max-width: 968px) {
    /* Maximum specificity to ensure full width on ALL pages */
    html body > .mobile-header-v2,
    body > .mobile-header-v2,
    html body .mobile-header-v2,
    body .mobile-header-v2,
    html body.home > .mobile-header-v2,
    body.home > .mobile-header-v2,
    html body.page-template-page-login > .mobile-header-v2,
    body.page-template-page-login > .mobile-header-v2,
    html body.page-template-page-register > .mobile-header-v2,
    body.page-template-page-register > .mobile-header-v2,
    .mobile-header-v2 {
        position: fixed !important; /* Sticky header at top */
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 100vw !important;
        margin: 0 !important;
        margin-left: calc(50% - 50vw) !important;
        margin-right: calc(50% - 50vw) !important;
        padding: 0 !important;
        z-index: 1000 !important;
        background: var(--bg-color) !important;
        border-bottom: 1px solid var(--border-color) !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        transform: none !important;
        -webkit-transform: none !important;
        /* Ensure it's always visible */
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Add padding-top to body to prevent content from going behind fixed header */
    /* Header height: min-height 60px + padding 0.875rem top/bottom (28px) + border 1px = ~89px */
    body,
    html body {
        padding-top: 75px !important;
    }
    
    .mobile-header-v2 .mobile-header-v2-row {
        display: grid;
        grid-template-columns: 44px 1fr auto;
        align-items: center;
        gap: 1rem;
        padding: 0.875rem 1rem;
        width: 100%;
        box-sizing: border-box;
        min-height: 60px;
    }
    
    /* Theme Toggle */
    .mobile-header-v2 .mobile-header-v2-theme-toggle {
        justify-self: start;
        background: none;
        border: none;
        padding: 0.5rem;
        cursor: pointer;
        color: var(--text-color);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        transition: background-color 0.2s;
    }
    
    .mobile-header-v2 .mobile-header-v2-theme-toggle:active {
        background: var(--border-color);
    }
    
    .mobile-header-v2 .mobile-header-v2-theme-icon-svg {
        width: 20px;
        height: 20px;
        stroke-width: 2;
    }
    
    /* Logo */
    .mobile-header-v2 .mobile-header-v2-logo-link {
        justify-self: center;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-header-v2 .mobile-header-v2-logo-img {
        height: 45px;
        width: auto;
        display: block;
    }
    
    .mobile-header-v2 .mobile-header-v2-logo-img--dark {
        display: none;
    }
    
    body[data-theme="dark"] .mobile-header-v2 .mobile-header-v2-logo-img--light {
        display: none;
    }
    
    body[data-theme="dark"] .mobile-header-v2 .mobile-header-v2-logo-img--dark {
        display: block;
    }
    
    /* Right Actions */
    .mobile-header-v2 .mobile-header-v2-actions-right {
        justify-self: end;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .mobile-header-v2 .mobile-header-v2-notification-toggle,
    .mobile-header-v2 .mobile-header-v2-profile-link {
        background: none;
        border: none;
        padding: 0.5rem;
        cursor: pointer;
        color: var(--text-color);
        text-decoration: none;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        transition: background-color 0.2s;
    }
    
    .mobile-header-v2 .mobile-header-v2-notification-toggle:active,
    .mobile-header-v2 .mobile-header-v2-profile-link:active {
        background: var(--border-color);
    }
    
    .mobile-header-v2 .mobile-header-v2-login-link {
        background: none;
        border: none;
        padding: 0.5rem 1rem;
        cursor: pointer;
        color: var(--text-color);
        text-decoration: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.875rem;
        font-weight: 500;
        border-radius: 6px;
        transition: background-color 0.2s;
    }
    
    .mobile-header-v2 .mobile-header-v2-login-link:active {
        background: var(--border-color);
    }
    
    .mobile-header-v2 .mobile-header-v2-notification-badge {
        position: absolute;
        top: 0;
        right: 0;
        background: var(--primary-color);
        color: white;
        border-radius: 50%;
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
    }
    
    /* Mobile Menu Overlay */
    .mobile-header-v2-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .mobile-header-v2-menu-overlay.active {
        display: block;
        opacity: 1;
    }
    
    /* Mobile Drawer */
    .mobile-header-v2-drawer {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        background: var(--bg-color);
        z-index: 9999;
        transition: right 0.3s ease;
        display: flex;
        flex-direction: column;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }
    
    .mobile-header-v2-drawer.active {
        right: 0;
    }
    
    /* Drawer Header */
    .mobile-header-v2-drawer-header {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
        background: var(--bg-color);
        position: sticky;
        top: 0;
        z-index: 10;
        position: relative;
    }
    
    .mobile-header-v2-drawer-logo-link {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1;
    }
    
    .mobile-header-v2-drawer-logo-img {
        height: 40px;
        width: auto;
    }
    
    .mobile-header-v2-drawer-logo-img--dark {
        display: none;
    }
    
    body[data-theme="dark"] .mobile-header-v2-drawer-logo-img--light {
        display: none;
    }
    
    body[data-theme="dark"] .mobile-header-v2-drawer-logo-img--dark {
        display: block;
    }
    
    .mobile-header-v2-drawer-close {
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        padding: 0.5rem;
        cursor: pointer;
        color: var(--text-color);
        font-size: 1.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        transition: background-color 0.2s;
        z-index: 11;
    }
    
    .mobile-header-v2-drawer-close:hover {
        background: var(--border-color);
    }
    
    /* Drawer Content */
    .mobile-drawer-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
    }
    
    .mobile-drawer-content-wrapper {
        flex: 1;
        overflow-y: auto;
        padding: 1rem 0;
        min-height: 0;
    }
    
    /* Bottom Navigation Items in Drawer */
    .mobile-drawer-bottom-nav-items {
        margin-top: 0;
        padding: 0;
    }
    
    .mobile-bottom-nav-list {
        list-style: none;
        margin: 0;
        padding: 0;
        text-align: center;
    }
    
    .mobile-bottom-nav-list li {
        margin: 0;
        padding: 0;
        text-align: center;
    }
    
    .mobile-bottom-nav-item-link {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.875rem 1.5rem;
        color: var(--text-color);
        text-decoration: none;
        transition: all 0.2s;
        border-bottom: 1px solid var(--border-color);
        gap: 0.75rem;
    }
    
    .mobile-bottom-nav-item-link:hover {
        background: var(--border-color);
    }
    
    .mobile-bottom-nav-item-link i {
        font-size: 1rem;
        width: 20px;
        text-align: center;
        flex-shrink: 0;
    }
    
    .mobile-drawer-email-section {
        padding: 1rem 0;
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
    }
    
    .mobile-drawer-email-text {
        margin: 0;
        padding: 0 1.5rem;
        text-align: center;
        font-size: 0.875rem;
        color: var(--text-color);
        opacity: 0.8;
        line-height: 1.5;
    }
    
    .mobile-drawer-email-text a {
        color: var(--accent-color-1);
        text-decoration: none;
        font-weight: 500;
        transition: color 0.2s;
    }
    
    .mobile-drawer-email-text a:hover {
        color: var(--accent-color-2);
        text-decoration: underline;
    }
    
    /* Navigation Menu in Drawer */
    .mobile-drawer-content .nav-menu {
        list-style: none;
        margin: 0;
        padding: 0;
        text-align: center;
    }
    
    .mobile-drawer-content .nav-menu li {
        margin: 0;
        padding: 0;
        text-align: center;
    }
    
    .mobile-drawer-content .nav-menu a {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.875rem 1.5rem;
        color: var(--text-color);
        text-decoration: none;
        transition: all 0.2s;
        border-bottom: 1px solid var(--border-color);
        gap: 0.75rem;
    }
    
    .mobile-drawer-content .nav-menu a:hover {
        background: var(--border-color);
    }
    
    /* Font Awesome icons for menu items */
    .mobile-drawer-content .nav-menu a i {
        font-size: 1rem;
        width: 20px;
        text-align: center;
        flex-shrink: 0;
    }
    
    /* Categories Section */
    .mobile-drawer-categories {
        margin-top: 1.5rem;
        padding: 0 1rem;
    }
    
    .mobile-drawer-section-title {
        font-size: 0.875rem;
        font-weight: 600;
        text-transform: uppercase;
        color: var(--text-color);
        margin: 0 0 1rem 0;
        padding: 0.5rem 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        opacity: 0.7;
    }
    
    .mobile-category-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .mobile-category-item {
        margin: 0;
        padding: 0;
    }
    
    .mobile-category-link {
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
        color: var(--text-color);
        text-decoration: none;
        transition: background-color 0.2s;
        border-radius: 4px;
        margin-bottom: 0.25rem;
    }
    
    .mobile-category-link:hover {
        background: var(--border-color);
    }
    
    .mobile-category-link i {
        margin-right: 0.75rem;
        width: 20px;
        text-align: center;
    }
    
    .mobile-category-name {
        flex: 1;
    }
    
    .mobile-category-count {
        background: var(--border-color);
        color: var(--text-color);
        padding: 0.25rem 0.5rem;
        border-radius: 12px;
        font-size: 0.75rem;
        font-weight: 600;
    }
    
    /* Drawer Footer Actions */
    .mobile-drawer-footer-actions {
        padding: 1.25rem 1rem;
        border-top: 1px solid var(--border-color);
        background: var(--bg-color);
        position: relative;
        z-index: 10;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        flex-shrink: 0;
    }
    
    .mobile-drawer-footer-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .mobile-drawer-footer-row:last-child {
        margin-bottom: 0;
    }
    
    .mobile-drawer-footer-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.875rem 1rem;
        border-radius: 8px;
        text-decoration: none;
        font-size: 0.875rem;
        font-weight: 600;
        transition: all 0.2s ease;
        border: none;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }
    
    .mobile-drawer-footer-btn i {
        font-size: 1rem;
        flex-shrink: 0;
    }
    
    .mobile-drawer-footer-btn-full {
        grid-column: 1 / -1;
    }
    
    .mobile-drawer-footer-btn img {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        flex-shrink: 0;
    }
    
    /* Button color variations */
    .mobile-drawer-footer-btn.btn-primary {
        background: white;
        color: var(--text-color);
        border: 2px solid var(--border-color);
    }
    
    .mobile-drawer-footer-btn.btn-primary:hover {
        background: var(--hover-bg);
        border-color: var(--accent-color-1);
        color: var(--accent-color-1);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-drawer-footer-btn.btn-secondary {
        background: white;
        color: var(--text-color);
        border: 2px solid var(--border-color);
    }
    
    .mobile-drawer-footer-btn.btn-secondary:hover {
        background: var(--hover-bg);
        border-color: var(--accent-color-1);
        color: var(--accent-color-1);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-drawer-footer-btn.btn-evidence {
        background: #dc3545;
        color: white;
        border: 2px solid #dc3545;
    }
    
    .mobile-drawer-footer-btn.btn-evidence:hover {
        background: #c82333;
        border-color: #bd2130;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    }
    
    .mobile-drawer-footer-btn.btn-profile {
        background: var(--hover-bg);
        color: var(--text-color);
        border: 1px solid var(--border-color);
    }
    
    .mobile-drawer-footer-btn.btn-profile:hover {
        background: var(--border-color);
        transform: translateY(-1px);
    }
    
    /* Notifications Dropdown */
    .mobile-header-v2-notifications-dropdown {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        height: 100dvh;
        background: var(--bg-color);
        z-index: 10000;
        transition: right 0.3s ease;
        display: flex;
        flex-direction: column;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-header-v2-notifications-dropdown.active {
        right: 0;
    }
    
    .mobile-header-v2-notifications-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .mobile-header-v2-notifications-header h3 {
        margin: 0;
        font-size: 1.125rem;
        font-weight: 600;
    }
    
    .mobile-header-v2-notifications-close {
        background: none;
        border: none;
        padding: 0.5rem;
        cursor: pointer;
        color: var(--text-color);
        font-size: 1.25rem;
    }
    
    .mobile-header-v2-notifications-content {
        flex: 1;
        overflow-y: auto;
        padding: 1rem;
    }
    
    .mobile-header-v2-notifications-footer {
        padding: 1rem;
        border-top: 1px solid var(--border-color);
    }
    
    .mobile-header-v2-notifications-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .mobile-header-v2-notifications-overlay.active {
        display: block;
        opacity: 1;
    }
}

/* Hide old mobile header COMPLETELY - everywhere */
.site-header--mobile {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Hide desktop header on mobile */
@media (max-width: 968px) {
    .site-header--desktop,
    .site-header.site-header--desktop,
    html body .site-header--desktop,
    body .site-header--desktop {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
}

/* Hide mobile header on desktop */
@media (min-width: 969px) {
    .mobile-header-v2 {
        display: none !important;
    }
}

