/* assets/css/responsive.css */
/* OPTIMIZED - NO CONFLICTS - MOBILE FOOTER FIXED */

/* =================================================================
   TABLET & SMALL LAPTOP (Max 1200px - 1024px)
   ================================================================= */
@media (max-width: 1200px) {
    .hero h1 { font-size: 3.5rem; }
    .quran-verse { font-size: 1.7rem; }
    
    /* Footer iframe for tablet */
    #footerFrame {
        min-height: 600px !important;
    }
}

@media (max-width: 1024px) {
    .features-grid,
    .stats-grid,
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero h1 { font-size: 3rem; }
    section { padding: 4rem 1.5rem !important; }
    
    .timeline::before { right: 20px; }
    .timeline-item { grid-template-columns: 1fr; padding-right: 3rem; }
    
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

/* =================================================================
   MOBILE LANDSCAPE / TABLET PORTRAIT (Max 768px)
   ================================================================= */
@media (max-width: 768px) {
    /* --- CRITICAL LAYOUT RESETS --- */
    .container {
        padding: 0 1.5rem !important;
        max-width: 100% !important;
    }

    section {
        padding: 3rem 1.2rem !important;
    }

    /* Force Grids to Single Column */
    .cards-grid, 
    .features-grid, 
    .stats-grid, 
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }

    /* --- HERO ADJUSTMENTS --- */
    .page-content { padding-top: 85px; }
    .hero { height: auto; min-height: 80vh; }
    .hero h1 { font-size: 2.2rem; margin-bottom: 1rem; }
    .hero-subtitle { font-size: 1.1rem; }
    .quran-verse { font-size: 1.3rem; padding: 1.5rem; margin: 1.5rem 0; }
    
    .hero-cta { flex-direction: column; gap: 0.8rem; margin-top: 1.5rem; }
    .btn { width: 100%; text-align: center; }

    /* --- CARD & GAME SIZING --- */
    .game-card { flex: 0 0 200px; height: 300px; }
    .assoc-container .game-card { flex: 0 0 260px; height: 350px; }

    /* --- TIMELINE FIXES --- */
    .timeline-item { padding-right: 2rem; }
    .timeline-content { padding: 1.5rem; }

    /* --- MAALI CARD FIX --- */
    .maali-card { padding: 1.5rem !important; }
    .maali-card > div { flex-direction: column; text-align: center; }
    .maali-card img { height: 100px !important; margin-bottom: 1rem; }

    /* --- POETRY & VIDEO SECTION --- */
    section .container > div > div[style*="grid"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .video-poetry-container {
        height: auto !important;
    }

    .video-poetry-container video {
        height: 250px !important;
    }

    #playOverlay .play-button {
        width: 60px !important;
        height: 60px !important;
    }

    #playOverlay .play-button div {
        border-top: 12px solid transparent !important;
        border-bottom: 12px solid transparent !important;
        border-left: 18px solid white !important;
    }

    section div[style*="background: linear-gradient"] {
        height: auto !important;
        padding: 1.5rem !important;
        min-height: 280px !important;
        border-right-width: 3px !important;
        background-size: cover !important;
    }

    section div[style*="text-align: center"] p {
        font-size: 1.3rem !important;
        line-height: 2 !important;
        padding: 0 0.5rem;
    }

    section div[style*="font-size: 4rem"] {
        font-size: 3rem !important;
        opacity: 0.15 !important;
    }

    .poetry-badge {
        font-size: 0.85rem !important;
        padding: 0.5rem 1.4rem !important;
        margin-bottom: 1.5rem !important;
    }

    section[style*="padding: 6rem"] {
        padding: 3rem 1rem !important;
    }

    /* --- FOOTER IFRAME FOR MOBILE --- */
    #footerFrame {
        min-height: 950px !important;
        height: auto !important;
        margin-top: 3rem !important;
    }
}

/* =================================================================
   MOBILE PHONES (Max 600px)
   ================================================================= */
@media (max-width: 600px) {
    section, 
    section[style] {
        padding: 3rem 1rem !important;
    }

    .container { padding: 0 1rem !important; }

    .hero h1 { font-size: 2rem; line-height: 1.3; }
    .hero-title-img { max-width: 280px; }
    .quran-verse { font-size: 1.1rem; padding: 1.2rem; }
    .section-title { font-size: 1.6rem; }
    
    .carousel-arrow { display: none; }
    .carousel-controls { bottom: 1rem; }
    
    .poetry-container { padding: 1.5rem 1rem !important; }
    .poetry-verse { font-size: 1.15rem !important; line-height: 1.75 !important;
        padding: 0.5rem !important; }
    .bait { flex-direction: column; text-align: center; gap: 0.2rem; margin-bottom: 1.5rem; }
    .bait span { display: none; }
    .verse-line { padding: 0.2rem; }
}

/* =================================================================
   SMALL PHONES (Max 480px)
   ================================================================= */
@media (max-width: 480px) {
    body { margin: 0 !important; }

    .search-container button {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.9rem;
        flex-shrink: 0;
        min-width: 32px;
    }

    /* Poetry verse smaller on small phones */
    .poetry-verse { font-size: 0.95rem !important; line-height: 1.6 !important; }
    .poetry-container { padding: 1rem 0.8rem !important; }
    
    /* Scroll containers */
    .assoc-container .game-card { width: 180px !important; height: 300px !important; }
    .assoc-container .game-card h3 { font-size: 0.95rem; }
    .assoc-container .game-card p { font-size: 0.85rem; }
    .logo { height: 35px; }
    .search-container { padding: 0.35rem 0.6rem; }
    .search-container input { width: 80px; font-size: 0.8rem; }

    .scroll-container {
        padding: 0.6rem !important;
        gap: 1rem;
    }
    
    .game-card { flex: 0 0 160px; height: 280px; }
    .assoc-container .game-card { flex: 0 0 220px; height: 300px; }
    
    /* Poetry verse smaller on small phones */
    .poetry-verse { font-size: 0.95rem !important; line-height: 1.6 !important; }
    .poetry-container { padding: 1rem 0.8rem !important; }

    .stat-number { font-size: 2.2rem; }
    .stat-label { font-size: 0.9rem; }
    
    .timeline::before { right: 12px; }
    .timeline-item { padding-right: 1.2rem; margin-bottom: 2rem; }
    .timeline-item::before { width: 14px; height: 14px; }
    .timeline-content { padding: 1rem; }
    
    footer { padding: 2rem 1rem 1rem; }
    .footer-section h4 { font-size: 1.1rem; margin-bottom: 0.8rem; }

    /* --- FOOTER IFRAME FOR SMALL MOBILE --- */
    #footerFrame {
        min-height: 1050px !important;
        margin-top: 2rem !important;
    }
}

/* =================================================================
   EXTRA SMALL PHONES (Max 360px)
   ================================================================= */
@media (max-width: 360px) {
    body { margin: 0; padding: 0; }

    /* --- FOOTER IFRAME FOR EXTRA SMALL MOBILE --- */
    #footerFrame {
        min-height: 1100px !important;
        margin-top: 1.5rem !important;
    }
}

/* =================================================================
   FOOTER IFRAME - BASE STYLES (DESKTOP)
   ================================================================= */
#footerFrame {
    width: 100% !important;
    border: none !important;
    display: block !important;
    margin-top: 2rem !important;
    padding: 0 !important;
    overflow: visible !important;
    min-height: 500px;
    height: auto !important;
    max-height: none !important;
}

/* Desktop sizing */
@media (min-width: 1201px) {
    #footerFrame {
        min-height: 480px !important;
    }
}

/* Ensure iframe content is always visible */
iframe[src*="footer.html"] {
    overflow: visible !important;
}

.page-content iframe,
section iframe,
body > iframe {
    overflow: visible !important;
    height: auto !important;
}
/* =================================================================
   TABLET & SMALL LAPTOP (Max 1200px - 1024px)
   ================================================================= */
@media (max-width: 1200px) {
    .nav-container { padding: 0.8rem 1.5rem; }
    .hero h1 { font-size: 3.5rem; }
    .quran-verse { font-size: 1.7rem; }
    
    /* Footer iframe for tablet */
    #footerFrame {
        min-height: 600px !important;
    }
}

@media (max-width: 1024px) {
    .features-grid,
    .stats-grid,
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero h1 { font-size: 3rem; }
    section { padding: 4rem 1.5rem !important; }
    
    .timeline::before { right: 20px; }
    .timeline-item { grid-template-columns: 1fr; padding-right: 3rem; }
    
    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

/* =================================================================
   MEDIUM TABLETS (Max 900px) - FIX FOR 853x1280
   ================================================================= */
@media (max-width: 900px) {
    .nav-container {
        padding: 0.6rem 1rem !important;
        gap: 0.5rem;
    }

    .logo {
        height: 42px;
    }

    .nav-menu li a {
        padding: 0.6rem 0.9rem;
        font-size: 0.88rem;
    }

    .search-container {
        padding: 0.4rem 0.9rem;
    }

    .search-container input {
        width: 160px;
        font-size: 0.88rem;
    }
}