/**
 * UH Pintar - Premium Modern Design System
 * Clean, modern, high-contrast professional interface (Indigo / Royal Blue & Crisp Slate)
 */

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

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Primary & Accent Palette */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
  
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);

  /* Neutrals */
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  /* Layout Sizes */
  --sidebar-width: 270px;
  --header-height: 68px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.04);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.25);
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================
   Typography & Global Overrides
   ========================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* Buttons */
.btn {
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  padding: 0.55rem 1.15rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: var(--primary-gradient);
  border: none;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-outline-primary {
  border-color: var(--primary-200);
  color: var(--primary-color);
  background: #ffffff;
}

.btn-outline-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-hover);
  transform: translateY(-1px);
}

/* Form Controls */
.form-control, .form-select {
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-group-text {
  border: 1.5px solid var(--border-color);
  background-color: #f8fafc;
  color: var(--text-muted);
  border-radius: 8px;
}

/* ==========================================================
   Admin Layout & Sidebar
   ========================================================== */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary-color);
  text-decoration: none;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.sidebar-brand img {
  height: 40px;
  margin-right: 12px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.sidebar-menu {
  padding: 1.25rem 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-heading {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08rem;
  padding: 0.75rem 0.75rem 0.35rem;
  color: var(--text-muted);
  font-weight: 700;
}

.nav-link-admin {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.85rem;
  margin-bottom: 3px;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link-admin i {
  font-size: 1.15rem;
  margin-right: 12px;
  color: #64748b;
  width: 20px;
  text-align: center;
  transition: color 0.2s;
}

.nav-link-admin:hover {
  background-color: var(--primary-light);
  color: var(--primary-color);
  transform: translateX(3px);
}

.nav-link-admin:hover i {
  color: var(--primary-color);
}

.nav-link-admin.active {
  background: var(--primary-gradient);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.25);
}

.nav-link-admin.active i {
  color: #ffffff;
}

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-color);
}

.admin-header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: var(--shadow-sm);
}

.admin-content {
  padding: 2rem 1.75rem;
  flex: 1;
}

/* ==========================================================
   Cards & Component Aesthetics
   ========================================================== */
.card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  background: #ffffff;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 1.1rem 1.35rem;
  font-weight: 600;
  border-top-left-radius: 12px !important;
  border-top-right-radius: 12px !important;
}

.stat-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.2s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.08);
}

/* Badges */
.badge {
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  letter-spacing: 0.01em;
}

/* Table Enhancements */
.table {
  color: var(--text-main);
  vertical-align: middle;
}

.table-hover > tbody > tr:hover {
  background-color: #f8fafc;
}

.table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  font-weight: 700;
  color: #64748b;
  border-bottom: 1.5px solid var(--border-color);
  padding: 0.85rem 1rem;
}

.table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

/* ==========================================================
   Student Portal & Exam Experience (Mobile-First)
   ========================================================== */
.student-navbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.exam-sticky-bar {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  z-index: 1030;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 0.75rem 1rem;
}

.timer-badge {
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}

.timer-badge.normal {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.timer-badge.warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #b45309;
  border: 1px solid #fde68a;
  animation: pulse-warn 1.5s infinite;
}

.timer-badge.danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #b91c1c;
  border: 1px solid #fecaca;
  animation: pulse-danger 1s infinite;
}

@keyframes pulse-warn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes pulse-danger {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Option Choices */
.option-label {
  display: flex;
  align-items: flex-start;
  padding: 0.95rem 1.15rem;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 0.85rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: #ffffff;
}

.option-label:hover {
  background-color: #f8faff;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.option-label.selected {
  background: linear-gradient(135deg, #eff6ff 0%, #f8faff 100%);
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  font-weight: 500;
}

.option-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  background: #f1f5f9;
  color: #475569;
  margin-right: 14px;
  flex-shrink: 0;
  transition: all 0.2s;
  border: 1px solid #e2e8f0;
}

.option-label.selected .option-badge {
  background: var(--primary-gradient);
  color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* Question Number Badges in Grid */
.q-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.q-btn:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
  color: var(--primary-color);
}

.q-btn.current {
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
  transform: scale(1.05);
}

.q-btn.answered {
  background: var(--primary-gradient);
  color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.q-btn.flagged {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
  border-color: #d97706 !important;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.25);
}

/* Autosave Indicator */
.save-status-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.save-status-badge.saving {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.save-status-badge.saved {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.save-status-badge.offline {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ==========================================================
   Admin Login Hero Styling
   ========================================================== */
.admin-login-body {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #1e3a8a 0%, #0f172a 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.admin-login-body::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.admin-login-body::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.admin-login-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 10;
}

/* Mobile Responsive Adjustments */
@media (max-width: 991.98px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.show {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(15, 23, 42, 0.4);
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-content {
    padding: 1.25rem 1rem;
  }
  .admin-header {
    padding: 0 1rem;
  }
}

@media (max-width: 575.98px) {
  .btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
  }
  .stat-card .stat-icon {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
  .admin-content {
    padding: 1rem 0.75rem;
  }
}

/* ==========================================================
   Interactive Component Enhancements (Touch & Aesthetics)
   ========================================================== */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1035;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.hover-lift {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md) !important;
}

/* Class Pill Buttons (Portal Siswa & Class Grid) */
.class-pill-btn {
  padding: 0.65rem 1.15rem;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: #ffffff;
  color: #334155;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  min-height: 46px;
}

.class-pill-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--primary-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.class-pill-btn.active {
  background: var(--primary-gradient);
  color: #ffffff !important;
  border-color: var(--primary-600);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: scale(1.02);
}

/* Touch-friendly Checkbox Cards */
.form-check {
  cursor: pointer;
  transition: all 0.15s ease;
}

.form-check:has(input:checked) {
  border-color: var(--primary-color) !important;
  background-color: #eff6ff !important;
  box-shadow: 0 0 0 1px var(--primary-color);
}

.form-check:has(input:checked) label {
  color: var(--primary-color) !important;
}

.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

.border-dashed {
  border: 2px dashed #cbd5e1 !important;
}

