/* =========================================================
   ROUTE SAFETY HUB
   Student Assignment by Bus / School
   Professional landscape roster
   ========================================================= */

.route-assignment-report-page {
    width: 100%;
}


/* ---------------------------------------------------------
   SCREEN REPORT CONTAINER
   --------------------------------------------------------- */

.route-roster-wrap {
    width: 100%;
    max-width: 1240px;
    margin: 18px auto 24px;
    padding: 16px;
    box-sizing: border-box;

    background: #ffffff;
    border: 1px solid #d8dee6;
    border-radius: 4px;
}


/* ---------------------------------------------------------
   REPORT HEADER
   Everything stays LEFT aligned.
   --------------------------------------------------------- */

.route-roster-wrap .roster-bus-title {
    display: block;
    width: 100%;
    box-sizing: border-box;

    margin: 0 0 8px;
    padding: 8px 10px;

    background: #c9dfef;
    border: 1px solid #b4ccde;

    color: #172033;
    font-size: 13px;
    line-height: 1.2;
    font-weight: 800;

    text-align: left;
}

.route-roster-wrap .roster-driver {
    margin: 0 0 4px;
    padding: 0;

    color: #263548;
    font-size: 11px;
    line-height: 1.3;
    font-weight: 600;

    text-align: left;
}

.route-roster-wrap .roster-meta {
    margin: 0 0 5px;
    padding: 0;

    color: #263548;
    font-size: 10px;
    line-height: 1.3;
    font-weight: 700;

    text-align: left;
}

.route-roster-wrap .roster-confidential {
    margin: 0 0 10px;
    padding: 0;

    color: #536274;
    font-size: 10px;
    line-height: 1.3;
    font-style: italic;

    text-align: left;
}


/* ---------------------------------------------------------
   BOOTSTRAP-STYLE TABLE
   --------------------------------------------------------- */

.route-roster-table {
    width: 100%;
    margin: 0;

    border-collapse: collapse;
    border-spacing: 0;

    color: #172033;
    background: #ffffff;

    font-size: 11px;
    line-height: 1.25;
}

.route-roster-table thead th {
    padding: 8px 7px;

    background: #e5eef5;
    color: #172033;

    border: 1px solid #b9c4cf;

    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;

    text-align: left;
    vertical-align: middle;

    white-space: nowrap;
}

.route-roster-table tbody td {
    padding: 8px 7px;

    background: #ffffff;
    color: #172033;

    border: 1px solid #d5dce3;

    text-align: left;
    vertical-align: middle;

    white-space: nowrap;
}

.route-roster-table tbody tr:nth-child(even) td {
    background: #f7f9fb;
}

.route-roster-table tbody tr:hover td {
    background: #eef4f8;
}

.route-roster-table .student-cell {
    font-weight: 700;
}


/* ---------------------------------------------------------
   COLUMN PROPORTIONS
   --------------------------------------------------------- */

.route-roster-table .c-seat {
    width: 5%;
}

.route-roster-table .c-student {
    width: 17%;
}

.route-roster-table .c-id {
    width: 7%;
}

.route-roster-table .c-school {
    width: 16%;
}

.route-roster-table .c-grade {
    width: 5%;
}

.route-roster-table .c-mf {
    width: 4%;
}

.route-roster-table .c-shift {
    width: 8%;
}

.route-roster-table .c-contact {
    width: 17%;
}

.route-roster-table .c-phone {
    width: 15%;
}

.route-roster-table .c-shuttle {
    width: 6%;
}


/* ---------------------------------------------------------
   PRINT
   --------------------------------------------------------- */

@media print {

    @page {
        size: landscape;
        margin: 0.30in;
    }

    body {
        background: #ffffff !important;
    }

    .route-assignment-screen-only,
    .app-header,
    nav {
        display: none !important;
    }

    .page-shell,
    .route-assignment-report-page {
        width: 100% !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;
    }

    .route-roster-wrap {
        width: 100% !important;
        max-width: none !important;

        margin: 0 !important;
        padding: 0 !important;

        border: 0 !important;
        border-radius: 0 !important;
    }

    .route-report-sheet {
        width: 100%;

        page-break-after: always;
        break-after: page;
    }

    .route-report-sheet:last-child {
        page-break-after: auto;
        break-after: auto;
    }


    /* Header remains LEFT aligned */

    .route-roster-wrap .roster-bus-title {
        margin: 0 0 5px !important;
        padding: 5px 7px !important;

        font-size: 9.5pt !important;
        line-height: 1.15 !important;

        text-align: left !important;

        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .route-roster-wrap .roster-driver {
        margin-bottom: 2px !important;

        font-size: 8pt !important;
        line-height: 1.15 !important;

        text-align: left !important;
    }

    .route-roster-wrap .roster-meta {
        margin-bottom: 3px !important;

        font-size: 7.5pt !important;
        line-height: 1.15 !important;

        text-align: left !important;
    }

    .route-roster-wrap .roster-confidential {
        margin-bottom: 6px !important;

        font-size: 7pt !important;
        line-height: 1.15 !important;

        text-align: left !important;
    }


    /* Compact but readable Bootstrap-style table */

    .route-roster-table {
        width: 100% !important;

        font-size: 7.5pt !important;
        line-height: 1.1 !important;
    }

    .route-roster-table thead th {
        padding: 4px 4px !important;

        font-size: 7pt !important;
        line-height: 1.1 !important;

        text-align: left !important;

        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .route-roster-table tbody td {
        padding: 4px 4px !important;

        font-size: 7.5pt !important;
        line-height: 1.1 !important;

        text-align: left !important;
        white-space: nowrap !important;

        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .route-roster-table tbody tr:nth-child(even) td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* =========================================================
   PRINT PAGE FIT FIX
   One report page = one physical landscape sheet
   ========================================================= */

@media print {

    @page {
        size: landscape;
        margin: 0.20in;
    }

    html,
    body {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .route-roster-wrap {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .route-report-sheet {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;

        page-break-inside: avoid !important;
        break-inside: avoid-page !important;
    }

    .route-roster-wrap .roster-bus-title {
        margin-bottom: 3px !important;
        padding: 4px 6px !important;
    }

    .route-roster-wrap .roster-driver {
        margin: 0 0 2px !important;
    }

    .route-roster-wrap .roster-meta {
        margin: 0 0 2px !important;
    }

    .route-roster-wrap .roster-confidential {
        margin: 0 0 5px !important;
    }

    .route-roster-table {
        width: 100% !important;
        margin: 0 !important;
    }

    .route-roster-table thead {
        display: table-header-group;
    }

    .route-roster-table th {
        padding: 3px 4px !important;
    }

    .route-roster-table td {
        padding: 3.5px 4px !important;
    }
}

/* Prevent trailing blank printed sheet */
@media print {

    .route-report-sheet {
        page-break-after: auto !important;
        break-after: auto !important;
        page-break-before: auto !important;
        break-before: auto !important;
    }

    /* Only start a new physical page when another report page actually exists */
    .route-report-sheet + .route-report-sheet {
        page-break-before: always !important;
        break-before: page !important;
    }
}

/* Prevent trailing blank printed sheet */
@media print {

    .route-report-sheet {
        page-break-after: auto !important;
        break-after: auto !important;
        page-break-before: auto !important;
        break-before: auto !important;
    }

    /* Only start a new physical page when another report page actually exists */
    .route-report-sheet + .route-report-sheet {
        page-break-before: always !important;
        break-before: page !important;
    }
}

/* =========================================================
   SAFARI PRINT FIX
   Remove application screen sizing/flex behavior when printing.
   ========================================================= */

@media print {

    html,
    body {
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;

        margin: 0 !important;
        padding: 0 !important;

        display: block !important;
        overflow: visible !important;
    }

    body > * {
        min-height: 0 !important;
    }

    main,
    .page-shell,
    .route-assignment-report-page,
    .route-roster-wrap,
    .route-assignment-pages,
    .route-report-sheet {
        width: 100% !important;

        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;

        margin-top: 0 !important;
        margin-bottom: 0 !important;

        display: block !important;
        overflow: visible !important;
    }

    .route-report-sheet {
        page-break-before: auto !important;
        page-break-after: auto !important;
        page-break-inside: avoid !important;

        break-before: auto !important;
        break-after: auto !important;
        break-inside: avoid-page !important;
    }

    .route-report-sheet + .route-report-sheet {
        page-break-before: always !important;
        break-before: page !important;
    }

    footer,
    .site-footer,
    .app-footer {
        display: none !important;
    }
}


/* =========================================================
   REPORT SELECTION CONTROLS
   ========================================================= */

.route-report-control-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: end;
}

.route-report-control-block {
    min-width: 0;
}

.route-report-control-block label {
    display: block;
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: #24344a;
    text-align: left;
}

.route-report-control-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}

.route-report-control-row select {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.route-report-control-row button {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
}

.route-report-current-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 12px;
}

.route-report-current-actions button {
    margin: 0;
}


@media (max-width: 900px) {

    .route-report-control-grid {
        grid-template-columns: 1fr;
    }
}


@media print {

    .route-report-control-grid,
    .route-report-current-actions {
        display: none !important;
    }
}

/* Shuttle roster filter */
.route-report-filter-select {
    flex: 0 0 190px !important;
    width: 190px !important;
    min-width: 190px !important;
}

.route-roster-table .c-shuttle {
    width: 8%;
}

@media (max-width: 900px) {
    .route-report-control-row {
        flex-wrap: wrap;
    }

    .route-report-filter-select {
        flex: 1 1 180px !important;
        width: auto !important;
    }
}

/* Keep long school names on one row without widening the table */
.route-roster-table td.school-name-long {
    font-size: 9px;
    letter-spacing: -0.15px;
}

@media print {
    .route-roster-table td.school-name-long {
        font-size: 6.5pt !important;
        letter-spacing: -0.1pt;
    }
}

/* Locked Letter-landscape route roster refinements. */
.route-selection-form { margin-bottom: 16px; }
.route-roster-table td.contact-cell { white-space: normal; overflow-wrap: anywhere; }
.route-roster-table td.contact-cell div + div { margin-top: 2px; }
.route-roster-table tbody tr { break-inside: avoid; page-break-inside: avoid; }
.route-report-sheet { box-sizing: border-box; }
@media print {
  @page { size: letter landscape; margin: 0.25in; }
  .route-roster-table td.contact-cell,
  .route-roster-table tbody td { white-space: normal !important; }
  .route-roster-table tbody tr { break-inside: avoid !important; page-break-inside: avoid !important; }
  .route-roster-table thead { display: table-header-group !important; }
  .route-roster-wrap { padding: 0 !important; }
}
