/* ═══════════════════════════════════════════════
   CDT SYSTEM V2 — Global Stylesheet
   Design: Modern, clean, professional
═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #6c63ff;
  --primary-dark:  #5a52e0;
  --primary-light: #ede9ff;
  --success:       #22c55e;
  --success-light: #dcfce7;
  --danger:        #ef4444;
  --danger-light:  #fee2e2;
  --warning:       #f59e0b;
  --gray-50:       #f9fafb;
  --gray-100:      #f3f4f6;
  --gray-200:      #e5e7eb;
  --gray-300:      #d1d5db;
  --gray-400:      #9ca3af;
  --gray-600:      #4b5563;
  --gray-700:      #374151;
  --gray-800:      #1f2937;
  --white:         #ffffff;
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     16px;
  --shadow-sm:     0 1px 4px rgba(0,0,0,.08);
  --shadow:        0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.14);
  --transition:    .2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8edf8 100%);
  min-height: 100vh;
  color: var(--gray-800);
  line-height: 1.6;
}

/* ── Typography ── */
h1, h2, h3 { font-weight: 700; line-height: 1.3; color: var(--gray-800); }
h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
h2 { font-size: clamp(1.1rem, 2.5vw, 1.5rem); }

/* ── Layout ── */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 80px;
}

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  width: 100%;
  max-width: 520px;
}

.card-wide { max-width: 1100px; }

/* ── Form controls ── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--gray-600); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 14.5px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
  color: var(--gray-800);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
  background: var(--white);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(108,99,255,.35); }
.btn-danger  { background: var(--danger);  color: var(--white); }
.btn-danger:hover  { background: #dc2626; }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #16a34a; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-full { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); }

/* ── Tables ── */
.table-wrapper { overflow-x: auto; margin-top: 20px; border-radius: var(--radius); border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: var(--primary);
  color: var(--white);
  padding: 13px 16px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }
tbody tr:nth-child(even) td { background: #fafafa; }
tbody tr:nth-child(even):hover td { background: var(--gray-100); }

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-success { background: var(--success-light); color: #15803d; }
.badge-danger  { background: var(--danger-light);  color: #b91c1c; }
.badge-warning { background: #fef9c3; color: #92400e; }
.badge-info    { background: var(--primary-light); color: var(--primary-dark); }

/* ── Progress bar ── */
.progress-wrap {
  background: var(--gray-200);
  border-radius: 999px;
  overflow: hidden;
  height: 28px;
  margin-top: 16px;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(to right, var(--primary), #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 13px;
  transition: width .4s ease-in-out;
  border-radius: 999px;
}
.progress-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--gray-400);
  font-style: italic;
}

/* ── Modal / Popup ── */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal {
  display: none;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 28px 22px;
  width: 90%;
  max-width: 380px;
  z-index: 1001;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s ease forwards;
}
@keyframes modalIn {
  to { transform: translate(-50%, -50%) scale(1); }
}
.modal.show, .overlay.show { display: block; }
.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-body { font-size: 14px; color: var(--gray-600); line-height: 1.7; }
.modal-footer {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.modal.modal-success .modal-title { color: #15803d; }
.modal.modal-error   .modal-title { color: #b91c1c; }
.modal.modal-success { border-top: 4px solid var(--success); }
.modal.modal-error   { border-top: 4px solid var(--danger); }

/* ── Navbar admin ── */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: 12px;
}
.navbar-brand {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ── Alert banner ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: var(--success-light); color: #15803d; border: 1px solid #86efac; }
.alert-danger  { background: var(--danger-light);  color: #b91c1c; border: 1px solid #fca5a5; }

/* ── Page logo/header ── */
.page-logo {
  text-align: center;
  margin-bottom: 28px;
}
.page-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 14px;
}
.page-logo h1 { font-size: 1.35rem; color: var(--gray-800); }
.page-logo p  { font-size: 13px; color: var(--gray-400); margin-top: 4px; }

/* ── Search bar ── */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-bar input { flex: 1; min-width: 180px; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ── Footer ── */
.page-footer {
  text-align: center;
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 24px;
}

/* ── Utility ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.text-center { text-align: center; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--gray-400); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .card { padding: 22px 16px; }
  .navbar { padding: 12px 16px; }
  .modal { padding: 22px 18px 18px; }
}
