/**
 * Sahil Schools Design System — Responsive Breakpoints
 * Tested for: 1920px, 1440px, 1024px, 768px, 480px, 375px
 */

/* Desktops & Large Displays (1440px+) */
@media (min-width: 1440px) {
    .container, .container-lg, .container-md, .container-sm, .container-xl {
        max-width: 1360px;
    }
}

/* Laptops & Standard Desktops (1200px - 1439px) */
@media (max-width: 1399.98px) {
    :root {
        --sahil-sidebar-width: 260px;
    }
}

/* Tablets Landscape & Small Laptops (992px - 1199px) */
@media (max-width: 1199.98px) {
    .dashboard-welcome-banner {
        padding: 1.75rem 2rem;
    }
}

/* Tablets Portrait (768px - 991px) */
@media (max-width: 991.98px) {
    :root {
        --sahil-sidebar-width: 280px;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1050;
        box-shadow: var(--sahil-shadow-xl);
    }

    .sidebar.show {
        left: 0;
    }

    .topbar {
        padding: 0 1rem;
    }

    .admin-main-content {
        padding: 1.25rem 1rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Devices (max-width: 767.98px) */
@media (max-width: 767.98px) {
    /* Global Mobile Guards */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative;
    }
    .container, .container-fluid {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    /* Public Header on Mobile */
    .site-header {
        padding: 6px 0 !important;
    }
    .site-logo {
        gap: 8px !important;
    }
    .site-logo-icon img {
        height: 38px !important;
        max-height: 40px !important;
    }
    .site-logo-text .brand-name {
        font-size: 18px !important;
        letter-spacing: -0.2px;
    }
    .site-logo-text .brand-sub {
        font-size: 9px !important;
        display: none !important; /* Hide sub tagline on mobile to keep header clean and compact */
    }
    .btn-mobile-toggler {
        width: 38px !important;
        height: 38px !important;
        font-size: 1.1rem !important;
    }

    /* Page Titles & Headers */
    .display-4, .display-5 {
        font-size: clamp(1.75rem, 6vw, 2.25rem) !important;
        line-height: 1.2 !important;
    }
    .lead {
        font-size: 0.95rem !important;
        line-height: 1.55 !important;
    }

    /* Public Pre-Footer Ribbon */
    .pre-footer-cta-ribbon {
        text-align: center;
        padding: 1rem 0 !important;
    }
    .pre-footer-cta-ribbon .container {
        flex-direction: column !important;
        justify-content: center !important;
        gap: 12px !important;
    }
    .pre-footer-cta-ribbon .d-flex {
        justify-content: center !important;
        width: 100% !important;
    }

    /* Public Footer on Mobile */
    .site-footer {
        padding-top: 32px !important;
        overflow-x: hidden !important;
    }
    .footer-brand {
        margin-bottom: 1.5rem !important;
        text-align: center !important;
    }
    .footer-brand .d-flex {
        justify-content: center !important;
    }
    .footer-social {
        justify-content: center !important;
    }
    .footer-trust-strip {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
        margin-bottom: 1.5rem !important;
        padding-bottom: 1.25rem !important;
    }
    .footer-trust-col {
        width: 100% !important;
        min-width: 0 !important;
    }
    .footer-trust-card {
        padding: 10px 12px !important;
        gap: 10px !important;
        border-radius: 14px !important;
        width: 100% !important;
    }
    .footer-trust-card .icon-chip {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
    }
    .footer-trust-card strong {
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
    }
    .footer-trust-card span {
        font-size: 0.69rem !important;
        line-height: 1.25 !important;
    }
    .footer-bottom {
        text-align: center !important;
    }
    .footer-bottom .container {
        justify-content: center !important;
        text-align: center !important;
        gap: 10px !important;
    }
    .footer-bottom .d-flex {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }

    /* Admin / Portal Responsive */
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1.15rem;
    }

    .stat-val {
        font-size: 1.55rem;
    }

    .dashboard-welcome-banner {
        padding: 1.5rem;
    }

    .card-header, .card-body, .card-footer {
        padding: 1rem 1.15rem;
    }

    /* Prevent horizontal table overflow */
    .table-responsive {
        border-radius: var(--sahil-radius-md);
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* Small Mobile Devices (max-width: 480px) */
@media (max-width: 480px) {
    body {
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.55rem 1rem;
        font-size: 0.85rem;
    }

    .auth-card {
        padding: 1.75rem 1.25rem;
    }

    /* Strict guard against horizontal cards overflowing */
    .col-6 {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }
    .card {
        border-radius: 12px !important;
    }

    /* Trust Strip on Compact Mobile */
    .footer-trust-strip {
        gap: 8px !important;
    }
    .footer-trust-card {
        padding: 9px 9px !important;
        gap: 8px !important;
    }
    .footer-trust-card .icon-chip {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        font-size: 0.9rem !important;
    }
    .footer-trust-card strong {
        font-size: 0.75rem !important;
    }
    .footer-trust-card span {
        font-size: 0.65rem !important;
    }
}

/* Extra Small Phones (max-width: 375px): Keep Modern 2x2 Glass Grid */
@media (max-width: 375.98px) {
    .footer-trust-strip {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 7px !important;
    }
    .footer-trust-card {
        padding: 8px 8px !important;
        gap: 7px !important;
        border-radius: 12px !important;
    }
    .footer-trust-card .icon-chip {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        font-size: 0.85rem !important;
    }
    .footer-trust-card strong {
        font-size: 0.74rem !important;
    }
    .footer-trust-card span {
        font-size: 0.63rem !important;
    }
}
