/* Modern, High-Performance Infosys Assessment Interface Styles */
:root {
  --primary: #007cc3;
  --primary-hover: #006097;
  --primary-light: #e6f3fa;
  --secondary: #1e293b;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: #ffffff;
  border-bottom: 2px solid var(--primary);
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-badge {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.brand-title h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--secondary);
}

.brand-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.timer-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.timer-box {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.timer-box.section-timer {
  background: #eef7fc;
  border-color: #bae0f5;
}

.timer-box.warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.timer-box.danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
  animation: pulse 1s infinite alternate;
}

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

.timer-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.timer-value {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}

.timer-box.total-timer .timer-value {
  color: var(--secondary);
}

/* Section Tabs */
.section-nav-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 1.5rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  white-space: nowrap;
}

.sec-tab-btn {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.sec-tab-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.sec-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.sec-tab-btn .badge {
  background: rgba(0, 0, 0, 0.08);
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
}

.sec-tab-btn.active .badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Main Layout */
.main-container {
  display: flex;
  flex: 1;
  padding: 1.25rem;
  gap: 1.25rem;
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}

.question-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.q-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.q-number-pill {
  background: #e2e8f0;
  color: var(--secondary);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
}

.q-topic-tag {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
}

.q-marks-pill {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--success);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
}

.q-body {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #1e293b;
  margin-bottom: 1.5rem;
  white-space: pre-line;
}

.q-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius-md);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.95rem;
  margin: 1rem 0;
  overflow-x: auto;
  line-height: 1.45;
}

/* Options Cards */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: #ffffff;
  transition: all 0.15s ease;
}

.option-item:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.option-item.selected {
  border-color: var(--primary);
  background: #f0f7fc;
  box-shadow: 0 0 0 1px var(--primary);
}

.opt-indicator {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.option-item.selected .opt-indicator {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.opt-text {
  font-size: 0.98rem;
  color: var(--text-main);
  line-height: 1.45;
}

/* Essay Area */
.essay-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.essay-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.essay-textarea {
  width: 100%;
  min-height: 280px;
  padding: 1rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.essay-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 124, 195, 0.15);
}

/* Action Footer */
.q-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.left-actions, .right-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.btn {
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

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

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

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

.btn-outline:hover {
  background: #f1f5f9;
}

.btn-warning {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.btn-warning:hover {
  background: #fde68a;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Side Palette */
.sidebar-palette {
  width: 320px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.palette-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 0.75rem;
}

/* Legend */
.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.dot-answered { background: var(--success); }
.dot-review { background: var(--warning); }
.dot-unanswered { background: var(--danger); }
.dot-unvisited { background: #cbd5e1; }

.q-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  overflow-y: auto;
  max-height: 380px;
  padding: 0.25rem;
}

.q-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.q-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.q-btn.current {
  outline: 2.5px solid var(--primary);
  outline-offset: 1px;
}

.q-btn.answered {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.q-btn.review {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}

.q-btn.unanswered {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.q-btn.unvisited {
  background: #f1f5f9;
  color: #64748b;
}

.submit-test-box {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn-full-submit {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  background: #0f172a;
  color: #ffffff;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-full-submit:hover {
  background: #1e293b;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal-content h2 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
  color: var(--secondary);
}

.modal-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* Evaluation / Results Dashboard */
.results-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 1.5rem;
  width: 100%;
}

.scorecard-banner {
  background: linear-gradient(135deg, #007cc3 0%, #004c7a 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.score-stats h2 {
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
}

.score-stats p {
  opacity: 0.85;
  font-size: 0.95rem;
}

.score-circle-group {
  display: flex;
  gap: 1.5rem;
}

.metric-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.metric-val {
  font-size: 2rem;
  font-weight: 800;
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
}

/* Section Breakdown Table */
.section-breakdown-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.section-breakdown-card h3 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  color: var(--secondary);
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
}

.breakdown-table th, .breakdown-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.breakdown-table th {
  background: #f8fafc;
  font-weight: 700;
  color: var(--text-muted);
}

.verdict-pass {
  color: var(--success);
  font-weight: 700;
}

.verdict-warn {
  color: var(--danger);
  font-weight: 700;
}

/* Solutions & Review Section */
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.review-filter-tabs {
  display: flex;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: #ffffff;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.filter-btn.active {
  background: var(--secondary);
  color: #ffffff;
  border-color: var(--secondary);
}

.review-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.review-item.is-correct {
  border-left: 5px solid var(--success);
}

.review-item.is-incorrect {
  border-left: 5px solid var(--danger);
}

.review-item.is-unanswered {
  border-left: 5px solid #94a3b8;
}

.review-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.review-q-text {
  font-size: 1rem;
  margin-bottom: 1rem;
  line-height: 1.5;
  white-space: pre-line;
}

.review-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.choice-box {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  border: 1px solid var(--border-color);
}

.choice-box.user-pick {
  border-color: var(--danger);
  background: #fef2f2;
}

.choice-box.correct-pick {
  border-color: var(--success);
  background: #ecfdf5;
  font-weight: 700;
}

.choice-box.user-correct-pick {
  border-color: var(--success);
  background: #d1fae5;
  font-weight: 700;
}

.explanation-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #334155;
  white-space: pre-line;
}

.explanation-card strong {
  color: var(--secondary);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .main-container {
    flex-direction: column;
  }
  .sidebar-palette {
    width: 100%;
  }
  .timer-section {
    gap: 0.75rem;
  }
  .review-choices {
    grid-template-columns: 1fr;
  }
}
