/* ===================================================
   TEST PLATFORMA — ASOSIY VA O'QUVCHI STILLARI
   =================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #0284c7;
  --info-light: #e0f2fe;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --transition: all 0.25s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Nav */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 700;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), #818cf8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-card);
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.nav-links {
  display: flex;
  gap: 15px;
  align-items: center;
}

.nav-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-btn-outline {
  color: var(--primary);
  border-color: var(--primary-light);
  background: var(--bg-card);
}
.nav-btn-outline:hover {
  background: var(--primary-light);
}

.nav-btn-primary {
  background: var(--primary);
  color: var(--bg-card);
}
.nav-btn-primary:hover {
  background: var(--primary-hover);
}

/* Container */
.container {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
  flex: 1;
}

/* Hero / Entrance Card */
.entrance-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin-top: 1rem;
}

.hero-header {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-strong);
  margin-bottom: 0.5rem;
}

.hero-header p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary-light), #ede9fe);
  color: #4338ca;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  border: 1px solid #c7d2fe;
}

/* Form inputs */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
  background: var(--bg-card);
  color: var(--text-main);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Test Selection List */
.test-selection-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 1rem;
}

.test-item-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.test-item-card:hover {
  border-color: var(--primary);
  background: #f8faff;
  transform: translateY(-2px);
}

.test-item-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px var(--primary);
}

.test-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-main);
}

.test-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.test-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-subtle);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--bg-card);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-success {
  background: var(--success);
  color: var(--bg-card);
}
.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: var(--bg-card);
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-main);
}
.btn-outline:hover {
  background: var(--bg-subtle);
}

.btn-block {
  width: 100%;
}

/* ===================================================
   TEST TOPSHIRISH OYNASI (ACTIVE TEST SCREEN)
   =================================================== */

.test-header-bar {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 80px;
  z-index: 50;
}

.student-tag {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--danger-light);
  color: #b91c1c;
  padding: 8px 16px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}

.timer-box.warning {
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

.anti-cheat-tags {
  display: flex;
  gap: 10px;
  align-items: center;
}

.tag-warning {
  background: var(--warning-light);
  color: #92400e;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.test-workspace {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
}

@media (max-width: 850px) {
  .test-workspace {
    grid-template-columns: 1fr;
  }
}

/* Question Box */
.question-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.question-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.q-number {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary);
}

.q-topic-tag {
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.question-text {
  font-size: 1.25rem;
  line-height: 1.6;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2rem;
  white-space: pre-wrap;
}

/* Option Cards */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 2rem;
}

.option-btn {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  user-select: none;
}

.option-btn:hover {
  border-color: var(--border);
  background: var(--bg-main);
}

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.opt-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.option-btn.selected .opt-badge {
  background: var(--primary);
  color: var(--bg-card);
}

.opt-text {
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.4;
}

/* Controls */
.question-actions {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Palette Side Card */
.palette-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  height: fit-content;
}

.palette-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 1.5rem;
}

.palette-item {
  aspect-ratio: 1;
  border: 1.5px solid var(--border);
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.palette-item:hover {
  border-color: var(--primary);
}

.palette-item.current {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.palette-item.answered {
  background: var(--success);
  border-color: var(--success);
  color: var(--bg-card);
}

.palette-legend {
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ===================================================
   NATIJA SAHIFASI (RESULT SCREEN)
   =================================================== */

.result-hero {
  background: linear-gradient(135deg, var(--text-strong), var(--text-strong));
  color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.score-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 4px solid var(--bg-card);
  margin: 1.5rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.score-num {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
}

.score-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.85;
}

.result-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.95rem;
}

.result-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .result-stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stat-card-num {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-card-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

/* AI Pedagogical Card */
.ai-report-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px solid #818cf8;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.ai-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.ai-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-icon-large {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-card);
  font-size: 1.4rem;
}

.ai-report-body {
  line-height: 1.7;
  color: var(--text-main);
}

.ai-report-body h3, .ai-report-body h4 {
  color: var(--text-strong);
  margin: 1rem 0 0.5rem 0;
}

.ai-report-body ul, .ai-report-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

/* Topic Progress Section */
.topic-progress-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.topic-row {
  margin-bottom: 1.25rem;
}

.topic-row-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 600;
}

.progress-bar-bg {
  height: 10px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 1s ease-in-out;
}

/* Question review item */
.question-review-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.question-review-item.correct {
  border-left: 5px solid var(--success);
}

.question-review-item.incorrect {
  border-left: 5px solid var(--danger);
}

.q-review-opt {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  font-size: 0.95rem;
}
.q-review-opt.user-wrong {
  background: var(--danger-light);
  color: #991b1b;
  font-weight: 600;
}
.q-review-opt.is-correct {
  background: var(--success-light);
  color: #065f46;
  font-weight: 600;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 550px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

/* ===================================================
   TOAST NOTIFICATION TIZIMI
   =================================================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card, #ffffff);
  color: var(--text-main, #0f172a);
  padding: 14px 18px;
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border, #e2e8f0);
  border-left: 5px solid var(--primary, #4f46e5);
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: transform 0.25s ease, opacity 0.25s ease;
  font-size: 0.92rem;
  line-height: 1.45;
  position: relative;
}

.toast.toast-hiding {
  opacity: 0;
  transform: translateX(100%);
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-content {
  flex: 1;
  word-break: break-word;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  padding: 0 4px;
  font-size: 1.1rem;
  line-height: 1;
  transition: color 0.15s ease;
}

.toast-close:hover {
  color: var(--text-main, #0f172a);
}

.toast-success {
  border-left-color: #10b981;
}
.toast-success .toast-icon {
  color: #10b981;
}

.toast-error {
  border-left-color: #ef4444;
}
.toast-error .toast-icon {
  color: #ef4444;
}

.toast-warning {
  border-left-color: #f59e0b;
}
.toast-warning .toast-icon {
  color: #f59e0b;
}

.toast-info {
  border-left-color: #0284c7;
}
.toast-info .toast-icon {
  color: #0284c7;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(60px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}
