/* ================================================
   MAIN CSS — Global Design System
   MTsN 1 Kota Tasikmalaya Upload Berkas App
   ================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Colors */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: rgba(22, 27, 34, 0.8);
  --bg-card-hover: rgba(33, 38, 45, 0.9);

  --accent-cyan: #22d3ee;
  --accent-cyan-dim: rgba(34, 211, 238, 0.15);
  --accent-indigo: #6366f1;
  --accent-indigo-dim: rgba(99, 102, 241, 0.15);
  --accent-emerald: #10b981;
  --accent-emerald-dim: rgba(16, 185, 129, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-dim: rgba(245, 158, 11, 0.15);
  --accent-rose: #f43f5e;
  --accent-rose-dim: rgba(244, 63, 94, 0.15);
  --accent-violet: #8b5cf6;
  --accent-violet-dim: rgba(139, 92, 246, 0.15);

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;

  --border-primary: rgba(48, 54, 61, 0.8);
  --border-glow-cyan: rgba(34, 211, 238, 0.3);

  /* Gradients */
  --grad-main: linear-gradient(135deg, #22d3ee 0%, #6366f1 100%);
  --grad-success: linear-gradient(135deg, #10b981 0%, #22d3ee 100%);
  --grad-danger: linear-gradient(135deg, #f43f5e 0%, #f59e0b 100%);
  --grad-warn: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --border-radius-sm: 8px;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(34, 211, 238, 0.2);
  --shadow-glow-indigo: 0 0 20px rgba(99, 102, 241, 0.2);

  /* Transitions */
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Utility Classes --- */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Status Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.badge-menunggu { background: var(--accent-amber-dim); color: var(--accent-amber); border: 1px solid rgba(245,158,11,0.3); }
.badge-menunggu::before { background: var(--accent-amber); box-shadow: 0 0 6px var(--accent-amber); animation: pulse-dot 2s infinite; }

.badge-disetujui { background: var(--accent-emerald-dim); color: var(--accent-emerald); border: 1px solid rgba(16,185,129,0.3); }
.badge-disetujui::before { background: var(--accent-emerald); }

.badge-ditolak { background: var(--accent-rose-dim); color: var(--accent-rose); border: 1px solid rgba(244,63,94,0.3); }
.badge-ditolak::before { background: var(--accent-rose); }

.badge-absen { background: var(--accent-cyan-dim); color: var(--accent-cyan); border: 1px solid rgba(34,211,238,0.3); }
.badge-lckh { background: var(--accent-violet-dim); color: var(--accent-violet); border: 1px solid rgba(139,92,246,0.3); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* --- Glass Card --- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all var(--transition);
}
.glass-card:hover {
  border-color: rgba(34, 211, 238, 0.2);
  box-shadow: var(--shadow-card);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--border-radius-sm);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--grad-main);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45); }

.btn-success {
  background: var(--grad-success);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.btn-success:hover:not(:disabled) { transform: translateY(-1px); }

.btn-danger {
  background: var(--grad-danger);
  color: #fff;
  box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
}
.btn-danger:hover:not(:disabled) { transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-primary);
}
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); border-color: rgba(34,211,238,0.3); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; border-radius: var(--border-radius-sm); }

/* --- Form Elements --- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  transition: all var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-dim);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control option { background: var(--bg-secondary); }

select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

textarea.form-control { resize: vertical; min-height: 80px; }

/* --- Table --- */
.table-wrapper { overflow-x: auto; border-radius: var(--border-radius); border: 1px solid var(--border-primary); }
table { width: 100%; border-collapse: collapse; }
thead { background: rgba(33,38,45,0.8); }
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}
td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}
tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: rgba(33,38,45,0.5); }
tbody tr:last-child td { border-bottom: none; }

/* --- Stat Cards --- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-main);
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: rgba(34,211,238,0.2); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--border-radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-top: 2px; }
.stat-change { font-size: 11px; font-weight: 600; margin-top: 4px; }
.stat-change.up { color: var(--accent-emerald); }
.stat-change.down { color: var(--accent-rose); }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toast.toast-out { animation: toastOut 0.3s ease forwards; }
.toast-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast-success .toast-icon { background: var(--accent-emerald-dim); color: var(--accent-emerald); }
.toast-error .toast-icon { background: var(--accent-rose-dim); color: var(--accent-rose); }
.toast-info .toast-icon { background: var(--accent-cyan-dim); color: var(--accent-cyan); }
.toast-warn .toast-icon { background: var(--accent-amber-dim); color: var(--accent-amber); }
.toast-msg { font-size: 13px; font-weight: 500; color: var(--text-primary); }

@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none !important; }
.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-box-lg { max-width: 780px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--border-radius-sm);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--accent-rose-dim); color: var(--accent-rose); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-primary); display: flex; gap: 10px; justify-content: flex-end; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.9) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* --- Spinner --- */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state svg { opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* --- Responsive --- */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
}
