/* =========================================================
   MinDV â€” Appointment Slots
   FINAL CLEAN CSS
   GS / PIK Appointment Slots
   ========================================================= */

/* ---------------------------------------------------------
   GENERAL / HEADER
   --------------------------------------------------------- */

.slot-heading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.slot-filter-card,
.leave-card {
    margin-bottom: 14px;
}

.master-ready-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 999px;
    background: #ecfdf3;
    color: #15803d;
    border: 1px solid #bbf7d0;
    font-size: 13px;
    font-weight: 700;
}

.master-ready-badge::first-letter {
    color: #16a34a;
}

/* ---------------------------------------------------------
   FILTERS
   --------------------------------------------------------- */

.slot-filters {
    display: grid;
    grid-template-columns: minmax(150px, 1fr)
                           minmax(170px, 1.2fr)
                           minmax(150px, 1fr)
                           minmax(190px, 1.6fr)
                           auto;
    gap: 12px;
    align-items: end;
}

.filter-buttons {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.slot-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 3px 10px;
    font-size: 12px;
}

/* ---------------------------------------------------------
   TABLE CONTAINER
   --------------------------------------------------------- */

.table-card {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
}

/*
 * Important:
 * The table is intentionally wider than the viewport when needed.
 * Only the table scrolls horizontally; the whole page does not.
 */
.appointment-slot-table {
    width: 100%;
    min-width: 1500px;
    max-width: none;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

/* Header */
.appointment-slot-table th {
    padding: 12px 10px;
    height: 44px;
    vertical-align: middle;
    text-align: left;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
}

/* Body cells */
.appointment-slot-table td {
    height: 58px;
    padding: 10px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

/* Row separator */
.appointment-slot-table tbody tr:not(.slot-fill-row):not(.slot-edit-row) td {
    border-bottom: 1px solid #eaecf0;
}

.appointment-slot-table tbody tr:hover td {
    background: #fafcff;
}

/* ---------------------------------------------------------
   COLUMN WIDTHS
   ---------------------------------------------------------
   Columns 1â€“3 are kept compact.
   Columns 4â€“10 are the treatment/operations section visible
   in the GS/PIK table.
   --------------------------------------------------------- */

/* Tanggal */
.appointment-slot-table th:nth-child(1),
.appointment-slot-table td:nth-child(1) {
    width: 105px;
    min-width: 105px;
}

/* Hari */
.appointment-slot-table th:nth-child(2),
.appointment-slot-table td:nth-child(2) {
    width: 85px;
    min-width: 85px;
}

/* Dokter */
.appointment-slot-table th:nth-child(3),
.appointment-slot-table td:nth-child(3) {
    width: 180px;
    min-width: 180px;
}

/* Treatment */
.appointment-slot-table th:nth-child(4),
.appointment-slot-table td:nth-child(4) {
    width: 190px;
    min-width: 190px;
    max-width: 220px;
}

/* Treatment Fix */
.appointment-slot-table th:nth-child(5),
.appointment-slot-table td:nth-child(5) {
    width: 245px;
    min-width: 245px;
    max-width: 260px;
}

/* EMR */
.appointment-slot-table th:nth-child(6),
.appointment-slot-table td:nth-child(6) {
    width: 80px;
    min-width: 80px;
    max-width: 90px;
    text-align: center;
}

/* Status */
.appointment-slot-table th:nth-child(7),
.appointment-slot-table td:nth-child(7) {
    width: 120px;
    min-width: 120px;
    max-width: 130px;
}

/* Konfirmasi */
.appointment-slot-table th:nth-child(8),
.appointment-slot-table td:nth-child(8) {
    width: 150px;
    min-width: 150px;
    max-width: 165px;
}

/* Reminder */
.appointment-slot-table th:nth-child(9),
.appointment-slot-table td:nth-child(9) {
    width: 185px;
    min-width: 185px;
    max-width: 205px;
}

/* Follow Up */
.appointment-slot-table th:nth-child(10),
.appointment-slot-table td:nth-child(10) {
    width: 135px;
    min-width: 135px;
    max-width: 150px;
}

/* ---------------------------------------------------------
   STATUS
   --------------------------------------------------------- */

.inline-status {
    margin: 0;
}

.status-select {
    width: auto;
    min-width: 105px;
    height: 32px;
    padding: 6px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 999px;
    background: #fff;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.status-available {
    background: #ecfdf3;
    color: #067647;
}

.status-booked {
    background: #eff6ff;
    color: #175cd3;
}

.status-cancelled {
    background: #fff1f3;
    color: #c01048;
}

.status-blocked {
    background: #f2f4f7;
    color: #475467;
}

/* Attendance */
.attendance-attended {
    background: #ecfdf3;
    color: #067647;
}

.attendance-pending {
    background: #fff7ed;
    color: #b54708;
}

.attendance-cancelled {
    background: #fff1f3;
    color: #c01048;
}

/* ---------------------------------------------------------
   TREATMENT FIX
   --------------------------------------------------------- */

.inline-treatment-fix {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-width: 0;
}

.inline-treatment-fix .mini-input {
    width: 175px;
    min-width: 175px;
    max-width: 175px;
    box-sizing: border-box;
}

/* ---------------------------------------------------------
   REMINDER
   --------------------------------------------------------- */

.reminder-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    flex-wrap: nowrap;
    width: max-content;
    min-width: 0;
}

.reminder-actions form {
    display: inline-flex;
    margin: 0;
}

.reminder-btn {
    height: 30px;
    min-width: 42px;
    padding: 5px 8px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-sizing: border-box;
}

.reminder-btn:hover {
    background: #f2f4f7;
}

.reminder-due {
    border-color: #b2ddff;
    background: #eff8ff;
    color: #175cd3;
}

.reminder-last {
    margin-top: 4px;
    color: #667085;
    font-size: 9px;
    line-height: 1.3;
    white-space: normal;
}

.reminder-sent {
    color: #067647;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   FILL / EDIT ROW
   --------------------------------------------------------- */

.slot-fill-row td {
    padding: 10px 12px;
    background: #fafafa;
    white-space: normal;
}

.slot-fill-row details summary,
.slot-edit-row details summary {
    cursor: pointer;
    color: #175cd3;
    font-size: 12px;
    font-weight: 800;
}

.slot-fill-form {
    display: grid;
    grid-template-columns:
        minmax(150px, 1.3fr)
        minmax(130px, 1fr)
        minmax(150px, 1.2fr)
        minmax(120px, 1fr)
        auto;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.slot-fill-form .input {
    min-width: 0;
}

.slot-fill-row .btn {
    white-space: nowrap;
}

.slot-edit-row td {
    padding: 10px 12px;
    background: #f8fbff;
    white-space: normal;
}

.edited-at {
    display: block;
    margin-top: 4px;
    color: #98a2b3;
    font-size: 9px;
    line-height: 1.3;
    white-space: normal;
}

/* ---------------------------------------------------------
   PAGINATION
   --------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid #eaecf0;
}

.pagination-links {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.page-link {
    min-width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    color: #344054;
    font-size: 12px;
}

.page-link.active {
    background: #101828;
    color: #fff;
    border-color: #101828;
}

/* ---------------------------------------------------------
   IMPORT
   --------------------------------------------------------- */

.import-form {
    display: grid;
    gap: 18px;
}

.branch-choice {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.branch-choice label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 11px 13px;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    cursor: pointer;
}

.import-rules {
    margin: 0;
    padding-left: 20px;
    color: #475467;
    font-size: 13px;
    line-height: 1.9;
}

.import-rules code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #f2f4f7;
}

.import-navigation {
    margin-top: 16px;
    font-size: 13px;
}

.import-navigation a {
    color: #175cd3;
    font-weight: 800;
}

/* ---------------------------------------------------------
   DOCTOR LEAVE / CUTI
   --------------------------------------------------------- */

.leave-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    gap: 22px;
}

.leave-form {
    display: grid;
    gap: 12px;
}

.leave-date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.leave-info {
    padding: 18px;
    border: 1px solid #eaecf0;
    border-radius: 14px;
    background: #fafafa;
}

.leave-info-title {
    margin-bottom: 8px;
    font-weight: 800;
}

.leave-info ul {
    margin: 0;
    padding-left: 20px;
    color: #475467;
    font-size: 13px;
    line-height: 1.8;
}

.leave-active-badge,
.leave-cancelled-badge {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.leave-active-badge {
    background: #ecfdf3;
    color: #067647;
}

.leave-cancelled-badge {
    background: #f2f4f7;
    color: #667085;
}

.danger-btn {
    color: #b42318 !important;
    border-color: #fecdca !important;
}

.leave-list-card {
    overflow: hidden;
}

/* ---------------------------------------------------------
   TABLET
   --------------------------------------------------------- */

@media (max-width: 1100px) {
    .slot-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .slot-fill-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .slot-fill-form .btn {
        grid-column: 1 / -1;
    }

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

/* ---------------------------------------------------------
   SMALL TABLET
   --------------------------------------------------------- */

@media (max-width: 900px) {
    .leave-date-grid {
        grid-template-columns: 1fr 1fr;
    }

    .appointment-slot-table {
        min-width: 1480px;
    }
}

/* ---------------------------------------------------------
   MOBILE
   --------------------------------------------------------- */

@media (max-width: 650px) {
    .slot-filters {
        grid-template-columns: 1fr;
    }

    .filter-buttons {
        width: 100%;
    }

    .pagination {
        flex-direction: column;
        align-items: flex-start;
    }

    .leave-date-grid {
        grid-template-columns: 1fr;
    }

    .slot-fill-form {
        grid-template-columns: 1fr;
    }

    .slot-fill-form .btn {
        grid-column: auto;
    }

    .appointment-slot-table {
        min-width: 1450px;
    }

    .appointment-slot-table th,
    .appointment-slot-table td {
        padding: 9px 8px;
    }

    .inline-treatment-fix .mini-input {
        width: 165px;
        min-width: 165px;
        max-width: 165px;
    }
}
/* =========================================================
   V4 UI FIX — APPOINTMENT SLOTS TABLE
   One scroll container, correct 16-column mapping, readable
   controls, sticky date/day context while scrolling sideways.
   ========================================================= */
.table-card {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto !important;
    overflow-y: visible !important;
    overscroll-behavior-x: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #98a2b3 #f2f4f7;
    border: 1px solid #eaecf0;
    background: #fff;
}

.table-card > .appointment-slot-scroll {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
}

.appointment-slot-table {
    width: 2170px !important;
    min-width: 2170px !important;
    max-width: none !important;
    table-layout: fixed !important;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.appointment-slot-table th,
.appointment-slot-table td {
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.appointment-slot-table th {
    position: relative;
    height: 48px;
    padding: 12px 10px;
    background: #f8fafc;
    color: #475467;
    border-bottom: 1px solid #dfe4ea;
    white-space: nowrap;
    z-index: 1;
}

.appointment-slot-table td {
    height: 58px;
    padding: 9px 10px;
    background: #fff;
    border-bottom: 1px solid #eaecf0;
    white-space: nowrap;
}

/* Column widths now match the actual 16-column table markup. */
.appointment-slot-table th:nth-child(1), .appointment-slot-table td:nth-child(1) { width:105px; min-width:105px; }
.appointment-slot-table th:nth-child(2), .appointment-slot-table td:nth-child(2) { width:80px; min-width:80px; }
.appointment-slot-table th:nth-child(3), .appointment-slot-table td:nth-child(3) { width:190px; min-width:190px; }
.appointment-slot-table th:nth-child(4), .appointment-slot-table td:nth-child(4) { width:75px; min-width:75px; text-align:center; }
.appointment-slot-table th:nth-child(5), .appointment-slot-table td:nth-child(5) { width:70px; min-width:70px; }
.appointment-slot-table th:nth-child(6), .appointment-slot-table td:nth-child(6) { width:150px; min-width:150px; }
.appointment-slot-table th:nth-child(7), .appointment-slot-table td:nth-child(7) { width:145px; min-width:145px; }
.appointment-slot-table th:nth-child(8), .appointment-slot-table td:nth-child(8) { width:170px; min-width:170px; }
.appointment-slot-table th:nth-child(9), .appointment-slot-table td:nth-child(9) { width:250px; min-width:250px; }
.appointment-slot-table th:nth-child(10), .appointment-slot-table td:nth-child(10) { width:75px; min-width:75px; text-align:center; }
.appointment-slot-table th:nth-child(11), .appointment-slot-table td:nth-child(11) { width:120px; min-width:120px; }
.appointment-slot-table th:nth-child(12), .appointment-slot-table td:nth-child(12) { width:155px; min-width:155px; }
.appointment-slot-table th:nth-child(13), .appointment-slot-table td:nth-child(13) { width:160px; min-width:160px; }
.appointment-slot-table th:nth-child(14), .appointment-slot-table td:nth-child(14) { width:145px; min-width:145px; }
.appointment-slot-table th:nth-child(15), .appointment-slot-table td:nth-child(15) { width:125px; min-width:125px; }
.appointment-slot-table th:nth-child(16), .appointment-slot-table td:nth-child(16) { width:160px; min-width:160px; }

/* Keep date and weekday visible when the user scrolls to the right. */
.appointment-slot-table th:nth-child(1),
.appointment-slot-table td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #fff;
    box-shadow: 1px 0 0 #e4e7ec;
}
.appointment-slot-table th:nth-child(1) { z-index: 5; background: #f8fafc; }
.appointment-slot-table th:nth-child(2),
.appointment-slot-table td:nth-child(2) {
    position: sticky;
    left: 105px;
    z-index: 3;
    background: #fff;
    box-shadow: 1px 0 0 #e4e7ec;
}
.appointment-slot-table th:nth-child(2) { z-index: 5; background: #f8fafc; }
.appointment-slot-table tbody tr:hover td:nth-child(1),
.appointment-slot-table tbody tr:hover td:nth-child(2) { background: #f8fbff; }

.inline-treatment-fix {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 58px;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-width: 0;
}
.inline-treatment-fix .mini-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 36px;
    padding: 7px 9px;
    font-size: 12px;
}
.inline-treatment-fix .reminder-btn {
    min-width: 58px;
    height: 34px;
    padding: 6px 7px;
    font-size: 11px;
}
.status-select {
    max-width: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    height: 35px;
    padding: 6px 8px;
    font-size: 11px;
}
.inline-status { width:100%; min-width:0; }
.reminder-actions { max-width:100%; width:auto; flex-wrap:wrap; gap:5px; }
.reminder-actions form { max-width:100%; }
.appointment-slot-table .slot-fill-row td,
.appointment-slot-table .slot-edit-row td { overflow: visible; }

.table-card::-webkit-scrollbar { height: 12px; }
.table-card::-webkit-scrollbar-track { background: #f2f4f7; border-radius: 999px; }
.table-card::-webkit-scrollbar-thumb { background: #98a2b3; border: 3px solid #f2f4f7; border-radius: 999px; }
.table-card::-webkit-scrollbar-thumb:hover { background: #667085; }

@media (max-width: 900px) {
    .appointment-slot-table { width:2170px !important; min-width:2170px !important; }
}
