/* ==========================================================================
   Azure AZ-104 Exam Simulator Stylesheet
   Modern, Clean, Responsive & Accessible
   ========================================================================== */

:root {
  --primary: #0078d4;
  --primary-hover: #0063b1;
  --primary-light: #e8f3fc;
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  
  --header-height: 64px;
}

body.theme-dark {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-header: #1e293b;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --primary-light: #1e3a5f;
  --success-light: #064e3b;
  --danger-light: #7f1d1d;
  --warning-light: #78350f;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   Header & Score Bar
   ========================================================================== */

.app-header {
  height: var(--header-height);
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.azure-badge {
  background: linear-gradient(135deg, #0078d4, #00bcf2);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

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

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Score Card */
.score-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.stat-pill.stat-correct {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
  background-color: var(--success-light);
}

.stat-pill.stat-mistakes {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
  background-color: var(--danger-light);
}

.stat-pill.stat-accuracy {
  color: var(--primary);
  border-color: rgba(0, 120, 212, 0.3);
  background-color: var(--primary-light);
}

.stat-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Buttons */
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.icon-btn-round {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s ease;
}

.icon-btn-round:hover {
  border-color: var(--text-muted);
  transform: scale(1.05);
}

.text-danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Toggle Switch */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.slider {
  width: 34px;
  height: 18px;
  background-color: var(--border-color);
  border-radius: 20px;
  position: relative;
  transition: background-color 0.2s;
}

.slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .slider::after {
  transform: translateX(16px);
}

/* Progress Bar */
.progress-bar-container {
  height: 3px;
  width: 100%;
  background: var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #00bcf2);
  transition: width 0.3s ease;
}

/* ==========================================================================
   Main Quiz Layout
   ========================================================================== */

.main-layout {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.quiz-card-wrapper {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

/* Card Meta Bar */
.card-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.meta-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.q-number-badge {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}

.q-module-badge {
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(14, 165, 233, 0.25);
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.theme-dark .q-module-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.q-type-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.q-total-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.bookmark-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.bookmark-btn.bookmarked {
  color: var(--warning);
  border-color: var(--warning);
  background-color: var(--warning-light);
}

.bookmark-btn.bookmarked .star-icon {
  content: '★';
}

/* Question Content */
.question-title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.question-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Images Container */
.question-images-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0.5rem 0;
}

.question-image-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: zoom-in;
  transition: border-color 0.2s;
}

.question-image-box:hover {
  border-color: var(--primary);
}

.question-image-box img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
}

.image-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* Options Container */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.option-item:hover:not(.locked) {
  border-color: var(--primary);
  background-color: var(--primary-light);
  transform: translateY(-1px);
}

.option-indicator {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: var(--bg-main);
  transition: all 0.2s;
}

.option-item.checkbox .option-indicator {
  border-radius: 6px;
}

.option-text {
  font-size: 0.95rem;
  line-height: 1.5;
  flex: 1;
}

/* Option States */
.option-item.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

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

.option-item.correct {
  border-color: var(--success) !important;
  background-color: var(--success-light) !important;
}

.option-item.correct .option-indicator {
  background-color: var(--success) !important;
  border-color: var(--success) !important;
  color: white !important;
}

.option-item.incorrect {
  border-color: var(--danger) !important;
  background-color: var(--danger-light) !important;
}

.option-item.incorrect .option-indicator {
  background-color: var(--danger) !important;
  border-color: var(--danger) !important;
  color: white !important;
}

.option-item.locked {
  cursor: default;
}

/* Direct Answer / Solution Box (for Hotspot/DragDrop questions without multi choices) */
.direct-answer-card {
  background: var(--bg-main);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.solution-badge {
  font-weight: 700;
  color: var(--success);
  font-size: 0.9rem;
}

/* Submit Multi Button */
.multi-submit-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.primary-btn {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

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

.multi-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Auto Advance Banner */
.auto-advance-banner {
  background-color: var(--success-light);
  border: 1px solid var(--success);
  color: #065f46;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeIn 0.2s ease-out;
}

.banner-icon {
  font-weight: 800;
  margin-right: 0.4rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Explanation Box */
.explanation-box {
  background-color: var(--bg-main);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem;
  animation: fadeIn 0.25s ease-out;
}

.explanation-header {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--primary);
  font-size: 0.95rem;
}

.explanation-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-main);
}

/* ==========================================================================
   Bottom Navigation Controller
   ========================================================================== */

.bottom-controller {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover:not(:disabled) {
  background-color: var(--border-color);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.primary-nav:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.nav-jump-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.nav-jump-group input {
  width: 70px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.85rem;
  text-align: center;
}

.subtle-btn {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.subtle-btn:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

/* ==========================================================================
   Question Navigator Drawer
   ========================================================================== */

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.question-drawer {
  position: fixed;
  top: 0;
  left: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  z-index: 60;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.question-drawer.open {
  left: 0;
}

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

.drawer-title-group h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.drawer-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.drawer-filter-bar {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.drawer-filter-bar input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}

.drawer-filter-bar input:focus {
  border-color: var(--primary);
}

.drawer-select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.drawer-select:focus {
  border-color: var(--primary);
}

.palette-module-heading {
  grid-column: 1 / -1;
  padding: 0.65rem 0.35rem 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--border-color);
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.palette-module-heading:first-child {
  margin-top: 0;
}

.palette-module-heading .badge-count {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  color: var(--text-main);
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.chip-success.active {
  background: var(--success);
  border-color: var(--success);
}

.chip-danger.active {
  background: var(--danger);
  border-color: var(--danger);
}

.chip-warning.active {
  background: var(--warning);
  border-color: var(--warning);
}

/* Palette Grid */
.palette-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  align-content: flex-start;
}

.palette-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.palette-btn:hover {
  border-color: var(--primary);
  transform: scale(1.08);
}

.palette-btn.current {
  border: 2px solid var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-light);
}

.palette-btn.status-correct {
  background-color: var(--success) !important;
  border-color: var(--success) !important;
  color: white !important;
}

.palette-btn.status-mistake {
  background-color: var(--danger) !important;
  border-color: var(--danger) !important;
  color: white !important;
}

.palette-btn.is-bookmarked::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  background-color: var(--warning);
  border-radius: 50%;
}

/* ==========================================================================
   Image Modal Lightbox
   ========================================================================== */

.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.image-modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
}

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 101;
}

.modal-content img {
  max-width: 100%;
  max-height: 88vh;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: block;
}

.modal-close {
  position: absolute;
  top: -40px;
  right: -10px;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-header {
    padding: 0 1rem;
  }
  .brand-sub {
    display: none;
  }
  .score-card {
    gap: 0.35rem;
  }
  .stat-pill {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
  .stat-name {
    display: none;
  }
  .main-layout {
    padding: 1rem;
  }
  .quiz-card {
    padding: 1.25rem;
  }
  .palette-container {
    grid-template-columns: repeat(5, 1fr);
  }
  .bottom-controller {
    flex-wrap: wrap;
    justify-content: center;
  }
}
