/* ==========================================================================
   Responsive — mobile-first pass. Breakpoints exercised: 320/375/390/414
   (all inside the <576px tier), 768 (tablet), 1024/1440/1920 (desktop tiers
   already served by the default styles).
   ========================================================================== */

/* Guard against any accidental horizontal overflow app-wide */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}
img, video, svg {
    max-width: 100%;
    height: auto;
}

@media (max-width: 991.98px) {
    .content-header .list-header-title,
    .content-header h1,
    .e47-page-title {
        font-size: 1.25rem !important;
    }
}

@media (max-width: 767.98px) {
    .content-header,
    .content,
    section.content {
        padding-left: 0.85rem !important;
        padding-right: 0.85rem !important;
    }
    .content-header .row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.35rem !important;
    }
    .content-header .row > [class*="col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        justify-content: flex-start !important;
    }
    .content-header .row > [class*="col-"]:last-child {
        justify-content: flex-start !important;
    }
    .content-header .list-header-title,
    .content-header h1,
    .e47-page-title {
        font-size: 1.18rem !important;
    }
    .content-header .page-subtitle,
    .e47-page-subtitle {
        margin-left: 1.05rem;
        font-size: 0.78rem;
    }
    .card-header { padding: 0.85rem 1rem; }
    .card-body { padding: 1rem; }
    .navbar-user-toggle .navbar-user-name { display: none; }
    .stat-card { padding: 1.1rem 1.15rem; }
    .stat-card .stat-card-value { font-size: 1.5rem; }
    .auth-card { padding: 1.75rem 1.4rem; margin: 0 0.5rem; }

    /* Cards go full-width with tighter outer gutters */
    .content-wrapper .container-fluid { padding-left: 0 !important; padding-right: 0 !important; }
    .card { margin-bottom: 1rem; }
}

@media (max-width: 575.98px) {
    .table td, .table thead th { padding: 0.6rem 0.6rem; font-size: 0.8rem; }
    .breadcrumb { font-size: 0.72rem; }

    /* One column: stat-card / report-group / dashboard grids stack fully */
    .report-group .row > [class*="col-"],
    .stat-card-grid > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Inputs, selects and buttons go full width outside explicit button rows */
    .content-wrapper .form-control,
    .content-wrapper .custom-select,
    .content-wrapper .select2-container {
        width: 100% !important;
    }

    /* Sticky save bar — every form footer built with .form-actions already
       used across the app automatically becomes a sticky bottom bar on
       mobile, no per-page changes needed. No edge-bleed margin trick here
       (padding differs by parent context: card-body vs modal-body vs
       box-footer) — a plain sticky bar with its own background is robust
       regardless of which container it sits in. */
    .form-actions {
        position: sticky;
        bottom: 0;
        background: var(--t-card-bg);
        border-top: 1px solid var(--t-border);
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        z-index: 20;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    }
}

/* Sidebar overlay on small screens already handled by AdminLTE's sidebar-collapse;
   just style the backdrop it toggles. */
@media (max-width: 991.98px) {
    body.sidebar-open .content-wrapper::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1030;
    }
}

/* Floating action button — opt-in via .fab, useful on list pages where the
   primary "Add" action would otherwise scroll out of view on mobile */
.fab {
    display: none;
}
@media (max-width: 575.98px) {
    .fab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        right: 1.25rem;
        bottom: 1.25rem;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--t-primary), var(--t-info));
        color: #fff;
        font-size: 1.3rem;
        box-shadow: var(--t-shadow-lg);
        z-index: 25;
        text-decoration: none;
        transition: transform var(--t-transition-fast);
    }
    .fab:active { transform: scale(0.94); }
}
