/*
 * Jembatan tema DeskApp (Bootstrap 4) → aplikasi RS yang memakai Bootstrap 5.
 * Urutan muat: bootstrap 5 → deskapp icon-font + style → file ini.
 * Tujuannya: semua halaman lama (class Bootstrap 5) otomatis tampil dengan gaya DeskApp.
 */

/* ---------- warna utama DeskApp ---------- */
:root {
    --bs-primary: #1b00ff;
    --bs-primary-rgb: 27, 0, 255;
    --bs-link-color: #1b00ff;
    --bs-link-color-rgb: 27, 0, 255;
    --bs-link-hover-color: #1600cc;
    --bs-body-font-family: 'Inter', sans-serif;
    /* --bs-body-bg sengaja TIDAK diubah: Bootstrap 5 memakainya juga untuk latar input,
       dropdown & modal. Latar abu-abu halaman diatur langsung di body. */
    --bs-body-color: #031e23;
    --app-card-shadow: 0 0 28px rgba(0, 0, 0, .08);
}

.btn-primary {
    --bs-btn-bg: #1b00ff; --bs-btn-border-color: #1b00ff;
    --bs-btn-hover-bg: #1600cc; --bs-btn-hover-border-color: #1600cc;
    --bs-btn-active-bg: #1300b3; --bs-btn-active-border-color: #1300b3;
    --bs-btn-disabled-bg: #1b00ff; --bs-btn-disabled-border-color: #1b00ff;
}
.btn-outline-primary {
    --bs-btn-color: #1b00ff; --bs-btn-border-color: #1b00ff;
    --bs-btn-hover-bg: #1b00ff; --bs-btn-hover-border-color: #1b00ff;
    --bs-btn-active-bg: #1b00ff; --bs-btn-active-border-color: #1b00ff;
}
.bg-primary { background-color: #1b00ff !important; }
.text-primary { color: #1b00ff !important; }
.border-primary { border-color: #1b00ff !important; }
.form-check-input:checked { background-color: #1b00ff; border-color: #1b00ff; }
.form-check-input:focus, .form-select:focus, .form-control:focus { border-color: #1b00ff; box-shadow: 0 0 0 .2rem rgba(27, 0, 255, .12); }

/* ---------- tipografi ---------- */
body { font-family: 'Inter', sans-serif; background: #ecf0f4; color: #031e23; }
h1, h2, h3, h4, h5, h6 { font-family: 'Inter', sans-serif; color: #1b3133; }
.small, small { font-size: .85em; }

/* judul halaman (h3 pertama di konten) bergaya judul DeskApp */
.page-content > h3,
.page-content > .d-flex > h3,
.page-content > div > h3.mb-0 { font-size: 22px; font-weight: 600; margin-bottom: 20px; }
.page-content > .d-flex:has(> h3) { margin-bottom: 20px !important; }
.page-content > .d-flex > h3 { margin-bottom: 0; }

/* ---------- kartu ---------- */
.card {
    border: 0;
    border-radius: 10px;
    box-shadow: var(--app-card-shadow);
    background: #fff;
}
.card > .card-header:first-child { border-radius: 10px 10px 0 0; }
.card-header { border-bottom: 1px solid #ecf0f4; font-weight: 600; padding: .85rem 1.25rem; }
.card-header.bg-light, .card-header:not([class*="bg-"]) { background: #fff; color: #1b3133; }
.card-footer { background: #fff; border-top: 1px solid #ecf0f4; border-radius: 0 0 10px 10px; }
.card-body { padding: 1.25rem; }
.card-body.p-0 > .table { margin-bottom: 0; }
.card-body.p-0 > .table:last-child tr:last-child td { border-bottom: 0; }

/* ---------- form ---------- */
.form-control, .form-select {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #131e22;
    border-color: #d4d4d4;
    border-radius: 8px;
    height: 45px;
    background-color: #fff;
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: #f1f3f6; }
textarea.form-control { height: auto; min-height: 45px; }
.form-control-sm, .form-select-sm, .form-control.form-control-sm { height: 36px; font-size: 13px; border-radius: 6px; padding-top: .3rem; padding-bottom: .3rem; }
textarea.form-control-sm { height: auto; min-height: 36px; }
input[type=range].form-range, input[type=checkbox].form-control, input[type=radio].form-control { height: auto; }
input[type=color].form-control { height: 45px; }
.form-control[type=file] { height: auto; }
.input-group-text { border-color: #d4d4d4; font-size: 13px; background: #f4f6f9; border-radius: 8px; }
.input-group-sm > .input-group-text { border-radius: 6px; }
.input-group-sm > .form-control, .input-group-sm > .form-select { height: 36px; }
.form-label { font-weight: 500; color: #1b3133; font-size: 14px; }
.form-label.small, label.small { font-size: 12.5px; }
.form-check-input { border-color: #b8bec6; }
.form-text { color: #8c9094; }

/* ---------- tombol ---------- */
.btn { font-family: 'Inter', sans-serif; font-weight: 500; border-radius: 8px; padding: .6rem 1rem; font-size: 14px; line-height: 20px; }
.btn-sm { padding: .32rem .65rem; font-size: 13px; line-height: 18px; border-radius: 6px; }
.btn-sm.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.btn-lg { padding: .75rem 1.25rem; font-size: 16px; }
.btn-link { box-shadow: none; }
.btn-light { background: #fff; border-color: #d4d4d4; }
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn:first-child { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.btn-group > .btn:last-child { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }

/* ---------- badge ---------- */
.badge { padding: .4em .65em; font-weight: 600; border-radius: 6px; }
.badge.rounded-pill { border-radius: 50rem; }

/* ---------- tabel ---------- */
.table { --bs-table-bg: #fff; margin-bottom: 1rem; }
.table thead th { font-weight: 600; font-size: 13.5px; color: #1b3133; border-bottom-width: 1px; padding: .75rem .9rem; white-space: nowrap; }
.table td { font-size: 14px; font-weight: 400; padding: .75rem .9rem; vertical-align: middle; }
.table-sm thead th { padding: .55rem .6rem; font-size: 13px; }
.table-sm td { padding: .5rem .6rem; font-size: 13.5px; }
.table > :not(caption) > * > * { border-color: #ecf0f4; }
.table-bordered > :not(caption) > * > * { border-color: #e3e7ec; }
.table-light, .table thead.table-light th { --bs-table-bg: #f5f7fa; }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: #f5f7ff; }
.table.bg-white { border-radius: 10px; overflow: hidden; box-shadow: var(--app-card-shadow); }
.card .table.bg-white { box-shadow: none; }

/* ---------- alert ---------- */
.alert { border: 0; border-radius: 8px; box-shadow: var(--app-card-shadow); }

/* ---------- tab (gaya customtab DeskApp) ---------- */
.nav-tabs { border-bottom: 1px solid #e3e7ec; }
.nav-tabs .nav-link { color: #181f48; border: 0; border-bottom: 2px solid transparent; font-weight: 500; }
.nav-tabs .nav-link:hover { color: #1b00ff; border-color: transparent; }
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { color: #1b00ff; background: transparent; border: 0; border-bottom: 2px solid #1b00ff; }
.tab-content.border { border: 0 !important; border-radius: 0 0 10px 10px; box-shadow: var(--app-card-shadow); }

/* ---------- dropdown ---------- */
.dropdown-menu { border: 0; border-radius: 10px; box-shadow: 0 0 28px rgba(0, 0, 0, .12); padding: .35rem 0; }
.dropdown-item { font-size: 14px; padding: .5rem 1.1rem; }
.dropdown-item i { margin-right: .5rem; }

/* ---------- layout: header & sidebar ---------- */
.header .header-left { display: flex; align-items: center; padding-left: 20px; gap: 12px; }
.header .header-title { font-weight: 600; color: #1b3133; font-size: 16px; }
.header .header-date { color: #8c9094; font-size: 13px; }
.header .header-right { display: flex; align-items: center; padding-right: 20px; gap: 6px; }
.header .user-info-dropdown .dropdown-toggle { color: #1b3133; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.header .user-info-dropdown .dropdown-toggle::after { display: none; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: #1b00ff; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.user-name small { display: block; color: #8c9094; font-size: 12px; font-weight: 400; }

.left-side-bar .brand-logo a.brand-text { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 0 15px; height: 100%; }
.brand-text .brand-logo-img { width: 44px; height: 44px; border-radius: 50%; background: #fff; padding: 2px; box-shadow: 0 0 0 2px rgba(201, 162, 77, .55); flex-shrink: 0; }
.brand-text .brand-mark { width: 38px; height: 38px; border-radius: 10px; background: #1b00ff; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.brand-text .brand-name { font-weight: 700; font-size: 16px; line-height: 1.1; }
.brand-text .brand-name small { display: block; font-weight: 400; font-size: 11.5px; color: rgba(255, 255, 255, .6); }
.sidebar-menu .menu-heading { color: rgba(255, 255, 255, .4); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 16px 15px 6px; font-weight: 600; }
.sidebar-menu .submenu li a.active { color: #fff; font-weight: 600; }
.sidebar-menu .dropdown-toggle { text-decoration: none; }
.sidebar-menu a { text-decoration: none; }
.sidebar-menu .submenu.open { display: block; }
/* menu bisa di-scroll bila lebih panjang dari layar (plugin mCustomScrollbar DeskApp tidak dipakai) */
.left-side-bar .menu-block { height: calc(100vh - 70px); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; padding-bottom: 24px; }
.left-side-bar .menu-block::-webkit-scrollbar { width: 6px; }
.left-side-bar .menu-block::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .25); border-radius: 3px; }
.left-side-bar .menu-block::-webkit-scrollbar-track { background: transparent; }

.main-container .page-content { min-height: calc(100vh - 160px); }

/* DeskApp menyembunyikan sidebar di bawah 1300px — terlalu agresif untuk laptop 1280/1366.
   Sidebar tetap tampil sejak 992px; di bawahnya baru memakai tombol menu. */
@media (min-width: 992px) and (max-width: 1300px) {
    .left-side-bar, .left-side-bar .brand-logo { width: 250px; left: 0; }
    .left-side-bar .close-sidebar { display: none; }
    .header { width: calc(100% - 250px); position: fixed; }
    .header-left .menu-icon { display: none !important; }
    .main-container { padding-left: 270px; padding-right: 20px; padding-top: 80px; }
}
@media (max-width: 1024px) {
    .header-left { width: auto; flex: 1; min-width: 0; }
    .header-right { width: auto; }
    .header .header-title, .header .header-date { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 991.98px) {
    .header { position: fixed; width: 100%; }
    .main-container { padding-top: 80px; padding-left: 12px; padding-right: 12px; }
    .header .header-date { display: none; }
}
.footer-wrap { color: #8c9094; font-size: 13px; }

/* tombol simpan "sticky" di form panjang ikut menyesuaikan latar */
.irdo-savebar, .rj-savebar { background: #ecf0f4 !important; }

/* ---------- widget dashboard ---------- */
.card-box .h5 { font-size: 17px; font-weight: 600; }
.card-link-sm { font-size: 13px; font-weight: 500; color: #1b00ff; text-decoration: none; white-space: nowrap; }
.card-link-sm:hover { text-decoration: underline; }
.card-box-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.table.nowrap th, .table.nowrap td { white-space: nowrap; }
.widget-style3 .widget-icon .icon { font-size: 34px; }
.stat-card { padding: 20px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: #1b3133; line-height: 1.2; }
.stat-card .stat-label { font-size: 14px; color: #8c9094; font-weight: 500; }
.avatar-initial { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #265ed7; background: #e7ebf5; flex-shrink: 0; }
.quick-card { transition: transform .2s ease, box-shadow .2s ease; text-decoration: none; }
.quick-card:hover { transform: translateY(-3px); box-shadow: 0 6px 28px rgba(0, 0, 0, .14); }
.quick-card .quick-icon { font-size: 54px; line-height: 1; }

/* ---------- cetak: tanpa header/sidebar ---------- */
@media print {
    .header, .left-side-bar, .mobile-menu-overlay, .footer-wrap, .no-print, .queue-toast-wrap { display: none !important; }
    .main-container { padding: 0 !important; }
    body { background: #fff !important; }
    .card, .table.bg-white, .alert { box-shadow: none !important; }
}

/* ---------- antrian ---------- */
.queue-number { font-weight: 800; font-size: 15px; letter-spacing: .02em; color: #1b3133; font-variant-numeric: tabular-nums; }
.queue-calls { font-size: 11px; padding: .25em .5em; }
.queue-station { font-weight: 600; font-size: 11.5px; }
tr.queue-called > td { background: #fffbe6 !important; transition: background .4s; }
.btn-forward { --fw: #1b00ff; color: var(--fw); border: 1px solid color-mix(in srgb, var(--fw) 45%, transparent); background: color-mix(in srgb, var(--fw) 7%, #fff); font-size: 12.5px; padding: .25rem .6rem; }
.btn-forward:hover { background: var(--fw); color: #fff; border-color: var(--fw); }
[data-queue-call].calling { opacity: .6; pointer-events: none; }
.action-dropdown .dropdown-toggle::after { margin-left: .4em; }
.action-dropdown .dropdown-menu { min-width: 210px; }
.action-dropdown .dropdown-item { display: flex; align-items: center; gap: .5rem; }
.action-dropdown .dropdown-item i { width: 18px; text-align: center; margin-right: 0; }
.action-dropdown .dropdown-item.text-warning-emphasis:hover { background: #fff8e1; }
.queue-toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.queue-toast { min-width: 260px; background: #fff; border-radius: 12px; padding: 14px 18px; box-shadow: 0 12px 34px rgba(0, 0, 0, .18); border-left: 5px solid #1b00ff; animation: qtIn .25s ease-out; transition: opacity .5s, transform .5s; }
.queue-toast-success { border-left-color: #16834a; }
.queue-toast-error { border-left-color: #dc3545; color: #a3212f; }
.queue-toast.hide { opacity: 0; transform: translateY(10px); }
@keyframes qtIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- formulir pasien RM 1 ---------- */
.pf-section { font-weight: 700; font-size: 13.5px; color: #1b00ff; border-bottom: 1px solid #e6e8f0; padding-bottom: .35rem; margin: 1.25rem 0 .6rem; }
.patient-form > .pf-section:first-of-type { margin-top: .25rem; }
.patient-form .form-label { color: #4a5161; font-weight: 600; }
.patient-form .form-check-inline { margin-right: .9rem; }
.pf-nik-info { min-height: 1.1em; }
.pf-address-preview { color: #1b3133; font-weight: 500; }
.patient-card { border-left: 4px solid #1b00ff; background: #f6f5ff; border-radius: 10px; padding: .85rem 1rem; }
.patient-card dt { font-weight: 600; color: #6c757d; font-size: 12px; }
.patient-card dd { margin-bottom: .35rem; }
.patient-results .list-group-item { cursor: pointer; }
.dl-rm1 dt { color: #6c757d; font-weight: 600; font-size: 12.5px; }
.dl-rm1 dd { margin-bottom: .55rem; }
