/* ==========================================================================
   1. VARIABLES & THEMING (Pilihan Warna & Fondasi Visual)
   ========================================================================== */
:root {
  /* Main Colors */
  --primary: #0d9488;          /* Hijau Teal/Emerald Medis */
  --primary-hover: #0f766e;
  --primary-light: #f0fdf4;    /* Hijau sangat muda untuk background card/badge */

  --secondary: #64748b;        /* Muted Gray untuk teks sekunder */
  --secondary-light: #f8fafc;

  /* Status Colors */
  --warning: #f59e0b;          /* Kuning Alert/Pending */
  --warning-light: #fffbeb;
  --success: #10b981;          /* Hijau Aktif/Approved */
  --danger: #ef4444;           /* Merah Error/Dibatalkan */
  --danger-light: #fef2f2;
  --info: #0284c7;             /* Biru Informasi */
  --info-light: #f0f9ff;

  /* Neutrals & Surfaces */
  --bg-body: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Shadows & Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}

/* ==========================================================================
   2. BASE RESET
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   3. LAYOUT & GRID SYSTEM
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* Grid Generator */
.grid {
  display: grid;
  gap: 1.5rem;
}
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

@media (max-width: 992px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-cols-4, .grid-cols-2 { grid-template-columns: 1fr; }
}

/* ==========================================================================
   4. COMPONENTS (Card, Alert, Badge, Button, Table, Form)
   ========================================================================== */

/* --- CARDS --- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  text-decoration: none;
}

.btn-warning {
  background-color: var(--warning);
  color: #ffffff;
}
.btn-warning:hover {
  opacity: 0.9;
  color: #ffffff;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: var(--secondary-light);
  text-decoration: none;
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.775rem;
}

/* --- ALERTS --- */
.alert {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}
.alert-warning {
  background-color: var(--warning-light);
  border: 1px solid #fde68a;
  color: #92400e;
}
.alert-danger {
  background-color: var(--danger-light);
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* --- BADGES --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}
.badge-warning { background: var(--warning-light); color: #b45309; }
.badge-success { background: var(--primary-light); color: var(--primary-hover); }
.badge-secondary { background: var(--secondary-light); color: var(--secondary); border: 1px solid var(--border); }

/* --- TABLES --- */
.table-container {
  width: 100%;
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}
.table th {
  background-color: var(--secondary-light);
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.75rem 1rem;
  text-transform: uppercase;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background-color: #fafafa; }

/* --- FORMS & INPUTS --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}
.form-control {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  background-color: #ffffff;
  transition: border-color 0.2s;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.form-control.is-invalid {
  border-color: var(--danger);
}
.invalid-feedback {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* --- CUSTOM INPUT WITH ICON (PERBAIKAN UTAMA) --- */
.input-group-custom {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  padding: 0 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* Border berubah saat diklik / diisi */
.input-group-custom:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.input-group-custom i {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.input-group-custom .form-control {
  border: none !important;
  box-shadow: none !important;
  padding: 0.65rem 0.25rem !important;
  background: transparent !important;
  width: 100%;
}

.input-group-custom.is-invalid {
  border-color: var(--danger);
}

/* --- CUSTOM SWITCH --- */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: var(--radius-full);
}
.slider:before {
  position: absolute; content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); }
input:disabled + .slider { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   5. UTILITIES
   ========================================================================== */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 0.85rem; }
.fw-bold { font-weight: 700; }
.avatar { border-radius: 50%; object-fit: cover; }
.icon-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-end { text-align: right; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.block { display: block; }
