/* ============================================
   responsive.css — Mobile & Tablet Responsive
   Only @media rules. Desktop stays untouched.
   ============================================ */

/* ──────────────────────────────────────────────
   MOBILE  (max-width: 767.98px)
   ────────────────────────────────────────────── */
@media (max-width: 767.98px) {

    /* --- List + Detail: stack vertically --- */
    .list-detail-wrapper {
        flex-direction: column;
        gap: 16px;
        padding: 12px;
    }

    .main_list_container,
    .element_details_container {
        flex: none;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
    }

    .element_details_container {
        margin-right: 0;
    }

    /* --- Page title / heading --- */
    .list_page_title {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        font-size: 22px;
        padding: 14px 12px 8px;
    }

    .section-title {
        font-size: 22px !important;
    }

    .search-btn-wrapper {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .student-search-container {
        max-width: 100%;
        left: 0;
        flex: 1 1 100%;
    }

    .student-search-container .search_input {
        width: 100%;
        max-width: 100%;
        font-size: 16px;
    }

    /* --- Tables: horizontal scroll --- */
    .list_wrapper,
    .driver_list_wrapper {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto;
        padding-left: 0;
    }

    .scroll-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    .list-user-name {
        width: auto;
        max-width: 120px;
    }

    /* --- Detail panels --- */
    .detail-cont {
        padding: 10px;
    }

    .bus-info {
        max-height: none;
        overflow-y: visible;
        padding: 12px;
    }

    .bus-id {
        width: auto;
        max-width: 100%;
    }

    .grid-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .grid-item .label {
        font-size: 14px;
    }

    .grid-item .value {
        font-size: 15px;
    }

    /* --- Forms: full-width inputs --- */
    .form_wrapper {
        max-height: none;
        overflow-y: visible;
    }

    .form-div input,
    .form-div select,
    .form-div textarea,
    .form-control {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* --- Dashboard (school_top_bar cards) --- */
    .dashboard-title-wrap .d-flex {
        flex-wrap: wrap;
    }

    /* --- Graphs --- */
    .graph-container {
        width: 100%;
        margin: 12px 0;
        padding: 12px;
        border-radius: 12px;
    }

    .graph-wrapper {
        padding: 8px;
    }

    .graph-box {
        height: 220px;
        min-height: 220px;
    }

    .collapse-left {
        font-size: 18px;
    }

    .graph-grid {
        grid-template-columns: 1fr !important;
    }

    /* --- Report dashboard filters --- */
    .report-form-inline,
    #reportForm {
        flex-wrap: wrap !important;
        gap: 8px;
    }

    #reportForm .form-group {
        flex: 1 1 calc(50% - 8px);
        min-width: 120px;
    }

    #reportForm .form-group select,
    #reportForm .form-group input {
        width: 100% !important;
        font-size: 14px;
    }

    .report_container {
        padding: 8px;
    }

    /* --- Filter dropdown (bottom-sheet on mobile) --- */
    .filter-dropdown,
    .toolbar-filter .filter-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        z-index: 1065;
        padding: 16px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    /* Backdrop behind the filter bottom-sheet */
    .filter-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 8;
    }
    .filter-backdrop.show {
        display: block;
    }



    /* --- Vehicle details --- */
    .vehicle-doc {
        width: 140px;
        height: 140px;
    }

    /* --- Misc fixed widths --- */
    .view-all-btn {
        width: 180px;
    }

    .elem_card {
        max-height: none;
    }

    /* --- Routes page: search bar on own row, buttons below --- */
    .list_page_title>.d-flex {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .route-search-cont {
        flex: 1 1 100% !important;
        max-width: 100% !important;
        left: 0 !important;
    }

    #search-input {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 16px;
    }

    #search-results {
        width: 100% !important;
    }

    #search-results li {
        width: 100% !important;
    }

    /* Routes & Vehicles: card text wrapping */
    .card-div1,
    .card-div2 {
        flex-wrap: wrap;
        gap: 4px;
    }

    .vehicle-title {
        font-size: 18px;
        margin-left: 10px;
    }

    .card-link {
        font-size: 14px;
    }

    /* --- Vehicle list cards --- */
    .list_wrapper {
        max-height: none;
    }

    /* --- Report form: wrap inputs into rows, keep all visible --- */
    .dashboard-title-wrap.d-flex,
    .dashboard-title-wrap .d-flex {
        flex-wrap: wrap !important;
    }

    #reportForm {
        flex-wrap: wrap !important;
        gap: 8px;
        width: 100%;
    }

    #reportForm .form-group {
        flex: 1 1 calc(50% - 8px);
        min-width: calc(50% - 8px);
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    #reportForm .form-group select,
    #reportForm .form-group input[type="date"] {
        width: 100% !important;
    }

    #reportForm button[type="submit"] {
        flex: 0 0 auto;
    }

    /* --- Report content tables --- */
    .report_container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .report_container table {
        min-width: 600px;
    }

    .export-top-section {
        flex-direction: column;
        gap: 8px;
    }

    .export-buttons {
        display: flex;
        gap: 8px;
    }

    /* --- Track Vehicle: map --- */
    .map-section {
        min-height: 300px;
        max-height: none;
        height: 50vh;
    }

    .content-grid {
        min-height: auto;
    }

    .track-screen-header-wrapper {
        flex-direction: column;
    }

    /* --- Maintenance stat cards --- */
    .m-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* --- Map container (dashboard) --- */
    #dash_map {
        width: 100% !important;
    }

    .checkbox-group {
        height: auto;
        max-height: 100px;
    }

    /* --- Route details: buttons wrap on mobile --- */
    .bus-info .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 8px;
    }

    .bus-info .d-flex.justify-content-between > div {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .bus-info .btn {
        flex: 1 1 auto;
        white-space: nowrap;
        font-size: 13px;
        padding: 6px 12px;
        text-align: center;
    }

    .detail-btn-wrap {
        margin-top: 4px;
    }

    /* --- Navbar popovers: desktop-like dropdown, constrained on mobile --- */
    .navbar-popover {
        top: calc(100% + 6px);
        right: 0;
        left: auto;
        width: min(300px, calc(100vw - 20px));
        max-width: calc(100vw - 20px);
        max-height: calc(100dvh - 72px);
        overflow-y: auto;
    }

    .navbar-support-popover,
    .navbar-broadcast-popover,
    .navbar-profile-popover {
        width: min(300px, calc(100vw - 20px)) !important;
        max-width: calc(100vw - 20px) !important;
    }

    /* --- Edit path / route action buttons --- */
    .route-action-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .toolbar-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
}


/* ──────────────────────────────────────────────
   TABLET  (768px – 1024px)
   ────────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1024px) {

    /* --- List + Detail: stack vertically --- */
    .list-detail-wrapper {
        flex-direction: column;
        gap: 16px;
    }

    .main_list_container,
    .element_details_container {
        flex: none;
        width: 100% !important;
        max-width: 100% !important;
    }

    .element_details_container {
        margin-right: 0;
    }

    /* --- Page title --- */
    .list_page_title {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 26px;
    }

    .search-btn-wrapper {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* --- Tables --- */
    .list_wrapper,
    .driver_list_wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    .scroll-container {
        overflow-x: auto;
    }

    /* --- Detail panels --- */
    .bus-info {
        max-height: none;
    }

    .grid-container {
        grid-template-columns: 1fr 1fr;
    }

    /* --- Forms --- */
    .form_wrapper {
        max-height: none;
    }

    /* --- Graphs --- */
    .graph-container {
        width: 100%;
        margin: 12px 0;
    }

    /* --- Filter dropdown --- */
    .filter-dropdown,
    .toolbar-filter .filter-dropdown {
        width: 380px;
    }



    /* --- Routes page --- */
    .route-search-cont {
        max-width: 100%;
        left: 0;
    }

    #search-input {
        width: 100%;
        max-width: 100%;
    }

    .elem_card {
        max-height: none;
    }

    .vehicle-title {
        font-size: 20px;
    }


    /* --- Report form --- */
    #reportForm {
        flex-wrap: wrap !important;
        gap: 8px;
    }

    #reportForm .form-group {
        flex: 1 1 calc(50% - 8px);
        min-width: 140px;
    }

    .report_container {
        overflow-x: auto;
    }

    .report_container table {
        min-width: 600px;
    }

    /* --- Track Vehicle map --- */
    .map-section {
        max-height: none;
        height: 50vh;
    }

}