/* ============================================
   style.css - Global Styles
   Form Biodata Siswa
   ============================================ */

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

/* ---- CSS Variables ---- */
:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #818CF8;
  --secondary: #06B6D4;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --danger-dark: #B91C1C;

  --bg: #0F172A;
  --bg-card: #1E293B;
  --bg-card2: #162032;
  --bg-input: #0F172A;
  --border: #334155;
  --border-light: #475569;

  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --text-dim: #64748B;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --glow: 0 0 20px rgba(79,70,229,0.3);

  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-card); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ---- Typography ---- */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; }
h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); }
h3 { font-size: 1.1rem; }
p { color: var(--text-muted); }

/* ---- Page Header ---- */
.page-header {
  background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.page-header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.page-header .logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  box-shadow: var(--glow);
  flex-shrink: 0;
}
.page-header .logo-text { font-weight: 700; font-size: 1rem; }
.page-header .logo-sub { font-size: 0.75rem; color: var(--text-muted); }

/* ---- Container ---- */
.container { max-width: 720px; margin: 0 auto; padding: 32px 16px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 32px 16px; }

/* ---- Card ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  transition: var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.card-icon.blue { background: rgba(79,70,229,0.2); }
.card-icon.cyan { background: rgba(6,182,212,0.2); }
.card-icon.green { background: rgba(16,185,129,0.2); }
.card-icon.orange { background: rgba(245,158,11,0.2); }
.card-icon.red { background: rgba(239,68,68,0.2); }

/* ---- Form Elements ---- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-label .badge-locked {
  font-size: 0.7rem;
  background: rgba(245,158,11,0.2);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.3);
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 6px;
  font-weight: 500;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  padding: 12px 16px;
  transition: var(--transition);
  outline: none;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}
.form-input:disabled, .form-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dim); }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
  cursor: pointer;
}
.form-select option { background: var(--bg-card); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 5px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79,70,229,0.5);
}
.btn-secondary {
  background: var(--bg-card2);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--primary-light);
  color: var(--primary-light);
}
.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}
.btn-success:hover:not(:disabled) { transform: translateY(-1px); }
.btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  color: #fff;
}
.btn-danger:hover:not(:disabled) { transform: translateY(-1px); }
.btn-warning {
  background: linear-gradient(135deg, var(--warning), #D97706);
  color: #fff;
}
.btn-sm { padding: 7px 14px; font-size: 0.82rem; border-radius: var(--radius-xs); }
.btn-icon { padding: 8px; border-radius: var(--radius-xs); aspect-ratio: 1; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Alert / Toast ---- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  animation: slideDown 0.3s ease;
}
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6EE7B7; }
.alert-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: #FCA5A5; }
.alert-info    { background: rgba(79,70,229,0.1);  border: 1px solid rgba(79,70,229,0.3);  color: #A5B4FC; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #FCD34D; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Toast Notification ---- */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  pointer-events: all;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--primary); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

/* ---- Table ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  background: var(--bg-card2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(79,70,229,0.05); }
tbody td { padding: 12px 16px; vertical-align: middle; }

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--glow); }
.stat-card .stat-icon { font-size: 1.5rem; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: rgba(16,185,129,0.15); color: #6EE7B7; }
.badge-danger  { background: rgba(239,68,68,0.15);  color: #FCA5A5; }
.badge-primary { background: rgba(79,70,229,0.15);  color: var(--primary-light); }
.badge-warning { background: rgba(245,158,11,0.15); color: #FCD34D; }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card2);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab-btn {
  padding: 9px 18px;
  border-radius: var(--radius-xs);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab-btn.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 16px;
}
.modal-overlay.open { display: grid; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  animation: modalIn 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  padding: 4px;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---- Chip / Tag ---- */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: var(--transition);
}
.chip:hover { border-color: var(--border-light); }
.chip-del {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0;
  transition: var(--transition);
}
.chip-del:hover { color: var(--danger); }

/* ---- Search Bar ---- */
.search-wrap { position: relative; }
.search-wrap .search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.search-wrap .form-input { padding-left: 42px; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; }

/* ---- Loading Spinner ---- */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 32px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Progress bar ---- */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .page-header { padding: 12px 16px; }
  .container, .container-wide { padding: 20px 12px; }
  .card { padding: 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .tabs { padding: 3px; }
  .tab-btn { padding: 8px 12px; font-size: 0.8rem; }
  .modal { padding: 20px; }
  table { font-size: 0.8rem; }
  thead th, tbody td { padding: 10px 12px; }
}

/* ---- Success Screen ---- */
.success-screen {
  text-align: center;
  padding: 48px 24px;
  display: none;
}
.success-screen.show { display: block; }
.success-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--success), #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 20px;
  box-shadow: 0 0 30px rgba(16,185,129,0.4);
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ---- Gradient Text ---- */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Admin Sidebar Layout ---- */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 70px);
}
.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  flex-shrink: 0;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
  width: 100%;
  text-align: left;
}
.sidebar-btn:hover { background: rgba(79,70,229,0.1); color: var(--text); }
.sidebar-btn.active { background: rgba(79,70,229,0.2); color: var(--primary-light); }
.sidebar-btn .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.admin-content { flex: 1; padding: 28px 24px; overflow: auto; }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 0; }
.sidebar-section-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 14px;
  font-weight: 700;
}

@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px;
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .sidebar-btn { padding: 8px 12px; font-size: 0.8rem; }
  .admin-content { padding: 16px 12px; }
}
