/* --- THEME & VARIABLES --- */
:root {
  --mcq-sidebar-width: 320px;
  --header-height: 60px;
  --focus-bg: #121212;
}

/* --- BACKGROUND & LAYOUT --- */
body.mcq-mode {
  background-color: #f8fafc;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'%3E%3Ctext x='50%25' y='50%25' font-family='sans-serif' font-weight='900' font-size='24' fill='rgba(0,0,0,0.03)' transform='rotate(-45 150 150)' text-anchor='middle' dominant-baseline='middle'%3EEXAM META%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
  background-attachment: fixed;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --- HEADER --- */
.mcq-header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  justify-content: space-between;
  z-index: 50;
}

.timer-badge { font-family: monospace; font-size: 1.1rem; font-weight: 700; color: #334155; }
.pace-bar-container { width: 100px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.pace-bar { height: 100%; width: 0%; transition: width 1s linear, background 0.3s; }

/* --- LAYOUT CONTAINER --- */
.mcq-layout { display: flex; flex: 1; overflow: hidden; position: relative; }

/* --- QUESTION AREA --- */
.question-area { flex: 1; overflow-y: auto; padding: 1.5rem; max-width: 900px; margin: 0 auto; width: 100%; }

.q-box {
  background: white;
  border: 1px solid #e2e8f0;
  border-left: 5px solid #0f172a;
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.q-text { font-family: 'Merriweather', serif; font-size: 1.2rem; line-height: 1.7; color: #1e293b; }

.option-row { display: flex; align-items: flex-start; padding: 1rem; margin-bottom: 0.8rem; border: 1px solid #e2e8f0; border-radius: 8px; background: white; cursor: pointer; transition: all 0.2s; }
.option-row:hover { border-color: #94a3b8; background: #f8fafc; }
.option-row.selected { border-color: #0f172a; background: #f1f5f9; box-shadow: 0 0 0 1px #0f172a; }
.option-row.correct { background: #dcfce7 !important; border-color: #10b981 !important; }
.option-row.wrong { background: #fee2e2 !important; border-color: #ef4444 !important; }
.option-row.eliminated { opacity: 0.5; text-decoration: line-through; background: #f1f5f9; }

.opt-marker { font-weight: 700; color: #64748b; margin-right: 1rem; min-width: 25px; }
.opt-text { font-size: 1rem; color: #334155; flex: 1; }

.exp-box { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 8px; padding: 1.5rem; margin-top: 2rem; }
.exp-box.show { display: block; animation: fadeIn 0.3s; }

/* --- SIDEBAR --- */
.q-sidebar { width: var(--mcq-sidebar-width); background: white; border-left: 1px solid #e2e8f0; display: flex; flex-direction: column; z-index: 40; transition: transform 0.3s ease; }

@media (max-width: 992px) {
  .q-sidebar { position: absolute; top: 0; right: 0; height: 100%; transform: translateX(100%); box-shadow: -5px 0 15px rgba(0,0,0,0.1); }
  .q-sidebar.open { transform: translateX(0); }
}
.sidebar-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 30; display: none; }
.sidebar-overlay.show { display: block; }

.grid-container { flex: 1; overflow-y: auto; padding: 1.5rem; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; align-content: start; }
.grid-item { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 6px; background: #f1f5f9; color: #64748b; font-weight: 600; font-size: 0.85rem; cursor: pointer; border: 2px solid transparent; }
.grid-item.active { border-color: #0f172a; border-width: 2px; }
.grid-item.answered { background: #10b981; color: white; }
.grid-item.review { background: #8b5cf6; color: white; }

/* --- FOOTER --- */
.mcq-footer { height: 70px; background: white; border-top: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; z-index: 50; }

/* --- RESULT SCREEN --- */
.result-container { max-width: 800px; margin: 2rem auto; text-align: center; }
.score-big { font-size: 3rem; font-weight: 800; line-height: 1.1; margin-bottom: 5px; }
.stat-card { background: white; padding: 1.5rem; border-radius: 12px; border: 1px solid #e2e8f0; height: 100%; display: flex; flex-direction: column; justify-content: center; }

/* --- FOCUS MODE --- */
body.focus-active .mcq-header, 
body.focus-active .q-sidebar, 
body.focus-active .mcq-footer { display: none !important; }

body.focus-active { background: var(--focus-bg); background-image: none; }
body.focus-active .question-area { max-width: 800px; padding-top: 4rem; }

/* Base Colors for Focus Mode */
body.focus-active .q-box { background: #1e1e1e; border-color: #333; border-left-color: #666; }
body.focus-active .q-text { color: #d4d4d4; }
body.focus-active .badge { opacity: 0.6; }

body.focus-active .option-row { background: #262626; border-color: #333; }
body.focus-active .option-row .opt-text { color: #aaa; }
body.focus-active .option-row:hover { background: #333; }
body.focus-active .option-row.selected { background: #1e3a8a; border-color: #60a5fa; }

/* FIX: High Contrast Text Colors in Focus Mode */
body.focus-active .option-row.selected .opt-text,
body.focus-active .option-row.correct .opt-text,
body.focus-active .option-row.wrong .opt-text {
  color: #ffffff !important; /* Force white text on colored backgrounds */
}
body.focus-active .option-row.correct { background: #064e3b !important; border-color: #10b981 !important; }
body.focus-active .option-row.wrong { background: #7f1d1d !important; border-color: #ef4444 !important; }

/* Explanation Box in Focus Mode */
body.focus-active .exp-box { background: #1e1e1e; border-color: #333; }
body.focus-active .exp-box .text-dark { color: #ccc !important; }
body.focus-active .exp-box strong { color: #60a5fa !important; }

.focus-controls { position: fixed; top: 20px; right: 20px; z-index: 100; display: none; }
body.focus-active .focus-controls { display: block; }