/* ==================== GLOBAL & BRANDING ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: #f1f5f9;
  color: #1e293b;
  line-height: 1.5;
}

/* ==================== TOP NAVBAR ==================== */
.navbar {
  background: linear-gradient(90deg, #0f172a 0%, #1e3a8a 100%);
  color: #ffffff;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.brand-icon {
  font-size: 1.5rem;
  color: #facc15;
}

.brand-name {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #ffffff;
}

.brand-name small {
  color: #38bdf8;
  font-weight: 700;
  font-size: 1.05rem;
}

.nav-right,
.nav-controls,
.user-nav-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.mode-badge {
  background: #f59e0b;
  color: #0f172a;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 800;
}

.timer-pill,
.q-timer-pill {
  background: #1e293b;
  border: 1px solid #38bdf8;
  color: #38bdf8;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
}

.q-timer-pill.danger {
  border-color: #ef4444;
  color: #fca5a5;
}

/* ==================== CONTAINERS & AUTH CARD ==================== */
.container {
  max-width: 1140px;
  margin: 28px auto;
  padding: 0 20px;
}

.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 110px);
}

.auth-card {
  background: #ffffff;
  width: 100%;
  max-width: 450px;
  padding: 34px 30px;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
  border: 1px solid #e2e8f0;
}

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

.auth-header h1 {
  font-size: 1.55rem;
  color: #0f172a;
  margin: 6px 0;
}

.auth-header p {
  font-size: 0.9rem;
  color: #64748b;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.auth-tab {
  padding: 10px;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 0.92rem;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

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

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-group input,
.year-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  font-size: 0.95rem;
  color: #0f172a;
  background: #ffffff;
  transition: border-color 0.2s;
}

.form-group input:focus,
.year-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ==================== BUTTONS ==================== */
.btn {
  padding: 11px 18px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.94rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 0.84rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: #1d4ed8;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1e40af;
}

.btn-success {
  background: #16a34a;
  color: #ffffff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}

.btn-warning {
  background: #f59e0b;
  color: #0f172a;
}

.btn-outline {
  background: #ffffff;
  color: #1e293b;
  border: 1.5px solid #cbd5e1;
}

.btn-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* ==================== HERO & CARDS ==================== */
.hero-banner {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  padding: 26px 30px;
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 8px 20px rgba(30, 58, 138, 0.18);
}

.hero-banner h1 {
  font-size: 1.65rem;
  margin-bottom: 6px;
}

.hero-banner p {
  color: #dbeafe;
  font-size: 0.96rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.test-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 22px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.test-card h2 {
  font-size: 1.2rem;
  color: #0f172a;
  margin: 8px 0;
}

.card-desc {
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 12px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #1e3a8a;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.badge-blue {
  background: #dbeafe;
  color: #1e40af;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-amber {
  background: #fef3c7;
  color: #92400e;
}

/* ==================== HISTORY & SUBJECT PILLS ==================== */
.history-banner {
  background: #ffffff;
  border-left: 5px solid #2563eb;
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.subject-section {
  background: #ffffff;
  padding: 22px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
}

.subject-section h3 {
  margin-bottom: 14px;
  color: #0f172a;
}

.subject-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  padding: 9px 15px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pill:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

/* ==================== CBT EXAM VIEW ==================== */
.test-layout {
  max-width: 1240px;
  margin: 22px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 20px;
}

.question-area,
.palette-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1.5px solid #e2e8f0;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 8px;
}

.q-number {
  font-weight: 800;
  color: #1e3a8a;
  font-size: 1.05rem;
}

.q-topic {
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.q-marks {
  background: #dcfce7;
  color: #166534;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.q-text {
  font-size: 1.06rem;
  color: #0f172a;
  margin-bottom: 18px;
  line-height: 1.65;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  background: #ffffff;
}

.option-item:hover {
  border-color: #2563eb;
  background: #f8fafc;
}

.option-item.selected {
  border-color: #2563eb;
  background: #eff6ff;
  font-weight: 600;
}

.option-item.correct {
  border-color: #16a34a;
  background: #dcfce7;
  color: #14532d;
  font-weight: 600;
}

.option-item.wrong {
  border-color: #dc2626;
  background: #fee2e2;
  color: #7f1d1d;
}

.opt-label {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.explanation-box {
  margin-top: 20px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  padding: 16px;
  border-radius: 10px;
}

.explanation-box h4 {
  color: #166534;
  margin-bottom: 6px;
}

.q-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1.5px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.left-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==================== PALETTE SIDEBAR ==================== */
.legend {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin: 12px 0;
  color: #475569;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot.answered { background: #16a34a; }
.dot.marked { background: #f59e0b; }
.dot.unanswered { background: #cbd5e1; }

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.pal-btn {
  padding: 8px 0;
  border-radius: 7px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.pal-btn.current { border-color: #1d4ed8; box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.25); }
.pal-btn.answered { background: #16a34a; color: #fff; border-color: #16a34a; }
.pal-btn.marked { background: #f59e0b; color: #0f172a; border-color: #f59e0b; }

/* ==================== RESULT REPORT ==================== */
.result-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 28px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.score-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.score-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
}

.score-box.primary { background: #eff6ff; border-color: #93c5fd; }
.score-box.success { background: #f0fdf4; border-color: #86efac; }
.score-box.danger { background: #fef2f2; border-color: #fca5a5; }

.score-val {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
}

.score-lbl {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 600;
}

.comparison-card {
  background: #f8fafc;
  padding: 18px;
  border-radius: 12px;
  margin-bottom: 22px;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 50px;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.9rem;
}

.bar-track {
  background: #e2e8f0;
  height: 10px;
  border-radius: 10px;
  overflow: hidden;
}

.bar-fill { height: 100%; border-radius: 10px; }
.bar-fill.you { background: #2563eb; }
.bar-fill.cutoff { background: #f59e0b; }
.bar-fill.topper { background: #16a34a; }

.subject-analytics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}

.subj-card {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.subj-card.weak { border-left: 4px solid #dc2626; background: #fef2f2; }
.subj-card.strong { border-left: 4px solid #16a34a; background: #f0fdf4; }

.guidance-alert {
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.92rem;
}

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

/* ==================== UPI PAYMENT MODAL ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.modal-card {
  background: #ffffff;
  max-width: 430px;
  width: 100%;
  padding: 26px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.upi-box {
  background: #f1f5f9;
  border: 1.5px dashed #94a3b8;
  padding: 14px;
  border-radius: 10px;
  text-align: center;
}

@media (max-width: 860px) {
  .test-layout {
    grid-template-columns: 1fr;
  }
}