/* ============================================
   ELMAH Section – Responsive / Mobile Styles
   Breakpoints:
     768px    : tablets & small laptops
     640.98px : phones (matches MainLayout)
     480px    : small phones
   ============================================ */

/* ── Page Headers (40px titles on DataGrid pages) ── */
@media (max-width: 768px) {
    .overview-header h2 {
        font-size: 24px !important;
    }
    .overview-header .activity-tab-icon {
        font-size: 24px !important;
    }
}

/* ── ELMAH page header rows ── */
@media (max-width: 640.98px) {
    .elmah-page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem;
    }
    .elmah-page-header .col-auto {
        width: 100%;
    }
    .elmah-page-header .col-auto .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }
    .elmah-page-header .col-auto .btn-group {
        flex: 1 1 auto;
    }
}

/* ── Filter sections ── */
@media (max-width: 768px) {
    .elmah-filters .col-md-1,
    .elmah-filters .col-md-2,
    .elmah-filters .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}
@media (max-width: 480px) {
    .elmah-filters .col-md-1,
    .elmah-filters .col-md-2,
    .elmah-filters .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ── Tables – hide columns on mobile ── */
@media (max-width: 640.98px) {
    .elmah-hide-mobile {
        display: none !important;
    }
    .table .text-truncate {
        max-width: 160px !important;
    }
    .table td, .table th {
        font-size: 0.8rem;
        padding: 0.35rem 0.4rem;
    }
}

/* ── Pagination ── */
@media (max-width: 640.98px) {
    .elmah-pagination {
        flex-direction: column !important;
        gap: 0.5rem;
        text-align: center;
    }
    .elmah-pagination .btn-group {
        width: 100%;
    }
    .elmah-pagination .btn-group .btn {
        flex: 1;
    }
}

/* ── Detail page header (title + triage actions) ── */
@media (max-width: 768px) {
    .elmah-detail-header {
        flex-direction: column !important;
        gap: 1rem;
    }
    .elmah-detail-header > div:last-child {
        align-items: flex-start !important;
        min-width: unset !important;
        width: 100%;
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }
    .elmah-detail-header h4 {
        font-size: 1.05rem;
        line-height: 1.5;
    }
    .elmah-detail-header h4 .badge {
        font-size: 0.7em;
    }
    .elmah-detail-header .d-flex.gap-3 {
        flex-wrap: wrap;
        gap: 0.4rem !important;
    }
}

/* ── Metadata cards (col-md-2 / col-md-3 rows) ── */
@media (max-width: 768px) {
    .elmah-meta-cards .col-md-2 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .elmah-meta-cards .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}
@media (max-width: 480px) {
    .elmah-meta-cards .col-md-2,
    .elmah-meta-cards .col-md-3,
    .elmah-meta-cards .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ── Exchange history accordion ── */
@media (max-width: 640.98px) {
    .accordion-button .text-truncate {
        max-width: 120px !important;
    }
    .accordion-button small.ms-auto {
        display: none;
    }
    .accordion-body pre {
        font-size: 0.7em !important;
    }
}

/* ── Running/status alert flex stacking ── */
@media (max-width: 640.98px) {
    .elmah-alert-flex {
        flex-direction: column !important;
        gap: 0.75rem;
        text-align: center;
    }
}

/* ── Triage note input full-width on mobile ── */
@media (max-width: 768px) {
    .elmah-detail-header input[style*="max-width:200px"] {
        max-width: 100% !important;
    }
    .elmah-detail-header .d-flex.gap-1 {
        width: 100%;
    }
    .elmah-detail-header .d-flex.gap-1 input {
        flex: 1;
    }
}

/* ── DataGrid component (Apps, Config, Tokens pages) ── */
@media (max-width: 640.98px) {
    .PGMS-DataGridAsyncComponent .card-header .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .PGMS-DataGridAsyncComponent .pgms_search_datagrid {
        margin: 0 4px;
        font-size: 0.85rem;
    }
    .PGMS-DataGridAsyncComponent .table td,
    .PGMS-DataGridAsyncComponent .table th {
        font-size: 0.8rem;
        padding: 0.35rem 0.4rem;
    }
    .PGMS-DataGridAsyncComponent .QuickActionsCol {
        width: 60px;
    }
    .overview-header h2 {
        font-size: 20px !important;
    }
    .overview-header .activity-tab-icon {
        font-size: 20px !important;
    }
}

/* ── Modal forms (Blazorise modals) ── */
@media (max-width: 640.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    .modal-body {
        padding: 0.75rem;
    }
    .modal-body .form-control,
    .modal-body .form-select {
        font-size: 0.9rem;
    }
}

/* ── Stack trace and pre blocks on small screens ── */
@media (max-width: 640.98px) {
    pre {
        font-size: 0.75em !important;
        padding: 0.5rem !important;
    }
    .card-body pre {
        max-height: 300px !important;
    }
}

/* ── Follow-up textarea on mobile ── */
@media (max-width: 640.98px) {
    .input-group textarea.form-control {
        font-size: 0.85rem;
    }
}

/* ── Nav tabs on mobile (detail pages) ── */
@media (max-width: 640.98px) {
    .nav-tabs .nav-link {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }
}

/* ── StartHealing modal specifics ── */
@media (max-width: 640.98px) {
    /* PR link overflow */
    .card-body a[href] {
        word-break: break-all;
    }
    /* Progress step badges: stack vertically on tiny screens */
    .d-flex.align-items-start .badge[style*="min-width:70px"] {
        min-width: 50px !important;
        font-size: 0.65em !important;
    }
    /* Ensure container-fluid in modals has minimal padding */
    .modal-body .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }
}

/* ── Sidebar collapse on mobile ── */
@media (max-width: 640.98px) {
    .sidebar {
        z-index: 1050;
    }
}

