/* ══════════════════════════════════════════════════════════════════
   ANTRIAN THEME — RSJ Sambang Lihum
   Diadaptasi dari referensi desain "Antrian Pasien" (Claude Design):
   Plus Jakarta Sans, kartu putih membulat di atas latar krem-abu,
   aksen teal/mint, baris antrian gelap untuk status "Dipanggil",
   tab pil untuk navigasi, animasi rise/press yang halus.

   Satu sumber gaya dipakai bersama oleh semua halaman di
   application/views/Antrian/*. Setiap halaman masih boleh punya
   <style> lokal untuk layout yang unik, tapi token & komponen umum di
   sini supaya semua layar terasa satu produk.
   ══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Latar & teks */
    --bg:            #f4f5f3;
    --white:         #ffffff;
    --text:          #14201e;
    --text-muted:    #65716d;
    --text-muted-2:  #68746f;
    --text-faint:    #7d8884;
    --border:        #e4e7e3;
    --border-soft:   #e9ebe7;
    --surface:       #f2f3f1;

    /* Aksen teal/mint */
    --teal:          #0f9b8e;
    --teal-dark:     #0b6a61;
    --teal-link:     #0f6f6a;
    --teal-link-hov: #0b514d;
    --mint:          #2fd4bb;
    --teal-soft-bg:  #e8f5f2;

    /* Baris "aktif/dipanggil/terisi" — gelap pekat, bukan merah */
    --deep:          #0f2b2a;
    --idle-bg:       #f2f3f1;
    --idle-dot:      #c3cac6;
    --idle-fg:       #65716d;

    /* Status darurat/terisi tetap butuh warna beda — dipakai seperlunya
       (mis. tempat tidur terisi), tetap dalam nuansa hangat-netral. */
    --warn:          #b3542f;
    --warn-bg:       #fbeee7;
    --warn-border:   #eccdb9;

    --radius-card: 24px;
    --radius-row:  16px;
    --radius-pill: 999px;

    --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
    --space-4: 16px; --space-5: 20px; --space-6: 24px;

    --touch-min: 44px;
}

html { height: 100%; }
body {
    min-height: 100%;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* ══════════════════════════════════════
   PAGE SHELL
   ══════════════════════════════════════ */
.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-4) 32px;
    max-width: 1240px;
    margin: 0 auto;
    width: 100%;
}

/* ══════════════════════════════════════
   HEADER — wordmark + jam live (dot berdenyut)
   ══════════════════════════════════════ */
.hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: 4px 2px 2px;
}
.hdr-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hdr-sub {
    font-size: 11.5px; font-weight: 600; letter-spacing: .15em;
    text-transform: uppercase; color: var(--text-muted);
}
.hdr-title { font-size: clamp(15px, 3vw, 18px); font-weight: 700; letter-spacing: -.01em; }
.hdr-right {
    display: flex; align-items: center; gap: 7px;
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius-pill); padding: 7px 12px 7px 10px;
    flex-shrink: 0;
}
.hdr-clock {
    font-size: 12.5px; font-weight: 600; color: #4a5754;
    font-variant-numeric: tabular-nums;
}
.hdr-date { font-size: 11px; color: var(--text-muted); }
.live-dot {
    width: 6px; height: 6px; border-radius: var(--radius-pill);
    background: var(--teal); flex-shrink: 0;
    animation: breathe 2.4s ease-in-out infinite;
}

/* ══════════════════════════════════════
   NAV — pil navigasi antar layar (link sungguhan, bukan tab JS,
   tapi tampil identik dengan segmented control referensi)
   ══════════════════════════════════════ */
.nav-bar {
    display: flex; gap: 6px;
    background: #eceee9; border-radius: var(--radius-pill);
    padding: 4px; max-width: 640px; flex-wrap: wrap;
}
.nav-btn {
    flex: 1; min-width: 96px; min-height: var(--touch-min);
    display: flex; align-items: center; justify-content: center; gap: 6px;
    border: none; cursor: pointer; border-radius: var(--radius-pill);
    padding: 10px 12px; font: inherit; font-size: 13px; font-weight: 600;
    background: transparent; color: var(--text-faint);
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active {
    background: var(--white); color: var(--text);
    box-shadow: 0 1px 2px rgba(20,32,30,.08);
}
.nav-btn-icon { display: inline-flex; flex-shrink: 0; }
.nav-btn-icon svg { width: 1em; height: 1em; }
.nav-btn-text { line-height: 1.2; }

/* ══════════════════════════════════════
   SECTION LABEL ROW
   ══════════════════════════════════════ */
.section-row {
    display: flex; align-items: baseline; justify-content: space-between;
    flex-wrap: wrap; gap: 6px;
    padding: 4px 6px 4px;
}
.section-label {
    font-size: 12px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: var(--text-muted);
}
.section-meta { font-size: 12.5px; font-weight: 500; color: var(--text-muted-2); }

/* ══════════════════════════════════════
   CARD — kartu klinik/panel putih membulat
   ══════════════════════════════════════ */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 18px 16px 16px;
    display: flex; flex-direction: column; gap: 14px;
}
.card-hdr {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 14px; padding: 0 2px;
}
.card-name { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.card-meta { font-size: 12.5px; font-weight: 500; color: var(--text-muted); }

/* Pil status kartu: idle (tutup/kosong) vs aktif (menunggu/terisi) */
.pill {
    flex: none; display: flex; align-items: center; gap: 6px;
    border-radius: var(--radius-pill); padding: 6px 11px;
}
.pill-dot { width: 6px; height: 6px; border-radius: var(--radius-pill); }
.pill-text { font-size: 12px; font-weight: 600; }
.pill.idle   { background: var(--idle-bg); }
.pill.idle   .pill-dot { background: var(--idle-dot); }
.pill.idle   .pill-text { color: var(--idle-fg); }
.pill.active { background: var(--teal-soft-bg); }
.pill.active .pill-dot { background: var(--teal); }
.pill.active .pill-text { color: var(--teal-dark); }
.pill.warn   { background: var(--warn-bg); }
.pill.warn   .pill-dot { background: var(--warn); }
.pill.warn   .pill-text { color: var(--warn); }

/* Nama dokter/loket dalam kartu */
.group-name {
    display: flex; align-items: center; gap: 9px; padding: 0 2px;
}
.group-dot { width: 5px; height: 5px; border-radius: var(--radius-pill); background: var(--teal); flex-shrink: 0; }
.group-label {
    font-size: 13px; font-weight: 700; letter-spacing: .01em; color: var(--deep);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ══════════════════════════════════════
   QUEUE ROW — nomor besar + NORM + status
   ══════════════════════════════════════ */
.q-row {
    display: flex; align-items: center; gap: 14px;
    border: 1px solid var(--border-soft); background: var(--white);
    border-radius: var(--radius-row); padding: 12px 16px;
    transition: transform .15s ease;
}
.q-row:hover { transform: translateX(2px); }
.q-num {
    flex: none; min-width: 46px; font-size: 30px; font-weight: 800;
    letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums;
    color: var(--text);
}
.q-rule { width: 1px; align-self: stretch; background: var(--border-soft); }
.q-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.q-label { font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--text-muted-2); }
.q-value {
    font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1;
    font-variant-numeric: tabular-nums; color: var(--text);
}
.q-status { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }

/* Baris "sedang dilayani/dipanggil" — gelap pekat */
.q-row.is-active {
    background: var(--deep); border-color: var(--deep);
}
.q-row.is-active .q-num,
.q-row.is-active .q-value { color: var(--white); }
.q-row.is-active .q-rule { background: rgba(255,255,255,.2); }
.q-row.is-active .q-label { color: rgba(255,255,255,.55); }
.q-row.is-active .q-status { color: var(--mint); }

/* ══════════════════════════════════════
   GRID — kartu klinik menyesuaikan lebar layar
   ══════════════════════════════════════ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    align-items: start;
}

/* ══════════════════════════════════════
   EMPTY / LOADING / ERROR
   ══════════════════════════════════════ */
.empty-state, .error-state, .loading-state {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: var(--space-2); color: var(--text-muted); font-size: 13px; text-align: center;
    padding: 24px 16px 8px;
}
.error-state { color: var(--warn); }
.empty-icon { opacity: .45; display: inline-flex; }
.empty-icon svg { width: 1.8rem; height: 1.8rem; }
.spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--teal);
    border-radius: var(--radius-pill);
    animation: spin 1s linear infinite;
}

/* ══════════════════════════════════════
   FOOTER NOTE
   ══════════════════════════════════════ */
.footnote {
    text-align: center; font-size: 12.5px; font-weight: 500; color: var(--text-muted-2);
    padding: 10px 24px 0; line-height: 1.6; max-width: 560px; margin: 0 auto;
}

/* ══════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════ */
@keyframes breathe { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
@keyframes riseIn  { to { opacity: 1; transform: translateY(0); } }
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes ticker  { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

.rise {
    opacity: 0; transform: translateY(10px);
    animation: riseIn 520ms cubic-bezier(0.23,1,0.32,1) forwards;
}
.press { transition: transform 160ms cubic-bezier(0.23,1,0.32,1), background-color .2s ease, color .2s ease, border-color .2s ease; }
.press:active { transform: scale(.985); }

/* ══════════════════════════════════════
   TICKER (dipakai beberapa layar untuk teks berjalan)
   ══════════════════════════════════════ */
.ticker-wrap {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius-pill); overflow: hidden;
    height: 36px; display: flex; align-items: center; flex-shrink: 0;
}
.ticker { display: flex; width: max-content; animation: ticker 22s linear infinite; white-space: nowrap; }
.ticker-text { display: inline-block; padding: 0 60px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }

/* ══════════════════════════════════════
   AKSESIBILITAS
   ══════════════════════════════════════ */
a { color: var(--teal-link); text-decoration: none; }
a:hover { color: var(--teal-link-hov); }
a:focus-visible, button:focus-visible, select:focus-visible,
input:focus-visible, .nav-btn:focus-visible, [tabindex]:focus-visible {
    outline: 2.5px solid var(--teal);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
    .rise { opacity: 1; transform: none; }
    .press:active { transform: none; }
}

/* ══════════════════════════════════════
   RESPONSIVE — HP (≤600px)
   ══════════════════════════════════════ */
@media (max-width: 600px) {
    .shell { padding: var(--space-3) var(--space-3) 24px; gap: var(--space-2); }
    .nav-btn { font-size: 12px; padding: 9px 8px; }
    .card { padding: 14px 12px 12px; border-radius: 18px; }
    .q-num { font-size: 24px; min-width: 38px; }
    .q-value { font-size: 18px; }
    .ticker-wrap { height: 32px; }
    .ticker-text { font-size: 11.5px; padding: 0 40px; }
}
