/* ================================================================
   eSantri — Global Design System (Clean Emerald White Theme)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;600;700;800&display=swap');

/* ----------------------------------------------------------------
   CSS Variables / Tokens — Light Emerald Premium
   ---------------------------------------------------------------- */
:root {
  /* Colors — Clean Emerald White */
  --bg-base:         #cbd5e1;
  --bg-surface:      #ffffff;
  --bg-card:         #ffffff;
  --bg-card-hover:   #f1f5f9;
  --border:          #e2e8f0;
  --border-focus:    #059669;

  /* Brand — Emerald Green */
  --primary:         #059669;
  --primary-light:   #10b981;
  --primary-dark:    #047857;
  --primary-glow:    rgba(5, 150, 105, 0.18);
  --secondary:       #047857;
  --secondary-glow:  rgba(4, 120, 87, 0.15);
  --accent:          #f59e0b;
  --danger:          #ef4444;
  --danger-glow:     rgba(239,68,68,0.15);

  /* Text — High Contrast Slate */
  --text-primary:    #0f172a;
  --text-secondary:  #334155;
  --text-muted:      #64748b;
  --text-inverse:    #ffffff;

  /* Gradients */
  --gradient-brand:  linear-gradient(135deg, #059669 0%, #10b981 100%);
  --gradient-green:  linear-gradient(135deg, #10b981 0%, #047857 100%);
  --gradient-red:    linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --gradient-gold:   linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --gradient-surface:linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);

  /* Shadows */
  --shadow-sm:       0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:       0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:       0 8px 32px rgba(0,0,0,0.12);
  --shadow-primary:  0 4px 14px rgba(5,150,105,0.25);
  --shadow-green:    0 4px 14px rgba(16,185,129,0.25);

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

  /* Font */
  --font-sans:  'Inter', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Background mesh pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(16,185,129,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(5,150,105,0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ----------------------------------------------------------------
   Typography
   ---------------------------------------------------------------- */
h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; color: var(--text-primary); }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
h3 { font-size: 1.25rem; }
p  { color: var(--text-secondary); }
a  { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-dark); }

/* ----------------------------------------------------------------
   Layout
   ---------------------------------------------------------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----------------------------------------------------------------
   Card
   ---------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-glass {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* ----------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition-fast);
}
.btn:hover::after { background: rgba(255,255,255,0.12); }
.btn:active::after { background: rgba(0,0,0,0.08); }

.btn-primary {
  background: var(--gradient-brand);
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(5,150,105,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(5,150,105,0.45); transform: translateY(-1px); color: #fff !important; }

.btn-success {
  background: var(--gradient-green);
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(16,185,129,0.35);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(16,185,129,0.45); transform: translateY(-1px); color: #fff !important; }

.btn-danger {
  background: var(--gradient-red);
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(239,68,68,0.3);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(239,68,68,0.45); transform: translateY(-1px); color: #fff !important; }

.btn-batal {
  background: #ef4444;
  color: #ffffff;
  font-weight: 700;
}
.btn-batal:hover {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 14px rgba(239,68,68,0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: #ffffff;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary-dark); background: #f0fdf4; }

.btn-sm { padding: 0.45rem 1rem; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 1rem 2rem; font-size: 1.0625rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ----------------------------------------------------------------
   Forms
   ---------------------------------------------------------------- */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-control-sm {
  height: 36px;
  padding: 0.25rem 0.625rem;
  font-size: 0.85rem;
  line-height: 1.3;
}

.form-control:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder { color: var(--text-muted); }

/* Hilangkan panah up/down pada input type="number" */
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button { 
  -webkit-appearance: none;
  appearance: none;
  margin: 0; 
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

select.form-control option { background: #ffffff; color: var(--text-primary); }

.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { color: var(--danger); font-size: 0.8125rem; margin-top: 0.35rem; }

/* Input with icon */
.input-group { position: relative; }
.input-group .form-control { padding-left: 2.75rem; }
.input-group .input-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1rem;
}

/* ----------------------------------------------------------------
   Tables
   ---------------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  background: #f8fafc;
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background var(--transition-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

tbody td {
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  vertical-align: middle;
}

/* ----------------------------------------------------------------
   Badges
   ---------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-green  { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-red    { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-blue   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-gold   { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-gray   { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* ----------------------------------------------------------------
   Alerts / Toast
   ---------------------------------------------------------------- */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; }

/* ----------------------------------------------------------------
   Modal
   ---------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
  color: var(--text-primary);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-close {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
  font-size: 1.1rem;
}
.modal-close:hover { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

/* ----------------------------------------------------------------
   Loading Spinner
   ---------------------------------------------------------------- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(5,150,105,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------
   Stat Cards
   ---------------------------------------------------------------- */
.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-value { font-size: 1.625rem; font-weight: 800; font-family: var(--font-display); line-height: 1.1; color: var(--text-primary); }
.stat-label { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ----------------------------------------------------------------
   Utility Classes
   ---------------------------------------------------------------- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-green  { color: #059669; }
.text-red    { color: #dc2626; }
.text-blue   { color: #2563eb; }
.text-gold   { color: #d97706; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.font-bold   { font-weight: 700; }
.font-mono   { font-family: 'Courier New', monospace; }

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-gap-1  { gap: 0.5rem; }
.flex-gap-2  { gap: 1rem; }
.flex-wrap   { flex-wrap: wrap; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden { display: none !important; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ----------------------------------------------------------------
   Scrollbar
   ---------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ----------------------------------------------------------------
   Animations
   ---------------------------------------------------------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-fadeInUp { animation: fadeInUp 0.4s ease forwards; }
.animate-fadeIn   { animation: fadeIn 0.3s ease forwards; }

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
  .container { padding: 0 1rem; }
  .card { padding: 1.25rem; }
  table { font-size: 0.82rem; }
  thead th, tbody td { padding: 0.7rem 0.75rem; }
  .stat-value { font-size: 1.375rem; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  .btn { padding: 0.65rem 1.25rem; }
  .btn-lg { padding: 0.875rem 1.5rem; font-size: 1rem; }
}
