/* ══════════════════════════════════════════════════════════════
   bgt-MediTrend — Mobile Responsive Patch
   Loaded last so it can override everything else.
   ══════════════════════════════════════════════════════════════ */

/* ─── Global tap targets ─────────────────────────────────────── */
@media (max-width: 768px) {
    /* Larger tap targets for buttons and links */
    .btn,
    .btn-sm,
    a.btn,
    button,
    input[type="submit"] {
        min-height: 44px;
        padding: 10px 16px;
        font-size: 0.95rem;
    }

    .btn-sm {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Prevent iOS from zooming on input focus */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Container padding tighter on mobile */
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Section spacing tighter */
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .my-4 {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
    }

    /* Table horizontal scroll wrapper */
    .table-responsive {
        border-radius: 12px;
        -webkit-overflow-scrolling: touch;
    }

    /* Make tables readable by shrinking font */
    .table-responsive table {
        font-size: 0.8rem;
    }

    .table-responsive th,
    .table-responsive td {
        padding: 8px 10px;
        white-space: nowrap;
    }

    /* Modal fixes */
    .modal-dialog {
        margin: 8px;
        max-width: calc(100% - 16px);
    }

    /* Sticky elements should not block content */
    .sticky-top {
        position: relative !important;
        top: auto !important;
    }

    /* Cards rounded edges tighter */
    .card {
        border-radius: 12px;
    }

    /* Chart height on mobile — smaller */
    [id^="field_chart_"] {
        height: 200px !important;
    }

    #dailyChart,
    #hourChart {
        height: 240px !important;
    }

    /* Hide decorative elements that don't help on mobile */
    .hero-visual-stat {
        flex-direction: column;
        gap: 4px;
    }

    /* Fix chartly legend overflow */
    .js-plotly-plot .plotly .legend {
        font-size: 10px !important;
    }
}

/* ─── Extra small phones (< 400px) ───────────────────────────── */
@media (max-width: 400px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    h1, .display-5 { font-size: 1.75rem !important; }
    h2 { font-size: 1.35rem !important; }
    h3 { font-size: 1.15rem !important; }

    .kpi-card .kpi-value {
        font-size: 1.25rem !important;
    }

    .btn {
        font-size: 0.9rem;
        padding: 9px 14px;
    }
}