/* =============================================
   EduCheck — Complete Stylesheet
   Font: Plus Jakarta Sans
   ============================================= */

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

:root {
  --purple: #7C3AED;
  --purple-dark: #4C1D95;
  --purple-light: #EDE9FE;
  --purple-mid: #A78BFA;
  --blue: #1B3FA0;
  --green: #4A9E6B;
  --text: #1e1b4b;
  --text-muted: #6B7280;
  --bg: #F8F6FF;
  --border: rgba(124,58,237,0.12);
  --shadow: 4px 4px 0px rgba(124,58,237,0.15), 0 2px 20px rgba(124,58,237,0.08);
}

html { font-size: 14px; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: 220px;
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0;
  background: linear-gradient(180deg, #1B3FA0 0%, #4C1D95 60%, #7C3AED 100%);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.12);
  color: white;
}

.nav-item.active {
  background: rgba(255,255,255,0.2);
  color: white;
  font-weight: 700;
  border-left-color: white;
}

.nav-item svg { flex-shrink: 0; opacity: 0.9; }

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.12);
  margin: 10px 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 0;
  margin-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 12px; font-weight: 700; color: white;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 10px; color: rgba(255,255,255,0.55); font-weight: 500;
}

/* ---- TOPBAR ---- */
.topbar {
  position: fixed; top: 0; left: 220px; right: 0; height: 60px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1.5px solid rgba(124,58,237,0.1);
  display: flex; align-items: center;
  padding: 0 24px;
  z-index: 40;
}

.topbar-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: 220px;
  padding: 84px 28px 28px;
  min-height: 100vh;
  background: var(--bg);
}

/* ---- CLAY CARD ---- */
.clay-card {
  background: white;
  border-radius: 20px;
  border: 2.5px solid rgba(124,58,237,0.12);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* ---- KPI GRID ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  background: var(--purple-light);
  border: 1.5px solid #DDD6FE;
  border-radius: 16px;
  padding: 18px 20px;
}

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---- BUTTONS ---- */
.btn-primary {
  background: linear-gradient(135deg, #7C3AED, #A78BFA);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  border: 1.5px solid rgba(124,58,237,0.2);
  color: var(--purple);
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-ghost:hover { background: var(--purple-light); }

.btn-icon {
  background: var(--purple-light);
  border: 1.5px solid #DDD6FE;
  color: var(--purple);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  margin-left: 4px;
}

.btn-icon:hover { background: #DDD6FE; }

.btn-icon-danger {
  background: #FEE2E2;
  border-color: #FECACA;
  color: #DC2626;
}

.btn-icon-danger:hover { background: #FECACA; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  border: 1.5px solid rgba(124,58,237,0.2);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: white;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}

.form-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(124,58,237,0.08); }
.form-input::placeholder { color: #CBD5E1; }

textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input { 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='%237C3AED' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }

/* ---- TABLES ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table thead { background: #F5F3FF; }

.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 12px;
  color: #374151;
  border-bottom: 1px solid #F3F4F6;
  font-size: 12px;
}

.data-table tbody tr:hover { background: #FAFAFA; }
.data-table tbody tr:last-child td { border-bottom: none; }

.empty-state {
  text-align: center;
  padding: 32px !important;
  color: #9CA3AF;
  font-style: italic;
}

/* ---- BADGES ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---- MODALS ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
}

.modal-box {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  background: white;
  border-radius: 20px;
  border: 2px solid rgba(124,58,237,0.15);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1.5px solid rgba(124,58,237,0.1);
  position: sticky; top: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  z-index: 1;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.modal-close {
  background: var(--purple-light);
  border: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  transition: background 0.15s;
}

.modal-close:hover { background: #DDD6FE; }

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1.5px solid rgba(124,58,237,0.08);
  background: #FAFAFA;
  border-radius: 0 0 20px 20px;
}

/* ---- TOAST ---- */
.toast {
  background: white;
  border-radius: 12px;
  border: 1.5px solid rgba(124,58,237,0.15);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  animation: slideIn 0.2s ease;
}

.toast.success { border-left: 4px solid #4A9E6B; color: #166534; }
.toast.error   { border-left: 4px solid #DC2626; color: #991B1B; }
.toast.info    { border-left: 4px solid #7C3AED; color: #4C1D95; }

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

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

/* ---- TABS ---- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid #F3F4F6; margin-bottom: 20px; }

.tab-btn {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
}

.tab-btn.active { color: var(--purple); border-bottom-color: var(--purple); }
.tab-btn:hover { color: var(--purple); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- PRINT STYLES ---- */
@media print {
  .sidebar, .topbar, .btn-primary, .btn-ghost, .btn-icon { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 20px !important; }
  .clay-card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,0.4); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { left: 0; }
  .main-content { margin-left: 0; }
}
