/* LearnQ Admin Panel Styles */
:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --secondary: #6B7280;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #06B6D4;
  --light: #F3F4F6;
  --dark: #1F2937;
  --white: #FFFFFF;
  --sidebar-width: 260px;
  --header-height: 64px;
  --border-radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #F9FAFB;
  color: var(--dark);
  line-height: 1.5;
}

/* Layout */
.wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.content-wrapper {
  padding: 24px;
  flex: 1;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid #E5E7EB;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #E5E7EB;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--dark);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.logo-text {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark);
}

.sidebar-nav {
  padding: 16px 0;
}

.nav-list {
  list-style: none;
}

.nav-section {
  padding: 16px 20px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9CA3AF;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #6B7280;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: #F3F4F6;
  color: var(--dark);
}

.nav-link.active {
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary);
  border-left-color: var(--primary);
}

.nav-link i {
  font-size: 18px;
}

/* Header */
.top-header {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid #E5E7EB;
  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: 16px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--secondary);
}

.search-box {
  display: flex;
  align-items: center;
  background: #F3F4F6;
  border-radius: 8px;
  padding: 8px 16px;
  gap: 8px;
}

.search-box i {
  color: #9CA3AF;
}

.search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  width: 240px;
}

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

.header-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--secondary);
  cursor: pointer;
  padding: 8px;
}

.header-btn .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
}

.user-dropdown {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--dark);
}

.user-role {
  font-size: 12px;
  color: #9CA3AF;
}

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

.page-title h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.page-title p {
  color: #6B7280;
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 12px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow);
}

.stat-card.mini {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px;
}

.stat-card.mini .stat-value {
  font-size: 28px;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.stat-icon.bg-primary { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.stat-icon.bg-success { background: linear-gradient(135deg, #10B981, #059669); }
.stat-icon.bg-warning { background: linear-gradient(135deg, #F59E0B, #D97706); }
.stat-icon.bg-info { background: linear-gradient(135deg, #06B6D4, #0891B2); }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
}

.stat-label {
  font-size: 14px;
  color: #6B7280;
  margin-top: 4px;
}

.stat-footer {
  margin-top: auto;
}

.stat-change {
  font-size: 13px;
  font-weight: 500;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

.stat-info {
  font-size: 13px;
  color: #6B7280;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  border: none;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #E5E7EB;
  background: transparent;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark);
}

.card-body {
  padding: 20px;
}

/* Tables */
.table {
  margin-bottom: 0;
}

.table thead th {
  border-top: none;
  border-bottom: 1px solid #E5E7EB;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6B7280;
  padding: 12px 16px;
}

.table tbody td {
  padding: 16px;
  vertical-align: middle;
  border-bottom: 1px solid #F3F4F6;
}

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

/* User Cell */
.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-lg {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 36px;
  overflow: hidden;
}

.user-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--dark);
}

.user-email {
  font-size: 12px;
  color: #9CA3AF;
}

/* Exam Cell */
.exam-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.exam-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--dark);
}

.exam-subtitle {
  font-size: 12px;
  color: #9CA3AF;
}

/* Badges */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

.badge-bcs { background: rgba(59, 130, 246, 0.12); color: #3B82F6; }
.badge-bank-job { background: rgba(249, 115, 22, 0.12); color: #F97316; }
.badge-ntrca { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.badge-university { background: rgba(139, 92, 246, 0.12); color: #8B5CF6; }
.badge-custom { background: rgba(107, 114, 128, 0.12); color: #6B7280; }
.badge-default { background: #F3F4F6; color: #6B7280; }

.badge-easy { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.badge-medium { background: rgba(245, 158, 11, 0.12); color: #F59E0B; }
.badge-hard { background: rgba(239, 68, 68, 0.12); color: #EF4444; }
.badge-mixed { background: rgba(107, 114, 128, 0.12); color: #6B7280; }

.badge-email { background: rgba(59, 130, 246, 0.12); color: #3B82F6; }
.badge-google { background: rgba(234, 67, 53, 0.12); color: #EA4335; }
.badge-phone { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.badge-firebase { background: rgba(249, 115, 22, 0.12); color: #F97316; }

/* Role Badge */
.role-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}

.role-badge.admin { background: rgba(139, 92, 246, 0.12); color: #8B5CF6; }
.role-badge.user { background: rgba(107, 114, 128, 0.12); color: #6B7280; }

/* Status Badge */
.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

.status-badge.success { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.status-badge.danger { background: rgba(239, 68, 68, 0.12); color: #EF4444; }
.status-badge.warning { background: rgba(245, 158, 11, 0.12); color: #F59E0B; }
.status-badge.large { font-size: 14px; padding: 8px 16px; }

/* Score Badge */
.score-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}

.score-badge.success { background: rgba(16, 185, 129, 0.12); color: #10B981; }
.score-badge.warning { background: rgba(245, 158, 11, 0.12); color: #F59E0B; }
.score-badge.danger { background: rgba(239, 68, 68, 0.12); color: #EF4444; }

/* Rank Badge */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
}

.rank-badge.gold { background: linear-gradient(135deg, #FCD34D, #F59E0B); color: #78350F; }
.rank-badge.silver { background: linear-gradient(135deg, #D1D5DB, #9CA3AF); color: #374151; }
.rank-badge.bronze { background: linear-gradient(135deg, #FCA5A5, #F87171); color: #7F1D1D; }

.rank-number {
  font-weight: 600;
  color: #6B7280;
}

/* Action Buttons */
.action-btns {
  display: flex;
  gap: 8px;
}

.action-btns .btn {
  padding: 6px 10px;
}

/* Buttons */
.btn {
  font-weight: 500;
  border-radius: 8px;
  padding: 10px 20px;
  transition: all 0.2s;
}

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

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

/* Info List */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-label {
  font-size: 13px;
  color: #6B7280;
}

.info-value {
  font-weight: 600;
  color: var(--dark);
}

/* User Details */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #F3F4F6;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: 13px;
  color: #6B7280;
}

.detail-value {
  font-weight: 500;
  color: var(--dark);
}

/* Tags */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-size: 12px;
  padding: 4px 10px;
  background: #F3F4F6;
  border-radius: 6px;
  color: #6B7280;
}

/* Questions */
.questions-list {
  display: flex;
  flex-direction: column;
}

.question-item {
  padding: 20px;
  border-bottom: 1px solid #E5E7EB;
}

.question-item:last-child {
  border-bottom: none;
}

.question-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.question-number {
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
}

.question-content {
  margin-bottom: 16px;
}

.question-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 4px;
}

.question-text-en {
  font-size: 13px;
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #F9FAFB;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
}

.option.correct {
  background: rgba(16, 185, 129, 0.08);
  border-color: #10B981;
}

.option-letter {
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  color: #6B7280;
}

.option.correct .option-letter {
  background: #10B981;
  color: white;
}

.option-text {
  flex: 1;
  font-size: 14px;
}

.question-explanation {
  margin-top: 16px;
  padding: 12px;
  background: rgba(59, 130, 246, 0.08);
  border-radius: 8px;
  font-size: 13px;
}

/* Score Ring */
.score-ring-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.score-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.score-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 10px solid #E5E7EB;
}

.score-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 10px solid transparent;
  border-top-color: currentColor;
  border-right-color: currentColor;
}

.score-ring.passed {
  color: var(--success);
}

.score-ring.failed {
  color: var(--danger);
}

.score-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--dark);
}

/* Ranking Info */
.ranking-info {
  display: flex;
  justify-content: space-around;
  padding: 16px 0;
}

.ranking-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ranking-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark);
}

.ranking-label {
  font-size: 12px;
  color: #6B7280;
}

/* Podium */
.podium-container {
  margin-bottom: 32px;
}

.podium-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
}

.podium-card.gold {
  transform: translateY(-20px);
  box-shadow: var(--shadow-lg);
}

.podium-rank {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
}

.podium-card.gold .podium-rank { background: linear-gradient(135deg, #FCD34D, #F59E0B); }
.podium-card.silver .podium-rank { background: linear-gradient(135deg, #D1D5DB, #9CA3AF); }
.podium-card.bronze .podium-rank { background: linear-gradient(135deg, #FCA5A5, #F87171); }

.podium-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 28px;
  margin: 0 auto 16px;
  overflow: hidden;
}

.podium-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.podium-card h5 {
  margin-bottom: 4px;
}

.podium-card .score {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark);
  margin: 8px 0;
}

.podium-card .accuracy {
  font-size: 14px;
  color: #6B7280;
}

.trophy-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  color: #FCD34D;
  font-size: 24px;
}

/* Tips */
.tip-item {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.tip-item:last-child {
  margin-bottom: 0;
}

.tip-item i {
  font-size: 18px;
  flex-shrink: 0;
}

.tip-item p {
  font-size: 13px;
  color: #6B7280;
  margin: 0;
}

/* Alerts */
.alert {
  border-radius: var(--border-radius);
  border: none;
  padding: 16px 20px;
  margin-bottom: 20px;
}

/* Table Row Colors */
.table-success-light { background: rgba(16, 185, 129, 0.05); }
.table-danger-light { background: rgba(239, 68, 68, 0.05); }
.table-warning-light { background: rgba(245, 158, 11, 0.05); }

/* Auth Pages */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-wrapper {
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-card {
  background: var(--white);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  margin: 0 auto 20px;
}

.auth-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 8px;
}

.auth-header p {
  color: #6B7280;
}

.auth-form .form-group {
  margin-bottom: 20px;
}

.auth-form label {
  font-weight: 500;
  color: var(--dark);
  margin-bottom: 8px;
  display: block;
}

.auth-form .input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-form .input-icon {
  position: absolute;
  left: 16px;
  color: #9CA3AF;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  font-size: 15px;
  transition: all 0.2s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.toggle-password {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #6B7280;
}

.btn-submit {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.auth-footer {
  margin-top: 24px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

/* Error Pages */
.error-page {
  text-align: center;
  padding: 40px;
}

.error-code {
  font-size: 120px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 16px;
}

.error-icon {
  font-size: 80px;
  color: var(--danger);
  margin-bottom: 24px;
}

.error-page h1 {
  font-size: 28px;
  margin-bottom: 12px;
}

.error-page p {
  color: #6B7280;
  margin-bottom: 24px;
}

/* Pagination */
.pagination .page-link {
  border-radius: 8px;
  margin: 0 4px;
  border: none;
  color: var(--dark);
}

.pagination .page-item.active .page-link {
  background: var(--primary);
}

/* Breadcrumb */
.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 8px;
  font-size: 14px;
}

.breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb-item.active {
  color: #6B7280;
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    gap: 16px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .search-input {
    width: 160px;
  }
}
