/* ============================================================
   mobile.css — Responsive overrides for Virtual Speech App
   Covers: auth pages, interior layout, exercise UI, DataTables
   ============================================================ */

/* ---- 1. AUTH PAGES (login, signup) ---- */

@media (max-width: 991.98px) {
    /* Logo: smaller on mobile */
    .auth-brand img {
        height: 70px !important;
    }

    /* Heading: tighter */
    .auth-brand h4 {
        font-size: 1.15rem;
        margin-top: 0.75rem;
    }

    /* Auth container: remove centering padding, allow scroll */
    .auth-box {
        min-height: 100vh;
        padding: 1rem 0.5rem;
        align-items: flex-start !important;
    }

    /* Card body: tighter padding */
    .auth-box .card-body {
        padding: 1.25rem;
    }

    /* Form col: full width when side image is hidden */
    .auth-box .card .row.g-0 > .col-lg-6:first-child {
        width: 100%;
    }

    /* Remove the side-image col entirely (already d-none d-lg-block but ensure no ghost space) */
    .auth-box .col-lg-6.d-none.d-lg-block {
        display: none !important;
        width: 0 !important;
        padding: 0 !important;
    }

    /* reCAPTCHA: prevent horizontal overflow */
    .g-recaptcha {
        overflow: hidden;
        max-width: 100%;
    }
}

@media (max-width: 400px) {
    /* Shrink reCAPTCHA on very narrow screens */
    .g-recaptcha {
        transform: scale(0.85);
        transform-origin: 0 0;
    }
}

/* ---- 2. TOPBAR — hamburger button ---- */

.navbar-minimalize {
    border: none;
    background: transparent;
    color: #676a6c;
    font-size: 1.25rem;
    padding: 10px 14px;
    cursor: pointer;
    line-height: 1;
    display: block;
}

.navbar-minimalize:hover,
.navbar-minimalize:focus {
    color: #1a7bb9;
    outline: none;
}

/* Hide hamburger on desktop (sidebar is always visible) */
@media (min-width: 992px) {
    .navbar-minimalize {
        display: none;
    }
}

/* ---- 3. INTERIOR LAYOUT — page wrapper, topbar, iboxes ---- */

@media (max-width: 991.98px) {
    /* Plan badge row: keep readable on tablet */
    .dashboard-header h1 {
        font-size: 1.3rem;
    }
}

@media (max-width: 767.98px) {
    /* Full-width page when sidebar is off-canvas */
    #page-wrapper {
        min-height: 100vh;
    }

    /* Dashboard header */
    .dashboard-header {
        padding: 8px 12px;
    }

    .dashboard-header h1 {
        font-size: 1.1rem;
        margin: 0 0 2px;
    }

    .dashboard-header span.text-muted {
        font-size: 0.8rem;
    }

    /* Content wrapper */
    .wrapper-content {
        padding: 10px 6px;
    }

    /* ibox */
    .ibox {
        margin-bottom: 12px;
    }

    .ibox-content {
        padding: 10px 8px;
    }

    .ibox-title {
        flex-wrap: wrap;
        gap: 4px;
    }

    .ibox-tools {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        align-items: center;
    }

    /* Topbar nav */
    .navbar-top {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        padding: 4px 8px;
        gap: 0;
    }

    .navbar-top-links {
        margin-left: auto;
    }

    /* Plan badge: smaller on mobile */
    .navbar-header .badge {
        font-size: 0.75rem;
    }
}

/* ---- 4. EXERCISE PAGE (speechapp) — category buttons ---- */

@media (max-width: 767.98px) {
    /* Category button container: column layout */
    .d-flex.flex-wrap.gap-2.mb-3.align-items-center {
        flex-direction: column;
        align-items: stretch !important;
        gap: 6px !important;
    }

    /* Each btn-group: full width, all buttons share space */
    .d-flex.flex-wrap.gap-2.mb-3 .btn-group {
        width: 100%;
        display: flex;
    }

    .d-flex.flex-wrap.gap-2.mb-3 .btn-group .btn {
        flex: 1 1 auto;
        font-size: 0.78rem;
        padding: 8px 3px;
        white-space: nowrap;
    }

    /* Exercise count selector: align right, full width row */
    .d-flex.flex-wrap.gap-2.mb-3 .ms-auto {
        width: 100%;
        margin-left: 0 !important;
        justify-content: flex-end;
    }

    /* Exercise cards: stack vertically on phones — one per row */
    #exercise-view {
        flex-direction: column !important;
        flex-wrap: wrap !important;
        overflow-x: visible;
        gap: 12px;
    }

    .exercise-card {
        width: 100%;
        min-width: unset;
        flex-shrink: unset;
    }

    /* Slide panels: compact height */
    .slide-panel.open {
        max-height: 220px;
    }

    /* Success button: full width */
    .success-btn {
        width: 100%;
        padding: 12px;
        font-size: 0.95rem;
    }

    /* Controls + success row: stack vertically */
    .mt-4.d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        gap: 10px;
        align-items: stretch !important;
    }

    .controls {
        display: flex;
        width: 100%;
    }
}

/* ---- 5. DATATABLES — mobile column & cell sizing ---- */

@media (max-width: 767.98px) {
    /* Prevent horizontal table scroll — we handle it via JS column hiding */
    .table-responsive {
        overflow-x: hidden;
    }

    /* Tighter cell padding */
    .table td,
    .table th {
        padding: 0.35rem 0.4rem;
        font-size: 0.85rem;
    }

    /* Card thumbnail: smaller in table rows */
    .card-thumbnail {
        width: 50px !important;
        height: 50px !important;
    }

    .thumb-placeholder {
        width: 50px !important;
        height: 50px !important;
        font-size: 1rem !important;
    }

    /* DataTables controls row */
    .dataTables_wrapper .dataTables_filter input {
        width: 130px;
    }

    .dataTables_wrapper .row {
        flex-direction: column;
        gap: 6px;
    }

    /* Mobile-only: columns hidden via JS get display:none */
    .dt-mobile-hide {
        display: none !important;
    }

    /* Details button added by mobile-tables.js */
    .btn-mobile-detail {
        padding: 3px 7px;
        font-size: 0.7rem;
    }
}

/* ---- 6. MOBILE DETAILS MODAL (dt row expand) ---- */

#mobileDetailsModal .modal-title {
    font-size: 1rem;
    word-break: break-word;
}

#mobileDetailsModal .dt-detail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 4px 0;
}

#mobileDetailsModal .dt-detail-item {
    flex: 1 1 130px;
    min-width: 110px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 8px 10px;
    border: 1px solid #e9ecef;
}

#mobileDetailsModal .dt-detail-label {
    font-size: 0.63rem;
    text-transform: uppercase;
    color: #6c757d;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

#mobileDetailsModal .dt-detail-value {
    font-size: 0.875rem;
    color: #212529;
    word-break: break-word;
    line-height: 1.4;
}

/* ---- 7. PROFILE PAGE — action buttons stack on mobile ---- */

@media (max-width: 575.98px) {
    /* Profile header: stack vertically */
    .d-flex.justify-content-between.align-items-center.flex-wrap {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }

    /* Button group: wrap naturally */
    .d-flex.gap-2 > .btn {
        flex: 1 1 auto;
    }
}

/* ---- 8. MODALS — full-width on phones ---- */

@media (max-width: 575.98px) {
    .modal-dialog:not(.modal-fullscreen):not(.modal-sm) {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}

/* ---- 9. GENERAL FORM / INPUT FIXES ---- */

@media (max-width: 767.98px) {
    /* Keep input groups on one line */
    .input-group {
        flex-wrap: nowrap;
    }

    /* Smaller btn-xs on mobile */
    .btn-xs {
        padding: 2px 5px;
        font-size: 0.7rem;
    }

    /* Shrink card body padding globally */
    .card-body {
        padding: 0.75rem;
    }

    /* Filter dropdowns in table headers */
    select.form-control-sm,
    select.form-select-sm {
        font-size: 0.8rem;
    }
}

/* ---- 10. TABLET (768–991px) tweaks ---- */

@media (min-width: 768px) and (max-width: 991.98px) {
    .dashboard-header h1 {
        font-size: 1.3rem;
    }

    .card-thumbnail {
        width: 72px;
        height: 72px;
    }

    .thumb-placeholder {
        width: 72px;
        height: 72px;
    }

    /* Exercise buttons: compress slightly */
    .d-flex.flex-wrap.gap-2.mb-3 .btn-group .btn {
        font-size: 0.82rem;
        padding: 8px 8px;
    }
}
