/* Applied ML Final Exam Review - Version 2 (Video Edition) CSS */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: #1f2937;
  --bg-card-hover: #374151;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.15);
  --color-error: #ef4444;
  --color-error-bg: rgba(239, 68, 68, 0.15);
  --color-gold: #f59e0b;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-radius: 12px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

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

/* App Header */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-primary), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow);
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.v2-badge {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

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

/* Nav Tabs */
.nav-tabs {
  display: flex;
  gap: 0.4rem;
  background: var(--bg-primary);
  padding: 0.3rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}

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

/* Main Container */
.main-container {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto;
  padding: 0 1.5rem 3rem 1.5rem;
  flex: 1;
}

/* View Sections */
.view-section {
  display: none;
}

.view-section.active-view {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Quiz Top Bar */
.quiz-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  background: var(--bg-card);
  padding: 0.8rem 1.25rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.progress-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.status-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.progress-bar-container {
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  flex: 1;
  max-width: 300px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  width: 0%;
  transition: width 0.3s ease;
}

.stats-row {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.stat-streak { color: var(--color-gold); border-color: rgba(245, 158, 11, 0.3); }
.stat-score { color: var(--color-success); border-color: rgba(16, 185, 129, 0.3); }

/* Question Card */
.question-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  padding: 1.75rem;
  box-shadow: var(--shadow-main);
  margin-bottom: 1.5rem;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.topic-tag {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.8rem;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.question-text {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.45;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.option-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.option-btn:hover:not(:disabled) {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.option-key {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

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

.option-btn.wrong {
  background: var(--color-error-bg) !important;
  border-color: var(--color-error) !important;
  color: var(--color-error) !important;
}

/* Video Visual Box (v2 Core Feature) */
.video-visual-box {
  margin-top: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.video-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.video-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: 15px;
  font-size: 0.75rem;
}

.video-player-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  display: flex;
  flex-direction: column;
}

.quiz-video-player {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Custom Video Controls Overlay */
.video-controls-overlay {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: rgba(17, 24, 39, 0.95);
  border-top: 1px solid var(--border-color);
}

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

.v-control-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}

.v-control-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.speed-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.video-speed-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* Dual Explanation Container */
.explanation-container {
  margin-top: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.explanation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.exp-level-toggle {
  display: flex;
  gap: 0.3rem;
  background: var(--bg-card);
  padding: 0.25rem;
  border-radius: 6px;
}

.exp-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.exp-toggle-btn.active {
  background: var(--accent-primary);
  color: #fff;
}

.outcome-badge {
  padding: 0.75rem 1.25rem;
  background: rgba(99, 102, 241, 0.12);
  border-bottom: 1px solid rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  line-height: 1.4;
}

.outcome-badge i {
  color: #6366f1;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.explanation-content {
  padding: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 4px 15px var(--accent-glow);
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

/* Topics Grid */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-header p {
  color: var(--text-muted);
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.topic-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-main);
}

.topic-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  display: block;
}

.topic-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.topic-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.topic-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

/* Video Cinema Sandbox View */
.cinema-theater-box {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-main);
}

.cinema-player-container {
  background: #000;
  width: 100%;
  max-height: 520px;
  display: flex;
  justify-content: center;
}

.cinema-video-player {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #000;
}

.cinema-info-panel {
  padding: 1.25rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.cinema-info-panel h3 {
  font-size: 1.3rem;
  margin: 0.5rem 0 0.25rem 0;
}

.cinema-info-panel p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.gallery-filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.9rem;
  width: 100%;
  outline: none;
}

.filter-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.video-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.video-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow-main);
}

.video-card.active-cinema {
  border-color: var(--color-success);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.video-thumb-container {
  height: 150px;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-thumb-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
}

.play-overlay-icon {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.85);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
  transition: var(--transition);
}

.video-card:hover .play-overlay-icon {
  transform: scale(1.15);
  background: var(--accent-primary);
}

.video-card-body {
  padding: 1rem;
}

.video-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 0.4rem;
}

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
}

.analytics-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.analytics-num {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

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

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay.active-modal {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 550px;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.kbd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.kbd-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--accent-primary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 700;
}
