/* assets/css/admin.css */

:root {
  --primary:       #3b82f6;
  --primary-dark:  #2563eb;
  --primary-light: #eff6ff;
  --primary-soft:  #dbeafe;
  --secondary:     #64748b;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #06b6d4;

  --sidebar-w:     260px;
  --topbar-h:      64px;

  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --surface2:      #f8fafc;
  --border:        #e2e8f0;
  --border-light:  #f1f5f9;

  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;

  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;
  --radius-xl:     20px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:     0 10px 40px rgba(0,0,0,.12);

  --transition:    0.2s ease;

  --font:          'Plus Jakarta Sans', sans-serif;
}

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,130,246,.35);
}

.brand-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}
.brand-sub {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .8px;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-light);
  padding: 12px 8px 6px;
  margin-top: 4px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.sidebar-nav .nav-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-nav .nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-nav .nav-link.active i {
  color: var(--primary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--info));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-role-admin { color: var(--primary); font-size: 10px; font-weight: 600; }
.badge-role-operator { color: var(--success); font-size: 10px; font-weight: 600; }

.btn-logout {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover { background: #fee2e2; color: var(--danger); }

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ── Main Wrapper ──────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--transition);
}

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
  width: 36px; height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); }

.topbar-breadcrumb { flex: 1; }
.topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Page Content ──────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

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

.card-header-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface2); }

/* ── Stats Cards ───────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all .2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: var(--primary); }
.stat-icon.green  { background: #d1fae5; color: var(--success); }
.stat-icon.yellow { background: #fef3c7; color: var(--warning); }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.cyan   { background: #cffafe; color: var(--info); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-info { flex: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* ── Tables ────────────────────────────────────────────── */
.table {
  font-size: 13.5px;
  --bs-table-bg: transparent;
}

.table thead th {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  padding: 12px 14px;
  white-space: nowrap;
  background: var(--surface2);
}

.table tbody td {
  padding: 11px 14px;
  vertical-align: middle;
  border-color: var(--border-light);
  color: var(--text);
}

.table tbody tr:hover td {
  background: var(--primary-light);
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-primary-soft {
  background: var(--primary-soft);
  color: var(--primary);
  border: none;
  font-weight: 600;
}
.btn-primary-soft:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 6px; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

/* ── Badges ────────────────────────────────────────────── */
.badge {
  font-family: var(--font);
  font-weight: 600;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 99px;
}

/* CF Badges */
.badge-cf {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-cf-0  { background: #f1f5f9; color: #64748b; }
.badge-cf-02 { background: #cffafe; color: #0e7490; }
.badge-cf-04 { background: #dbeafe; color: #1d4ed8; }
.badge-cf-06 { background: #fef3c7; color: #b45309; }
.badge-cf-08 { background: #fed7aa; color: #c2410c; }
.badge-cf-10 { background: #d1fae5; color: #065f46; }

/* ── CF Select Styles ──────────────────────────────────── */
.cf-select { font-weight: 600; }
.cf-select[data-cf="0"]   { background: #f1f5f9; color: #64748b; }
.cf-select[data-cf="0.2"] { background: #cffafe; color: #0e7490; }
.cf-select[data-cf="0.4"] { background: #dbeafe; color: #1d4ed8; }
.cf-select[data-cf="0.6"] { background: #fef3c7; color: #b45309; }
.cf-select[data-cf="0.8"] { background: #fed7aa; color: #c2410c; }
.cf-select[data-cf="1.0"],
.cf-select[data-cf="1"]   { background: #d1fae5; color: #065f46; }

/* ── Forms ─────────────────────────────────────────────── */
.form-control, .form-select {
  font-family: var(--font);
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 14px;
  transition: all var(--transition);
  background: var(--surface);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-text { font-size: 11.5px; color: var(--text-muted); }

/* ── Alerts ────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: none;
  padding: 12px 16px;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger   { background: #fee2e2; color: #991b1b; }
.alert-warning  { background: #fef3c7; color: #92400e; }
.alert-info     { background: #cffafe; color: #164e63; }

/* ── Page Header ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.page-header-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.5px;
}

.page-header-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── DataTables overrides ──────────────────────────────── */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 10px;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
  outline: none;
  padding: 6px 10px;
}

.dt-buttons .btn {
  height: 32px;
  font-size: 12px;
  margin-top: 27px;
  margin-left: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm) !important;
}

.dataTables_info, .dataTables_paginate, .dataTables_length, .dataTables_filter {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 12px;
  padding: 15px;
}

.paginate_button.page-item .page-link {
  border-radius: var(--radius-sm) !important;
  font-size: 12.5px;
  border-color: var(--border);
  color: var(--text-muted);
}

.paginate_button.active .page-link {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

/* ── Progress Bar ──────────────────────────────────────── */
.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--bg);
  overflow: hidden;
}

.progress-bar {
  border-radius: 99px;
  transition: width 1s ease;
}

/* ── Diagnosa Cards ────────────────────────────────────── */
.gejala-check-item {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
  transition: all var(--transition);
}

.gejala-check-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.gejala-check-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Result Card */
.result-card {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 150px; height: 150px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}

.result-card::after {
  content: '';
  position: absolute;
  bottom: -30px; right: 40px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}

.result-persen {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
}

.result-label {
  font-size: 12px;
  opacity: .8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ── Login Page ────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 50%, #fef9c3 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: #fff;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(59,130,246,.35);
}

/* ── Public Diagnosa ───────────────────────────────────── */
.public-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #f0f9ff 0%, #f8fafc 60%, #fff 100%);
}

.public-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.public-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.public-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 16px;
}

.public-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* ── Utilities ─────────────────────────────────────────── */
.text-primary { color: var(--primary) !important; }
.bg-primary-soft { background: var(--primary-soft) !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-extrabold { font-weight: 800 !important; }

.rounded-12 { border-radius: 12px !important; }
.rounded-16 { border-radius: 16px !important; }

.shadow-soft { box-shadow: var(--shadow-sm) !important; }
.shadow-card { box-shadow: var(--shadow) !important; }

/* Spinner overlay */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(3px);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.active { display: block; }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
}

@media (max-width: 575.98px) {
  .stat-card { padding: 16px; }
  .stat-value { font-size: 22px; }
  .result-persen { font-size: 42px; }
  .login-card { padding: 28px 24px; }
}

/* ── MB / MD Badges (tambahan untuk fitur MB & MD) ──────── */
.badge-cf-mb  { background:#dbeafe;color:#1d4ed8;padding:3px 10px;border-radius:99px;font-size:11px;font-weight:700; }
.badge-cf-md  { background:#fee2e2;color:#b91c1c;padding:3px 10px;border-radius:99px;font-size:11px;font-weight:700; }
.badge-cf-neg { background:#fce7f3;color:#9d174d;padding:3px 10px;border-radius:99px;font-size:11px;font-weight:700; }

/* Quick pick buttons */
.btn-xs { padding:3px 8px;font-size:11px;border-radius:6px; }
