/* ==========================================================================
   SIJADOP - RSUD Ploso
   Tema: Cokelat hangat & Krem | Mobile-first
   ========================================================================== */

:root {
  --coklat-900: #3e2723;
  --coklat-800: #4e342e;
  --coklat-700: #5d4037;
  --coklat-600: #6d4c41;
  --coklat-500: #8d6e63;
  --coklat-400: #a1887f;
  --coklat-300: #bcaaa4;
  --coklat-200: #d7ccc8;

  --krem-100: #fdf8f2;
  --krem-200: #f7ede1;
  --krem-300: #f0e2d1;
  --krem-400: #e8d5bd;

  --aksen-oranye: #c8792a;
  --aksen-oranye-terang: #e29347;
  --aksen-hijau: #4c7a51;
  --aksen-hijau-terang: #e5f0e3;
  --aksen-merah: #a3423a;
  --aksen-merah-terang: #f6e2df;
  --aksen-kuning: #b8860b;
  --aksen-kuning-terang: #f5ecd7;

  --teks-utama: #362420;
  --teks-muted: #7d6a63;
  --border-color: #e3d5c8;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(62, 39, 35, 0.08);
  --shadow-md: 0 4px 16px rgba(62, 39, 35, 0.10);
  --shadow-lg: 0 12px 32px rgba(62, 39, 35, 0.16);

  --font-sans: 'Segoe UI', 'Poppins', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--krem-200);
  color: var(--teks-utama);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: var(--aksen-oranye-terang); color: #fff; }

/* Scrollbar halus */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--krem-200); }
::-webkit-scrollbar-thumb { background: var(--coklat-300); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--coklat-400); }

/* ==========================================================================
   Layout dasar
   ========================================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-wrap {
  padding: 20px 16px 90px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

@media (min-width: 768px) {
  .content-wrap { padding: 28px 32px 40px; }
}

/* ==========================================================================
   Sidebar (desktop) & Bottom Nav (mobile)
   ========================================================================== */

.sidebar {
  display: none;
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--coklat-800), var(--coklat-900));
  color: var(--krem-100);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

@media (min-width: 992px) {
  .sidebar { display: flex; flex-direction: column; }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 18px;
}

.sidebar-brand img { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 10px; padding: 4px; }

.sidebar-brand .brand-text { line-height: 1.25; }
.sidebar-brand .brand-text strong { display: block; font-size: 15px; letter-spacing: 0.3px; }
.sidebar-brand .brand-text span { display: block; font-size: 11px; color: var(--coklat-200); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--krem-200);
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a.active { background: var(--aksen-oranye); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 12px;
  color: var(--coklat-200);
}

/* Bottom nav mobile */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--coklat-800);
  display: flex;
  justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
}

@media (min-width: 992px) {
  .bottom-nav { display: none; }
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--coklat-200);
  font-size: 10.5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  flex: 1;
  max-width: 90px;
}

.bottom-nav a svg { width: 20px; height: 20px; }
.bottom-nav a.active { color: #fff; background: var(--aksen-oranye); }

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--krem-100);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

@media (min-width: 992px) {
  .topbar { padding: 16px 32px; }
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand img { width: 34px; height: 34px; }
.topbar-brand strong { font-size: 15px; color: var(--coklat-800); }

@media (min-width: 992px) {
  .topbar-brand { display: none; }
}

.topbar-title {
  display: none;
  font-size: 18px;
  font-weight: 700;
  color: var(--coklat-800);
}

@media (min-width: 992px) {
  .topbar-title { display: block; }
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.topbar-user .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--aksen-oranye);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.topbar-user .info { display: none; text-align: right; }
@media (min-width: 640px) { .topbar-user .info { display: block; } }
.topbar-user .info strong { display: block; color: var(--coklat-800); font-size: 13px; }
.topbar-user .info span { color: var(--teks-muted); font-size: 11px; }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--aksen-merah);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.btn-logout:hover { background: var(--aksen-merah-terang); }

/* ==========================================================================
   Kartu & komponen umum
   ========================================================================== */

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.card-body { padding: 18px; }
@media (min-width: 768px) { .card-body { padding: 22px; } }

.card-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.card-header h2, .card-header h3 { margin: 0; font-size: 16px; color: var(--coklat-800); }

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 20px;
  color: var(--coklat-800);
  margin: 0 0 4px;
}
.page-header p { margin: 0; color: var(--teks-muted); font-size: 13px; }

/* Grid statistik */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card .stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.stat-card .stat-icon svg { width: 20px; height: 20px; }

.stat-card .stat-value { font-size: 24px; font-weight: 800; color: var(--coklat-900); line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--teks-muted); margin-top: 6px; }

.stat-card.warna-oranye .stat-icon { background: #fbe8d3; color: var(--aksen-oranye); }
.stat-card.warna-hijau .stat-icon { background: var(--aksen-hijau-terang); color: var(--aksen-hijau); }
.stat-card.warna-kuning .stat-icon { background: var(--aksen-kuning-terang); color: var(--aksen-kuning); }
.stat-card.warna-merah .stat-icon { background: var(--aksen-merah-terang); color: var(--aksen-merah); }

/* ==========================================================================
   Tombol
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--aksen-oranye); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #b3691f; }

.btn-secondary { background: var(--krem-300); color: var(--coklat-800); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--krem-400); }

.btn-outline { background: transparent; color: var(--coklat-700); border-color: var(--coklat-300); }
.btn-outline:hover { background: var(--krem-200); }

.btn-success { background: var(--aksen-hijau); color: #fff; }
.btn-success:hover { background: #3f6743; }

.btn-danger { background: var(--aksen-merah); color: #fff; }
.btn-danger:hover { background: #8a352e; }

.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ==========================================================================
   Form
   ========================================================================== */

.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr; gap: 16px; }

@media (min-width: 640px) {
  .form-row.cols-2 { grid-template-columns: 1fr 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--coklat-700);
  margin-bottom: 6px;
}
label .req { color: var(--aksen-merah); }

.form-control, select.form-control, textarea.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--krem-100);
  color: var(--teks-utama);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--aksen-oranye);
  box-shadow: 0 0 0 3px rgba(200, 121, 42, 0.15);
  background: #fff;
}

textarea.form-control { resize: vertical; min-height: 70px; }
.form-hint { font-size: 11.5px; color: var(--teks-muted); margin-top: 5px; }

.input-icon-wrap { position: relative; }
.input-icon-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--teks-muted); pointer-events: none;
}
.input-icon-wrap .form-control { padding-left: 36px; }

fieldset { border: 1px dashed var(--border-color); border-radius: var(--radius-md); padding: 14px 16px 4px; margin: 0 0 18px; }
fieldset legend { font-size: 12.5px; font-weight: 700; color: var(--aksen-oranye); padding: 0 8px; }

/* ==========================================================================
   Badge & tag
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-success { background: var(--aksen-hijau-terang); color: var(--aksen-hijau); }
.badge-danger { background: var(--aksen-merah-terang); color: var(--aksen-merah); }
.badge-warning { background: var(--aksen-kuning-terang); color: var(--aksen-kuning); }
.badge-secondary { background: var(--krem-300); color: var(--coklat-600); }

.chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--krem-300);
  color: var(--coklat-700);
  font-size: 11px;
  font-weight: 600;
}

/* ==========================================================================
   Tabel (desktop) & Kartu data (mobile)
   ========================================================================== */

.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 900px;
}

.data-table thead th {
  background: var(--coklat-700);
  color: #fff;
  text-align: left;
  padding: 11px 12px;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.data-table thead th:first-child { border-top-left-radius: var(--radius-sm); }
.data-table thead th:last-child { border-top-right-radius: var(--radius-sm); }

.data-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--teks-utama);
  vertical-align: top;
}

.data-table tbody tr:hover { background: var(--krem-200); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .col-aksi { white-space: nowrap; }
.data-table .col-aksi .btn { margin-right: 4px; }

.text-muted { color: var(--teks-muted); }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }

/* Daftar kartu generik (dipakai di dashboard, tampil di semua ukuran layar) */
.card-list { display: flex; flex-direction: column; gap: 12px; }

/* Kartu data untuk mobile (list view pengganti tabel data utama) */
.mobile-cards { display: flex; flex-direction: column; gap: 12px; }

@media (min-width: 992px) {
  .mobile-cards { display: none; }
  .table-wrap { display: block; }
}
@media (max-width: 991.98px) {
  .table-wrap { display: none; }
}

.jadwal-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--aksen-oranye);
}

.jadwal-card .jc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.jadwal-card .jc-nama { font-size: 15px; font-weight: 700; color: var(--coklat-900); }
.jadwal-card .jc-meta { font-size: 12px; color: var(--teks-muted); margin-top: 2px; }

.jadwal-card .jc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12.5px;
  margin: 10px 0;
}
.jadwal-card .jc-grid div span { display: block; color: var(--teks-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.3px; }

.jadwal-card .jc-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}
.jadwal-card .jc-actions .btn { flex: 1; }

/* ==========================================================================
   Filter bar
   ========================================================================== */

.filter-bar {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

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

@media (min-width: 768px) {
  .filter-grid { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; }
}

.filter-actions { display: flex; gap: 8px; }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
}
.pagination a, .pagination span {
  min-width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--coklat-700);
  background: #fff;
}
.pagination a:hover { background: var(--krem-300); }
.pagination .active { background: var(--aksen-oranye); color: #fff; border-color: var(--aksen-oranye); }
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ==========================================================================
   Alert
   ========================================================================== */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--aksen-hijau-terang); color: #2f5233; border-color: #c3ddc0; }
.alert-error { background: var(--aksen-merah-terang); color: #7a2e28; border-color: #e6c3bf; }
.alert-info { background: #eaf2f8; color: #2c5f7a; border-color: #cfe3ee; }

/* ==========================================================================
   Modal (konfirmasi hapus)
   ========================================================================== */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(62,39,35,0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 400px;
  width: 100%;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.modal-box .modal-icon {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--aksen-merah-terang); color: var(--aksen-merah);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.modal-box h3 { margin: 0 0 8px; color: var(--coklat-800); font-size: 16px; }
.modal-box p { margin: 0 0 18px; color: var(--teks-muted); font-size: 13.5px; }
.modal-box .modal-actions { display: flex; gap: 10px; }
.modal-box .modal-actions .btn { flex: 1; }

/* ==========================================================================
   Halaman Login
   ========================================================================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--coklat-900) 0%, var(--coklat-700) 45%, var(--aksen-oranye) 130%);
  padding: 20px;
}

.login-box {
  background: var(--krem-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 32px 28px;
}

.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand img { width: 68px; height: 68px; margin: 0 auto 12px; }
.login-brand h1 { font-size: 19px; color: var(--coklat-800); margin: 0 0 4px; }
.login-brand p { font-size: 12.5px; color: var(--teks-muted); margin: 0; }

.login-footer-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--teks-muted);
  margin-top: 18px;
}

.demo-accounts {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--krem-300);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  color: var(--coklat-700);
  line-height: 1.6;
}
.demo-accounts strong { color: var(--coklat-800); }

/* ==========================================================================
   Print styles (laporan cetak)
   ========================================================================== */

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .content-wrap { padding: 0; max-width: 100%; }
  table.data-table { min-width: 0; font-size: 11px; }
  .data-table thead th { background: #eee !important; color: #000 !important; -webkit-print-color-adjust: exact; }
}

.print-header {
  display: none;
}
@media print {
  .print-header {
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 2px solid #333;
    padding-bottom: 12px;
    margin-bottom: 16px;
  }
  .print-header img { width: 55px; height: 55px; }
  .print-header h1 { font-size: 16px; margin: 0; }
  .print-header p { font-size: 11px; margin: 2px 0 0; color: #444; }
}

/* ==========================================================================
   Utilitas
   ========================================================================== */

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--teks-muted);
}
.empty-state svg { width: 56px; height: 56px; color: var(--coklat-300); margin-bottom: 12px; }
.empty-state h3 { color: var(--coklat-700); margin: 0 0 6px; font-size: 15px; }
.empty-state p { margin: 0; font-size: 13px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
}
.detail-item span.label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--teks-muted); margin-bottom: 3px; }
.detail-item div.value { font-size: 14px; color: var(--teks-utama); font-weight: 500; }
