/**
 * MASTER RESPONSIVE CSS - MAXIMUM PRIORITY
 * This WILL work - using maximum specificity + !important
 */

/* ============================================
   SEARCH BUTTON: ICON ON MOBILE, TEXT ON DESKTOP
   ============================================ */
@media (max-width: 767px) {
    .hero-search-btn-text {
        display: none !important;
        visibility: hidden !important;
    }
    
    .hero-search-btn-icon {
        display: block !important;
        visibility: visible !important;
    }
}

@media (min-width: 768px) {
    .hero-search-btn-icon {
        display: none !important;
        visibility: hidden !important;
    }
    
    .hero-search-btn-text {
        display: inline !important;
        visibility: visible !important;
    }
}

/* ============================================
   CRITICAL: PREVENT HORIZONTAL SCROLL
   ============================================ */
html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    height: 100%;
}

body {
    overflow-x: hidden !important;
    overflow-y: scroll !important;
    max-width: 100vw !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    -webkit-overflow-scrolling: touch !important;
}

body.mobile-menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

* {
    box-sizing: border-box !important;
}

/* ============================================
   HEADER - FORCE RESPONSIVE
   ============================================ */

/* ALL SCREENS: Header fixed at top so menu and submenu stay visible when scrolling */
.site-header,
header.site-header,
#site-header {
    width: 100% !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10000 !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
}

body.admin-bar .site-header,
body.admin-bar header.site-header,
body.admin-bar #site-header {
    top: 32px !important;
}

@media screen and (max-width: 782px) {
    body.admin-bar .site-header,
    body.admin-bar header.site-header,
    body.admin-bar #site-header {
        top: 46px !important;
    }
}

/* Dark text on white header */
.site-header .logo-link,
.site-header .logo-text {
    color: #111827 !important;
}

.site-header .nav-link {
    color: #374151 !important;
}

.site-header .mobile-menu-toggle {
    color: #374151 !important;
}

.nav-link:hover {
    color: #111827 !important;
}

.header-container {
    width: 100% !important;
    max-width: 1280px !important;
    margin: 0 auto !important;
    padding-left: 5% !important;
    padding-right: 5% !important;
}

.header-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
}

/* MOBILE HEADER (< 768px) */
@media (max-width: 767px) {
    .site-header,
    header.site-header {
        height: auto !important;
    }
    
    .header-wrapper {
        height: 60px !important;
        padding: 0 !important;
    }
    
    .header-logo {
        flex: 0 0 auto !important;
    }
    
    .logo-text,
    .custom-logo {
        max-height: 32px !important;
        font-size: 18px !important;
    }
    
    /* HIDE desktop nav on mobile */
    .header-nav,
    nav.header-nav {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* SHOW hamburger on mobile */
    .mobile-menu-toggle,
    button.mobile-menu-toggle {
        display: flex !important;
        visibility: visible !important;
    }
    
    /* MOBILE MENU OVERLAY - FORCE VISIBLE */
    .mobile-menu-overlay {
        background-color: #ffffff !important;
        top: 60px !important;
    }
    
    /* Mobile menu now uses inline styles in header.php */
}

/* TABLET HEADER (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .header-wrapper {
        height: 70px !important;
    }
    
    .logo-text,
    .custom-logo {
        max-height: 36px !important;
        font-size: 20px !important;
    }
    
    /* HIDE desktop nav on tablet */
    .header-nav,
    nav.header-nav {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* SHOW hamburger on tablet */
    .mobile-menu-toggle,
    button.mobile-menu-toggle {
        display: flex !important;
        visibility: visible !important;
    }
    
    /* MOBILE MENU OVERLAY - FORCE VISIBLE */
    .mobile-menu-overlay {
        background-color: #ffffff !important;
        top: 70px !important;
    }
    
    /* Mobile menu now uses inline styles in header.php */
}

/* DESKTOP HEADER (1024px+) */
@media (min-width: 1024px) {
    .header-wrapper {
        height: 80px !important;
    }
    
    .logo-text,
    .custom-logo {
        max-height: 40px !important;
        font-size: 22px !important;
    }
    
    /* SHOW desktop nav with scroll functionality; overflow visible so Resources dropdown can show */
    .header-nav,
    nav.header-nav {
        display: flex !important;
        visibility: visible !important;
        flex: 1 !important;
        max-width: 100% !important;
        overflow: visible !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
    }
    
    .nav-menu-wrapper {
        flex: 1 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scrollbar-width: none !important;
        transition: margin-right 0.3s ease !important;
    }
    
    .nav-menu-wrapper::-webkit-scrollbar {
        display: none !important;
    }
    
    .nav-menu-wrapper.has-scroll {
        margin-left: 40px !important;
        margin-right: 40px !important;
    }
    
    .nav-menu-wrapper.has-scroll-left-only {
        margin-left: 40px !important;
        margin-right: 0 !important;
    }
    
    .nav-menu-wrapper.has-scroll-right-only {
        margin-left: 0 !important;
        margin-right: 40px !important;
    }
    
    .nav-menu {
        display: flex !important;
        justify-content: flex-start !important;
        gap: 18px !important;
    }
    
    .nav-scroll-left {
        position: absolute !important;
        left: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        display: none !important;
    }
    
    .nav-scroll-left.visible {
        display: flex !important;
    }
    
    .nav-scroll-right {
        position: absolute !important;
        right: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        display: none !important;
    }
    
    .nav-scroll-right.visible {
        display: flex !important;
    }
    
    /* HIDE hamburger on desktop */
    .mobile-menu-toggle,
    button.mobile-menu-toggle {
        display: none !important;
        visibility: hidden !important;
    }
}

@media (min-width: 1200px) {
    .nav-menu {
        gap: 22px !important;
    }
}

@media (min-width: 1280px) {
    .header-container {
        max-width: 1280px !important;
    }
    
    .nav-menu {
        gap: 28px !important;
    }
}

/* ============================================
   CONTAINER - FORCE RESPONSIVE
   ============================================ */

/* CONTAINER - Match header width exactly */
.container,
div.container {
    width: 100% !important;
    max-width: 1280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 5% !important;
    padding-right: 5% !important;
}

/* ============================================
   GRID - FORCE RESPONSIVE (CRITICAL!)
   ============================================ */

/* MOBILE: 1 column (BASE) - align-items: start so card text is not clipped */
.resource-grid,
div.resource-grid,
.resources-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    width: 100% !important;
    align-items: start !important;
}

/* SMALL TABLET: 2 columns */
@media (min-width: 640px) {
    .resource-grid,
    div.resource-grid,
    .resources-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 24px !important;
    }
}

/* TABLET: 2 columns */
@media (min-width: 768px) {
    .resource-grid,
    div.resource-grid,
    .resources-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 28px !important;
    }
}

/* DESKTOP: 3 columns */
@media (min-width: 1024px) {
    .resource-grid,
    div.resource-grid,
    .resources-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 32px !important;
    }
}

/* LARGE DESKTOP: 4 columns */
@media (min-width: 1280px) {
    .resource-grid,
    div.resource-grid,
    .resources-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 32px !important;
    }
}

/* ============================================
   HERO SECTION - FORCE RESPONSIVE
   ============================================ */

/* MOBILE */
@media (max-width: 767px) {
    .hero,
    section.hero {
        padding: 48px 0 40px !important;
    }
    
    .hero-title,
    .hero h1 {
        font-size: clamp(28px, 6vw, 36px) !important;
        line-height: 1.2 !important;
        margin-bottom: 20px !important;
        text-align: center !important;
    }
    
    /* Hero search - now handled by responsive.css */
    
    .trending-section {
        flex-direction: column !important;
        align-items: center !important;
        gap: 16px !important;
    }
    
    .category-chips {
        justify-content: center !important;
        gap: 8px !important;
    }
    
    .chip {
        font-size: 13px !important;
        padding: 8px 16px !important;
    }
}

/* TABLET */
@media (min-width: 768px) and (max-width: 1023px) {
    .hero,
    section.hero {
        padding: 64px 0 56px !important;
    }
    
    .hero-title,
    .hero h1 {
        font-size: clamp(36px, 5vw, 42px) !important;
        margin-bottom: 24px !important;
    }
    
    /* Hero search - now handled by responsive.css */
    
    .trending-section {
        flex-direction: row !important;
        gap: 20px !important;
    }
}

/* DESKTOP */
@media (min-width: 1024px) {
    .hero,
    section.hero {
        padding: 80px 0 72px !important;
    }
    
    .hero-title,
    .hero h1 {
        font-size: clamp(42px, 4vw, 48px) !important;
    }
}

/* ============================================
   SECTIONS - FORCE RESPONSIVE SPACING
   ============================================ */

/* MOBILE */
@media (max-width: 767px) {
    .exclusive-section,
    .latest-section,
    .popular-section,
    .newsletter-section,
    section {
        padding: 48px 0 !important;
    }
    
    .section-header {
        margin-bottom: 32px !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(24px, 5vw, 28px) !important;
    }
}

/* TABLET */
@media (min-width: 768px) and (max-width: 1023px) {
    .exclusive-section,
    .latest-section,
    .popular-section,
    .newsletter-section,
    section {
        padding: 64px 0 !important;
    }
    
    .section-header {
        margin-bottom: 40px !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(28px, 4vw, 32px) !important;
    }
}

/* DESKTOP */
@media (min-width: 1024px) {
    .exclusive-section,
    .latest-section,
    .popular-section,
    .newsletter-section,
    section {
        padding: 80px 0 !important;
    }
    
    .section-header {
        margin-bottom: 48px !important;
    }
    
    .section-title,
    h2.section-title {
        font-size: clamp(32px, 3vw, 36px) !important;
    }
}

/* ============================================
   CARDS - FORCE RESPONSIVE
   ============================================ */

.resource-card,
.resource-card-inner {
    width: 100% !important;
    max-width: 100% !important;
}

/* MOBILE */
@media (max-width: 767px) {
    .resource-card-content {
        padding: 16px !important;
    }
    
    .resource-card-title,
    .resource-card h3 {
        font-size: 15px !important;
    }
    
    .resource-card-attribution,
    .resource-card-meta {
        font-size: 13px !important;
    }
}

/* TABLET */
@media (min-width: 768px) and (max-width: 1023px) {
    .resource-card-content {
        padding: 18px !important;
    }
    
    .resource-card-title,
    .resource-card h3 {
        font-size: 16px !important;
    }
}

/* DESKTOP */
@media (min-width: 1024px) {
    .resource-card-content {
        padding: 20px !important;
    }
}

/* ============================================
   SINGLE PAGE - FORCE RESPONSIVE
   ============================================ */

/* MOBILE */
@media (max-width: 767px) {
    .single-resource-page {
        padding: 32px 0 !important;
    }
    
    .resource-single-title {
        font-size: clamp(28px, 6vw, 36px) !important;
        margin-bottom: 32px !important;
    }
    
    .resource-single-content {
        padding: 24px !important;
        margin-bottom: 32px !important;
    }
    
    .file-info-row {
        flex-direction: column !important;
        gap: 8px !important;
        padding: 14px 0 !important;
    }
    
    .download-button {
        width: 100% !important;
        padding: 16px !important;
    }
}

/* TABLET */
@media (min-width: 768px) and (max-width: 1023px) {
    .single-resource-page {
        padding: 48px 0 !important;
    }
    
    .resource-single-content {
        padding: 32px !important;
        margin-bottom: 40px !important;
    }
    
    .file-info-row {
        flex-direction: row !important;
    }
    
    .download-button {
        width: auto !important;
        min-width: 280px !important;
    }
}

/* DESKTOP */
@media (min-width: 1024px) {
    .single-resource-page {
        padding: 72px 0 !important;
    }
    
    .resource-single-content {
        padding: 48px !important;
    }
}

/* ============================================
   ARCHIVE PAGE - FORCE RESPONSIVE
   ============================================ */

/* MOBILE */
@media (max-width: 767px) {
    .archive-hero {
        padding: 32px 0 !important;
    }
    
    .archive-title {
        font-size: clamp(28px, 6vw, 36px) !important;
        margin-bottom: 16px !important;
    }
    
    .archive-search-input {
        height: 48px !important;
        font-size: 15px !important;
        padding: 12px 48px 12px 44px !important;
    }
}

/* TABLET */
@media (min-width: 768px) and (max-width: 1023px) {
    .archive-hero {
        padding: 48px 0 !important;
    }
    
    .archive-search-input {
        height: 52px !important;
        font-size: 16px !important;
    }
}

/* DESKTOP */
@media (min-width: 1024px) {
    .archive-hero {
        padding: 64px 0 !important;
    }
}

/* ============================================
   NEWSLETTER - FORCE RESPONSIVE
   ============================================ */

/* MOBILE */
@media (max-width: 767px) {
    .newsletter-card {
        padding: 32px 20px !important;
        grid-template-columns: 1fr !important;
    }
    
    .newsletter-input-group {
        flex-direction: column !important;
        gap: 12px !important;
        padding: 12px !important;
    }
    
    .newsletter-btn {
        width: 100% !important;
        justify-content: center !important;
    }
    
    .newsletter-image {
        display: none !important;
    }
}

/* TABLET */
@media (min-width: 768px) and (max-width: 1023px) {
    .newsletter-card {
        padding: 40px 32px !important;
        grid-template-columns: 1fr !important;
    }
    
    .newsletter-input-group {
        flex-direction: row !important;
        padding: 6px !important;
    }
    
    .newsletter-btn {
        width: auto !important;
    }
}

/* DESKTOP */
@media (min-width: 1024px) {
    .newsletter-card {
        padding: 48px !important;
        grid-template-columns: 1fr auto !important;
    }
    
    .newsletter-image {
        display: flex !important;
    }
}

/* ============================================
   FOOTER - FORCE RESPONSIVE
   ============================================ */

/* MOBILE */
@media (max-width: 767px) {
    .site-footer {
        padding: 48px 0 32px !important;
    }
    
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }
    
    .footer-bottom {
        flex-direction: column !important;
        text-align: center !important;
        gap: 16px !important;
    }
}

/* TABLET */
@media (min-width: 768px) and (max-width: 1023px) {
    .site-footer {
        padding: 64px 0 40px !important;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 40px !important;
    }
    
    .footer-bottom {
        flex-direction: row !important;
    }
}

/* DESKTOP */
@media (min-width: 1024px) {
    .site-footer {
        padding: 80px 0 48px !important;
    }
    
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr 1fr !important;
    }
}

/* ============================================
   IMAGES - FORCE RESPONSIVE
   ============================================ */
img {
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
}

/* ============================================
   BUTTONS - TOUCH FRIENDLY
   ============================================ */

@media (max-width: 767px) {
    a, button, .btn,
    input[type="submit"] {
        min-height: 44px !important;
        touch-action: manipulation !important;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="search"],
    textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
        min-height: 44px !important;
    }
}

/* ============================================
   RESPONSIVE DEBUG (ENABLE FOR TESTING)
   ============================================ */

/*
body::before {
    content: 'Mobile < 768px';
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: #ef4444;
    color: white;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: bold;
    z-index: 99999;
    border-radius: 4px;
    font-family: monospace;
}

@media (min-width: 768px) {
    body::before {
        content: 'Tablet 768px+';
        background: #f59e0b;
    }
}

@media (min-width: 1024px) {
    body::before {
        content: 'Desktop 1024px+';
        background: #10b981;
    }
}

@media (min-width: 1280px) {
    body::before {
        content: 'Large 1280px+';
        background: #3b82f6;
    }
}
*/
