/* ===== Design System RBA — token & komponen dasar ===== */

:root {
  /* Color */
  --color-primary: #059669;
  --color-primary-dark: #065F46;
  --color-primary-soft: #ECFDF5;
  --color-bg-app: #F0F8F4;
  --color-bg-surface: #FFFFFF;
  --color-text-primary: #1E1B2E;
  --color-text-secondary: #8B8A99;
  --color-border: #E4EDE8;

  --color-success-bg: #DFF6E9; --color-success-fg: #38C976; --color-success-deep: #047857;
  --color-warning-bg: #FDECD8; --color-warning-fg: #F5A25D; --color-warning-deep: #B45309;
  --color-danger-bg: #FCE4EA;  --color-danger-fg: #EF5DA8;  --color-danger-deep: #BE185D;
  --color-info-bg: #EAF1FE;    --color-info-fg: #3B82F6;    --color-info-deep: #1D4ED8;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* Shadow */
  --shadow-card: 0 4px 16px rgba(5, 150, 105, 0.08);
  --shadow-card-hover: 0 8px 24px rgba(5, 150, 105, 0.14);

  /* Spacing scale (basis 4px) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px;
}

html { scroll-behavior: smooth; }

body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background-color: var(--color-bg-app);
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
}

/* Layout halus tanpa scrollbar untuk carousel mobile */
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* Teks aksen Arab */
.arabic-accent { font-family: "Traditional Arabic", "Scheherazade", serif; }

/* Kotak placeholder thumbnail */
.thumb-placeholder {
  background: linear-gradient(135deg, #059669, #065F46 55%, #0E7490);
}

/* ===== Tipografi ===== */
.h-display { font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; color: var(--color-text-primary); }
@media (min-width: 640px) { .h-display { font-size: 24px; } }

.h-section { font-size: 16px; line-height: 1.4; font-weight: 600; color: var(--color-text-primary); }
@media (min-width: 640px) { .h-section { font-size: 18px; } }

.num-lg { font-size: 28px; line-height: 1.2; font-weight: 700; }
.meta { font-size: 12px; color: var(--color-text-secondary); }
.subtext { font-size: 14px; color: var(--color-text-secondary); }

/* ===== Kartu ===== */
.card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card-pad { padding: 20px; }
.card-hover:hover {
  transform: translateY(-2px);
  border-color: #D3E8DB;
  box-shadow: var(--shadow-card-hover);
}

/* ===== Tombol ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: 10px 20px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 600; line-height: 1.25;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  text-align: center; transition: all .15s ease;
}
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 6px 16px rgba(5, 150, 105, .22); }
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: 0 8px 20px rgba(5, 150, 105, .30); }
.btn-ghost { background: var(--color-bg-surface); color: var(--color-primary-dark); border-color: var(--color-border); }
.btn-ghost:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.btn-soft { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.btn-soft:hover { background: #D8F2E4; }
.btn-danger { background: var(--color-danger-bg); color: var(--color-danger-deep); border-color: #F7C4D5; }
.btn-danger:hover { background: #FAD3DE; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-full); }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Tombol ikon bulat (min 44px untuk touch) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-full);
  color: var(--color-text-secondary); transition: all .15s ease; cursor: pointer;
}
.icon-btn:hover { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.icon-btn svg { width: 22px; height: 22px; }

/* ===== Form ===== */
.label { display: block; font-size: 14px; font-weight: 500; color: var(--color-text-primary); margin-bottom: 6px; }
.input {
  width: 100%; background: #fff;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 10px 14px; font-size: 14px; color: var(--color-text-primary);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--color-text-secondary); }
.input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(5, 150, 105, .12); }
select.input { background-color: #fff; }
textarea.input { line-height: 1.5; }
.input-hint { font-size: 12px; color: var(--color-text-secondary); margin-top: 4px; }

/* ===== Badge ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-full);
  border: 1px solid var(--color-border); font-size: 12px; font-weight: 600;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success-deep); border-color: #BFE9CD; }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-deep); border-color: #F5CFA4; }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger-deep);  border-color: #F6C5D6; }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info-deep);    border-color: #C4DCFC; }
.badge-neutral { background: #F4F6F5; color: var(--color-text-secondary); border-color: var(--color-border); }

/* ===== Progress bar ===== */
.progress { height: 8px; background: var(--color-primary-soft); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-full); transition: width .3s ease; }

/* ===== Link ===== */
.link { color: var(--color-primary-dark); font-weight: 600; }
.link:hover { text-decoration: underline; }
.link-danger { color: var(--color-danger-deep); font-weight: 600; }
.link-danger:hover { text-decoration: underline; }

/* ===== Tabel ringan ===== */
.table-card { background: var(--color-bg-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow-x: auto; }
.table-card table { width: 100%; font-size: 14px; }
.table-card thead th {
  text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600;
  color: var(--color-text-secondary); border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.table-card tbody td { padding: 12px 16px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table-card tbody tr:last-child td { border-bottom: 0; }
.table-card tbody tr { transition: background .12s ease; }
.table-card tbody tr:hover { background: var(--color-primary-soft); }

/* ===== Stat card (dashboard) ===== */
.stat-card {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 20px; border-radius: var(--radius-xl);
  min-width: 15rem; transition: all .15s ease;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-value { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.stat-label { font-size: 12px; font-weight: 500; margin-top: 2px; }

/* ===== Sidebar / navigasi ===== */
.sidenav { display: flex; flex-direction: column; gap: 4px; }
.sidenav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-md);
  font-size: 14px; font-weight: 600; color: var(--color-text-secondary);
  transition: all .15s ease;
}
.sidenav-item:hover { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.sidenav-item.active { background: var(--color-primary); color: #fff; box-shadow: 0 6px 16px rgba(5, 150, 105, .28); }
.sidenav-item svg { width: 22px; height: 22px; flex-shrink: 0; }

/* Bottom nav mobile */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--color-border);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 1024px) { .bottom-nav { display: none; } }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; min-width: 64px; padding: 6px 10px;
  font-size: 11px; font-weight: 600; color: var(--color-text-secondary);
  transition: color .15s ease;
}
.bottom-nav a.active { color: var(--color-primary); }
.bottom-nav svg { width: 22px; height: 22px; }

/* Drawer off-canvas (mobile) */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 45;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  width: min(18rem, 86vw); display: flex; flex-direction: column;
  background: #fff; transform: translateX(-100%); transition: transform .25s ease;
  box-shadow: 2px 0 12px rgba(0, 0, 0, .05);
}
.drawer.open { transform: none; }

/* ===== Flash custom (serasi token) ===== */
.flash { padding: 12px 16px; border-radius: var(--radius-lg); font-size: 14px; border: 1px solid; }
.flash-success { background: var(--color-success-bg); border-color: #BFE9CD; color: var(--color-success-deep); }
.flash-error   { background: var(--color-danger-bg);  border-color: #F6C5D6; color: var(--color-danger-deep); }
.flash-info    { background: var(--color-info-bg);    border-color: #C4DCFC; color: var(--color-info-deep); }