/* ==========================================================================
   Mobile responsive overrides for the CMU Portal.
   Loaded after every page's inline <style> so these win the cascade.
   ========================================================================== */

/* Universal safety: kill horizontal scroll caused by overflowing tables/forms. */
html, body { max-width: 100%; overflow-x: hidden; }

/* Hamburger button (hidden on desktop, shown on mobile) */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 6px;
    background: #6a0032;
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.mobile-nav-toggle svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 2; }

/* Backdrop shown when sidebar is open */
.mobile-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}

@media (max-width: 768px) {
    .mobile-nav-toggle { display: flex; }

    /* Slide-in sidebar */
    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        width: 240px !important;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1080;
        overflow-y: auto;
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .mobile-nav-backdrop { display: block; }

    /* Push the page content to start at the top of the screen */
    .app { display: block !important; }
    .main { width: 100% !important; }

    /* Header padding so it doesn't hide behind the hamburger */
    .top-header { padding-left: 64px !important; }

    /* Generic content padding tighter on mobile */
    .content,
    .top-header,
    .footer-bar,
    .info-banner { padding-left: 14px !important; padding-right: 14px !important; }
    .info-banner { margin-left: 14px !important; margin-right: 14px !important; }

    /* Tables: allow horizontal scroll instead of breaking the layout */
    table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Cards / forms: full width and tighter padding */
    .pay-card,
    .pm-card,
    .receipt,
    .card,
    .panel { padding: 14px !important; }

    /* Footer bar: stack items, make total/buttons wrap nicely */
    .footer-bar {
        flex-wrap: wrap;
        gap: 10px !important;
        padding: 12px 14px !important;
        position: sticky;
        bottom: 0;
    }
    .footer-bar .pay-summary { flex: 1 1 100%; }
    .footer-bar .pay-total { margin-left: 0 !important; flex: 1 1 auto; }
    .footer-bar .btn { padding: 9px 18px !important; font-size: 12px !important; }

    /* Two-column form rows collapse to one column */
    .form-row.cols { grid-template-columns: 1fr !important; }

    /* Stepper text smaller */
    .stepper__label { font-size: 11px !important; text-align: center; padding: 0 12px; }

    /* Section headings */
    .section-heading { padding: 0 12px; }

    /* Card brand row wraps */
    .card-brands { flex-wrap: wrap; }
    .card-brands img { height: 20px !important; }

    /* Login page (index.html) — center and pad */
    .login-page,
    .login-card { width: 100% !important; max-width: 420px !important; margin: 16px auto !important; padding: 18px !important; }

    /* Receipt page tighter */
    .receipt { width: 100% !important; max-width: 100% !important; }

    /* Generic: any element forced to a fixed >100vw width gets capped */
    [style*="width: 1024"],
    [style*="width:1024"] { width: 100% !important; max-width: 100% !important; }
}

@media (max-width: 480px) {
    .top-header h1 { font-size: 18px !important; }
    .pm-card { padding: 12px !important; }
    .footer-bar .btn { font-size: 11px !important; padding: 8px 14px !important; }
}
