/* ==============================================================
   TKA EDUSMART - MODERN RESPONSIVE STYLESHEET
   Clean, Accessible, Mobile-First
   ============================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --radius: 10px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--slate-50);
  color: var(--slate-800);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header & Nav */
.header-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--slate-900);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  list-style: none;
}

.nav-item a {
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--slate-600);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-item a:hover, .nav-item a.active {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: var(--slate-100);
  border-radius: 20px;
  font-size: 0.85rem;
}

.role-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
.role-admin { background: #fae8ff; color: #a21caf; }
.role-guru { background: #dbeafe; color: #1d4ed8; }
.role-siswa { background: #d1fae5; color: #047857; }

/* Sub Nav Menu */
.sub-nav {
  background: white;
  border-bottom: 1px solid var(--slate-200);
  padding: 0.5rem 0;
  margin-bottom: 1.5rem;
}
.sub-nav-list {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  white-space: nowrap;
}
.sub-nav-item a {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 6px;
  color: var(--slate-600);
}
.sub-nav-item a.active {
  background: var(--slate-800);
  color: white;
  font-weight: 600;
}

/* Dashboard Cards Grid */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  box-shadow: var(--shadow-lg);
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.1;
}
.stat-lbl {
  font-size: 0.85rem;
  color: var(--slate-600);
  margin-top: 0.25rem;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.icon-indigo { background: #e0e7ff; color: #4338ca; }
.icon-emerald { background: #d1fae5; color: #059669; }
.icon-amber { background: #fef3c7; color: #d97706; }
.icon-purple { background: #f3e8ff; color: #7e22ce; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--slate-100); color: var(--slate-700); border-color: var(--slate-300); }
.btn-secondary:hover { background: var(--slate-200); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; border-radius: 6px; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; border-radius: 10px; }

/* Form Controls */
.form-group {
  margin-bottom: 1.15rem;
}
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 0.35rem;
}
.form-control, .form-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--slate-300);
  border-radius: 7px;
  font-size: 0.9rem;
  color: var(--slate-900);
  background: white;
  transition: border-color 0.2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: white;
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}
.table th {
  background: var(--slate-100);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--slate-700);
  border-bottom: 1px solid var(--slate-200);
}
.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: none;
}
.table tr:hover td {
  background: var(--slate-50);
}

/* Exam Screen (Mobile-First) */
.exam-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
}
@media (max-width: 868px) {
  .exam-layout {
    grid-template-columns: 1fr;
  }
}
.exam-timer {
  background: #1e1b4b;
  color: #a5b4fc;
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: bold;
}
.exam-timer .time-left {
  color: #38bdf8;
  font-size: 1.5rem;
}

.question-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}
.question-nav-btn {
  aspect-ratio: 1;
  border: 1px solid var(--slate-300);
  background: white;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.question-nav-btn.answered {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.question-nav-btn.flagged {
  background: #fbbf24;
  color: #78350f;
  border-color: #f59e0b;
}
.question-nav-btn.current {
  outline: 3px solid var(--secondary);
}

/* Alerts */
.alert {
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* Footer */
footer {
  margin-top: auto;
  background: white;
  border-top: 1px solid var(--slate-200);
  padding: 1.25rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--slate-600);
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--slate-200);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.06);
  z-index: 99;
  padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: center;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }
  body {
    padding-bottom: 4.5rem;
  }
  .sub-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--slate-600);
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  flex: 1;
  padding: 0.2rem 0;
  transition: all 0.15s;
}

.bottom-nav-item:hover, .bottom-nav-item.active {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

.bottom-nav-item .nav-icon {
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.bottom-nav-item.center-action .nav-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  margin-bottom: 0.15rem;
  margin-top: -10px;
}

