/* ============================================================
   CMS SB Media — style.css
   Modern minimalis, mobile-first. Tanpa framework, tanpa build.
   ============================================================ */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #eef0f3;
  --text: #1a1d21;
  --muted: #6b7280;
  --border: #e3e6ea;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8effe;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --success: #16a34a;
  --success-soft: #e7f6ec;
  --warning: #d97706;
  --warning-soft: #fdf3e3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --topbar-h: 60px;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
small { color: var(--muted); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer; background: var(--accent);
  color: #fff; transition: background .15s ease;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-small { padding: 6px 10px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-muted); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-google { background: #fff; color: var(--text); border-color: var(--border); width: 100%; }
.btn-google:hover { background: var(--surface-muted); }

/* ---------- Layar login ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, #eef2ff 0%, var(--bg) 55%, #e8f6ec 100%);
}
.login-card {
  width: 100%; max-width: 420px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  padding: 32px 28px; text-align: center;
}
.login-card h1 { font-size: 21px; margin: 20px 0 8px; }
.login-sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.login-card .btn { margin-bottom: 10px; }
.login-note { font-size: 12px; color: var(--muted); margin: 14px 0 0; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; }

/* ---------- Shell aplikasi ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .5px;
}
.logo-text { font-size: 15px; font-weight: 600; }
.logo-text strong { color: var(--accent); }

.site-switcher { flex: 1; display: flex; justify-content: center; }
.site-switcher select {
  max-width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-muted);
  font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer;
}

.admin-info { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.admin-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.admin-meta { display: flex; flex-direction: column; line-height: 1.25; }
.admin-meta strong { font-size: 13px; }
.admin-meta small { font-size: 12px; }

.layout { display: flex; flex: 1; min-height: 0; }

/* Sidebar desktop */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 12px 8px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: var(--surface-muted); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-link svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* Konten */
.content { flex: 1; min-width: 0; padding: 24px; max-width: 1100px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin: 4px 0 0; font-size: 14px; }

/* Kartu statistik */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.stat-card .stat-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.stat-card .stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Kartu umum */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 20px;
}
.card h2 { margin-bottom: 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }

/* Tabel responsif */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-muted); }
.row-click { cursor: pointer; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* Badge status */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-gray { background: var(--surface-muted); color: var(--muted); }

/* Daftar */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: none; }
.list .list-body { flex: 1; min-width: 0; }
.list .list-title { font-weight: 600; }
.list .list-meta { font-size: 13px; color: var(--muted); }
.list-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

/* Form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-field label { font-size: 13px; font-weight: 600; }
.form-field input, .form-field select, .form-field textarea {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
  width: 100%;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.form-field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type="search"] {
  flex: 1; min-width: 180px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px;
}
.toolbar select { padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; background: var(--surface); }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px;
  transition: background .2s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
  width: 100%; max-width: 560px; padding: 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-head h2 { margin: 0; }
.modal-body { font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,.25);
  z-index: 200; max-width: calc(100vw - 32px); text-align: center;
}
.toast.error { background: var(--danger); }

/* Info / empty state */
.notice {
  background: var(--accent-soft); border: 1px solid #c7d7fb; color: #1e40af;
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 16px;
}
.notice.warning { background: var(--warning-soft); border-color: #f3d9a4; color: #92400e; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Responsif: HP ---------- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 0 12px; flex-wrap: wrap; height: auto; min-height: var(--topbar-h); padding-top: 8px; padding-bottom: 8px; }
  .site-switcher { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .site-switcher select { width: 100%; }
  .admin-meta { display: none; }
  .layout { flex-direction: column; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto; z-index: 50;
    flex-direction: row; overflow-x: auto; overflow-y: hidden;
    padding: 6px 4px; border-right: none; border-top: 1px solid var(--border);
  }
  .nav-link {
    flex-direction: column; gap: 3px; padding: 6px 10px;
    font-size: 11px; white-space: nowrap; flex-shrink: 0;
  }
  .nav-link svg { width: 20px; height: 20px; }
  .nav-badge { margin-left: 0; position: absolute; margin-top: -18px; margin-left: 34px; }
  .nav-link { position: relative; }
  .content { padding: 16px 14px 92px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 21px; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .list li { flex-wrap: wrap; }
}
