/* ============================================================
   AKSHARA MEDIIT — Responsive Stylesheet
   Full mobile fix — all inline-style grids + class-based grids
   ============================================================ */

/* ─── GLOBAL SAFETY NET ─────────────────────────────────── */
html, body { overflow-x: hidden; max-width: 100%; }
*, *::before, *::after { box-sizing: border-box; }
img, video, embed, object { max-width: 100%; height: auto; }
iframe { max-width: 100%; }

/* Tables scroll horizontally */
.admin-table-wrap, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { min-width: 600px; }

/* Cards don't shrink weirdly */
.card { min-width: 0; }

/* Always-on helpers */
.topbar-left { overflow: hidden; }
.topbar-left span { white-space: nowrap; }
.breadcrumb { flex-wrap: wrap; gap: 4px; }
.whatsapp-float { z-index: 9000; }
.scroll-top { z-index: 9000; }
.header-inner { min-width: 0; }
.site-logo { min-width: 0; }
.gallery-item { min-width: 0; }


/* ─── TABLET ≤1024px ────────────────────────────────────── */
@media (max-width: 1024px) {

    /* Hide desktop nav, show hamburger */
    .main-nav, .header-call { display: none; }
    .hamburger { display: flex; }

    /* Mobile nav overlay */
    .mobile-overlay {
        position: fixed; inset: 0;
        background: rgba(0,0,0,.5); z-index: 998; display: none;
    }
    .mobile-overlay.open { display: block; }
    .mobile-nav { z-index: 999; }

    /* Hero */
    .hero-container { grid-template-columns: 1fr; gap: 40px; padding: 80px 24px; }
    .hero-visual { display: none; }
    .hero-section { min-height: auto; }

    /* Grids */
    .courses-grid { grid-template-columns: repeat(2, 1fr); }
    .blog-grid    { grid-template-columns: repeat(2, 1fr); }
    .why-grid     { grid-template-columns: 1fr; gap: 40px; }
    .stats-showcase { max-width: 480px; }
    .footer-grid  { grid-template-columns: 1fr 1fr; gap: 36px; }
    .cta-inner    { grid-template-columns: 1fr; gap: 40px; }
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }

    /* Admin */
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }

    /* Testimonials */
    .testimonial-card { flex: 0 0 calc(50% - 14px); }

    /* Newsletter */
    .newsletter-inner { flex-direction: column; text-align: center; }
    .newsletter-form { width: 100%; max-width: 480px; }
    .newsletter-form input { flex: 1; }

    /* ── Inline-style grids: exact attribute matches ── */
    /* 4-col → 2-col */
    [style*="grid-template-columns:repeat(4,1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* 3-col → 2-col */
    [style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}


/* ─── TABLET PORTRAIT ≤900px ────────────────────────────── */
@media (max-width: 900px) {

    /* Sidebar → unstick */
    [style*="position:sticky"] { position: relative !important; top: auto !important; }

    /* 2-col asymmetric layouts → single col */
    [style*="grid-template-columns:2fr 1fr;gap:48px"],
    [style*="grid-template-columns:1.2fr 1fr;gap:48px"],
    [style*="grid-template-columns:1fr 1.2fr;gap:60px"],
    [style*="grid-template-columns:1fr 1fr;gap:60px"],
    [style*="grid-template-columns:1fr 1fr;gap:48px"] {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
    }

    /* Named grids */
    .about-grid, .hostel-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
}


/* ─── MOBILE ≤768px ─────────────────────────────────────── */
@media (max-width: 768px) {

    :root { --header-height: 64px; }

    /* Sections */
    .section { padding: 60px 0; }
    .section-title { font-size: 1.8rem; }
    .page-hero { padding: 60px 0 40px; }
    .page-hero-title { font-size: 1.8rem; }

    /* Hero */
    .hero-stats { gap: 20px; }
    .hero-stat-value { font-size: 1.5rem; }
    .hero-cta { flex-direction: column; }
    .hero-cta .btn { width: 100%; justify-content: center; }

    /* Grids */
    .courses-grid { grid-template-columns: 1fr; }
    .blog-grid    { grid-template-columns: 1fr; }
    .why-features { grid-template-columns: 1fr; }
    .stats-showcase { grid-template-columns: 1fr 1fr; }
    .stat-card:nth-child(2), .stat-card:nth-child(3) { margin-top: 0; }
    .footer-grid  { grid-template-columns: 1fr 1fr !important; gap: 28px; }
    .footer-main  { padding: 40px 0; }
    .footer-bottom-inner { flex-direction: column; text-align: center; }
    .testimonial-card { flex: 0 0 100%; }
    .achievements-inner { gap: 28px; }
    .achievement-number { font-size: 2.5rem; }
    .form-row { grid-template-columns: 1fr; }

    /* Topbar strip down */
    .topbar-left span:not(:first-child) { display: none; }
    .topbar-right .topbar-social { display: none; }

    /* Admin */
    .admin-content { padding: 16px; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }

    /* Inner page named grids */
    .about-grid      { grid-template-columns: 1fr !important; gap: 32px !important; }
    .hostel-grid     { grid-template-columns: 1fr !important; gap: 32px !important; }
    .faculty-grid    { grid-template-columns: repeat(2, 1fr) !important; }
    .campus-grid     { grid-template-columns: repeat(2, 1fr) !important; }
    .toppers-grid    { grid-template-columns: repeat(2, 1fr) !important; }
    .scholarship-grid{ grid-template-columns: 1fr !important; }
    .stats-row       { grid-template-columns: repeat(2, 1fr) !important; }

    /* ── ALL inline-style grids collapsed ── */

    /* 4-col → 2-col */
    [style*="grid-template-columns:repeat(4,1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* 3-col → 2-col */
    [style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* 2-col variants → 1-col */
    [style*="grid-template-columns:2fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns:1.2fr 1fr"],
    [style*="grid-template-columns:1fr 1.2fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Hide inter-step arrows on admission page */
    [style*="position:absolute;top:50%;right:-10px"] { display: none !important; }

    /* Sidebar sticky off */
    [style*="position:sticky"] { position: relative !important; top: auto !important; }

    /* Blog meta */
    .blog-meta { flex-wrap: wrap; gap: 6px; }
    /* Slider */
    .slider-controls { margin-top: 24px; }
}


/* ─── MOBILE ≤640px ─────────────────────────────────────── */
@media (max-width: 640px) {

    /* 4-col → 1-col */
    [style*="grid-template-columns:repeat(4,1fr)"] {
        grid-template-columns: 1fr !important;
    }
    /* 3-col → 1-col */
    [style*="grid-template-columns:repeat(3,1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* Downloads / events */
    .downloads-row { flex-direction: column !important; align-items: flex-start !important; }
    .event-card    { flex-direction: column !important; }

    /* Course card footer */
    .course-card-foot { flex-direction: column !important; gap: 10px !important; }
    .course-card-foot > div { width: 100% !important; }
    .course-card-foot .btn { width: 100%; justify-content: center; }

    .cta-inner   { grid-template-columns: 1fr !important; }
    .page-hero   { padding: 48px 0 32px !important; }
    .stats-showcase { grid-template-columns: 1fr !important; }
}


/* ─── SMALL MOBILE ≤480px ───────────────────────────────── */
@media (max-width: 480px) {

    .container { padding: 0 16px; }
    .topbar    { display: none; }

    .hero-container { padding: 60px 16px; }
    .hero-badge     { font-size: .72rem; }
    .hero-stats     { flex-wrap: wrap; gap: 16px; }
    .hero-stat      { flex: 1 1 calc(50% - 8px); }

    .section-title    { font-size: 1.5rem; }
    .page-hero-title  { font-size: 1.5rem; }
    .achievement-number { font-size: 2rem; }

    .stats-showcase  { grid-template-columns: 1fr; }
    .dashboard-grid  { grid-template-columns: 1fr; }
    .footer-grid     { grid-template-columns: 1fr !important; }
    .faculty-grid    { grid-template-columns: 1fr !important; }
    .campus-grid     { grid-template-columns: 1fr !important; }
    .toppers-grid    { grid-template-columns: 1fr !important; }
    .stats-row       { grid-template-columns: 1fr 1fr !important; }

    .banner-inner { flex-wrap: wrap; justify-content: center; gap: 8px; }
    .banner-text  { text-align: center; font-size: .82rem; }

    .admin-sidebar { z-index: 9999; }

    /* Newsletter stacked */
    .newsletter-form { flex-direction: column; gap: 8px; }
    .newsletter-form input {
        width: 100%;
        border-radius: var(--radius-full) !important;
        border-right: 2px solid rgba(255,255,255,.2);
    }
    .newsletter-form .btn {
        border-radius: var(--radius-full) !important;
        width: 100%;
        justify-content: center;
    }

    /* Prevent iOS zoom on inputs */
    input, select, textarea, .form-control { font-size: 16px !important; }

    /* Any remaining inline 2-col */
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns:1.2fr 1fr"],
    [style*="grid-template-columns:1fr 1.2fr"],
    [style*="grid-template-columns:2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .whatsapp-tooltip { display: none; }
    .achievement-item { flex: 1 1 calc(50% - 10px); }
}


/* ─── EXTRA-SMALL ≤360px ────────────────────────────────── */
@media (max-width: 360px) {

    .container { padding: 0 12px; }
    .hero-container { padding: 48px 12px; }
    .site-logo .logo-sub { display: none; }
    .section-title { font-size: 1.35rem; }
    .page-hero-title { font-size: 1.3rem; }
    .btn    { padding: 12px 20px; font-size: .88rem; }
    .btn-lg { padding: 14px 24px; font-size: .95rem; }
    .stat-number { font-size: 2rem; }
    .stats-row { grid-template-columns: 1fr !important; }
}


/* ─── PRINT ─────────────────────────────────────────────── */
@media print {
    .site-header, .site-footer, .whatsapp-float,
    .scroll-top, .admission-banner, .mobile-nav, .nav-overlay { display: none; }
    body { font-size: 12pt; }
}
