/* ===== TUITIONPRO — GLOBAL DESIGN SYSTEM ===== */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --primary-mid: #c7d2fe;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-w: 240px;
  --header-h: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  font-size: 15px;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.brand-logo svg { width: 20px; height: 20px; fill: #fff; }

.brand-text h6 {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
  letter-spacing: -0.3px;
}

.brand-text span {
  font-size: 11px;
  color: var(--gray-400);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-400);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 10px 4px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--gray-50);
  color: var(--gray-900);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--gray-100);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.user-card:hover { background: var(--gray-50); }

.user-avatar {
  width: 32px; height: 32px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-info .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info .role {
  font-size: 11px;
  color: var(--gray-400);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOP HEADER ===== */
.top-header {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 12px; }

.hamburger {
  display: none;
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--gray-600);
}

.hamburger:hover { background: var(--gray-100); }
.hamburger svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

.page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--gray-400);
  margin-top: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}

.header-btn svg {
  width: 15px; height: 15px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.btn-ghost {
  background: none;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn-ghost:hover { background: var(--gray-50); color: var(--gray-800); }

.btn-primary-sm {
  background: var(--primary);
  color: #fff;
}
.btn-primary-sm:hover { background: var(--primary-dark); }

/* ===== PAGE BODY ===== */
.page-body {
  padding: 24px;
  flex: 1;
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.stat-icon.indigo { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: var(--success-light); color: var(--success); }
.stat-icon.red    { background: var(--danger-light);  color: var(--danger);  }
.stat-icon.amber  { background: var(--warning-light); color: var(--warning); }

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
}
.stat-trend.up   { background: var(--success-light); color: var(--success); }
.stat-trend.down { background: var(--danger-light);  color: var(--danger);  }
.stat-trend.flat { background: var(--gray-100);      color: var(--gray-500);}

.stat-val {
  font-size: 26px;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.5px;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}

.card-body { padding: 20px; }
.card-body-sm { padding: 0; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }

table.tp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.tp-table thead th {
  background: var(--gray-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.tp-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.12s;
}

.tp-table tbody tr:last-child { border-bottom: none; }
.tp-table tbody tr:hover { background: var(--gray-50); }

.tp-table td {
  padding: 12px 16px;
  color: var(--gray-700);
  vertical-align: middle;
}

/* ===== BADGES ===== */
.badge-tp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-tp.green  { background: var(--success-light); color: #065f46; }
.badge-tp.red    { background: var(--danger-light);  color: #991b1b; }
.badge-tp.amber  { background: var(--warning-light); color: #92400e; }
.badge-tp.indigo { background: var(--primary-light); color: #3730a3; }
.badge-tp.gray   { background: var(--gray-100);      color: var(--gray-600); }

/* ===== AVATAR ===== */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ===== BUTTONS ===== */
.btn-tp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
  line-height: 1;
}

.btn-tp svg {
  width: 15px; height: 15px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.btn-tp.primary { background: var(--primary); color: #fff; }
.btn-tp.primary:hover { background: var(--primary-dark); }
.btn-tp.success { background: var(--success); color: #fff; }
.btn-tp.success:hover { background: #059669; }
.btn-tp.danger  { background: var(--danger);  color: #fff; }
.btn-tp.danger:hover  { background: #dc2626; }
.btn-tp.ghost   { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-tp.ghost:hover   { background: var(--gray-50); }
.btn-tp.sm { padding: 5px 10px; font-size: 12px; }
.btn-tp.sm svg { width: 13px; height: 13px; }
.btn-tp:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-800);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  font-family: var(--font);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.10);
}

select.form-control { cursor: pointer; }

.form-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-close {
  background: var(--gray-100);
  border: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.15s;
}

.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }
.modal-close svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.5; }

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== SEARCH BAR ===== */
.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  stroke: var(--gray-400); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.search-wrap input {
  padding-left: 34px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state svg {
  width: 48px; height: 48px;
  stroke: var(--gray-300); fill: none;
  stroke-width: 1.5;
  margin-bottom: 12px;
}

.empty-state h6 {
  font-size: 15px;
  color: var(--gray-500);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 16px;
}

/* ===== ALERT TOAST ===== */
.toast-wrap {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  min-width: 260px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-msg.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.toast-msg.error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.toast-msg.info    { background: var(--primary-light); color: #3730a3; border: 1px solid var(--primary-mid); }

.toast-msg svg {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ===== DIVIDER ===== */
.divider { border: none; border-top: 1px solid var(--gray-100); margin: 16px 0; }

/* ===== ATTENDANCE GRID ===== */
.att-dot {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 1.5px solid transparent;
}

.att-dot.present { background: var(--success-light); color: #065f46; border-color: #6ee7b7; }
.att-dot.absent  { background: var(--danger-light);  color: #991b1b; border-color: #fca5a5; }
.att-dot.unmarked{ background: var(--gray-100);      color: var(--gray-400); border-color: var(--gray-200); }
.att-dot:hover   { transform: scale(1.1); }

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap {
  background: var(--gray-100);
  border-radius: 10px;
  height: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* ===== MOBILE ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .top-header { padding: 0 16px; }
  .hide-mobile { display: none !important; }
  .toast-wrap { left: 16px; right: 16px; bottom: 16px; }
  .toast-msg { min-width: unset; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-val { font-size: 22px; }
}
