:root {
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-dark: #3730a3;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Header & Navbar */
.site-header {
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  max-width: 1100px;
  margin: 0 auto;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-badge {
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: #eef2ff;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  color: white;
  padding: 48px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 220px;
  height: 220px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  pointer-events: none;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 12px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 1.1rem;
  color: #e0e7ff;
  max-width: 700px;
  margin-bottom: 20px;
}

.hero-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.stat-pill {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.2);
}

/* Subject Theme Accents */
.theme-fen { --sub-color: #059669; --sub-bg: #ecfdf5; --sub-gradient: linear-gradient(135deg, #059669, #10b981); }
.theme-mat { --sub-color: #4f46e5; --sub-bg: #eef2ff; --sub-gradient: linear-gradient(135deg, #4f46e5, #6366f1); }
.theme-turkce { --sub-color: #e11d48; --sub-bg: #fff1f2; --sub-gradient: linear-gradient(135deg, #e11d48, #f43f5e); }
.theme-sosyal { --sub-color: #d97706; --sub-bg: #fffbeb; --sub-gradient: linear-gradient(135deg, #d97706, #f59e0b); }
.theme-din { --sub-color: #0d9488; --sub-bg: #f0fdfa; --sub-gradient: linear-gradient(135deg, #0d9488, #14b8a6); }
.theme-ingilizce { --sub-color: #2563eb; --sub-bg: #eff6ff; --sub-gradient: linear-gradient(135deg, #2563eb, #38bdf8); }

/* Subject Cards Grid (Dashboard) */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.subject-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  background: var(--sub-bg, #eef2ff);
  color: var(--sub-color, #4f46e5);
}

.card-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--sub-bg, #f1f5f9);
  color: var(--sub-color, #475569);
}

.subject-card h3 {
  font-size: 1.35rem;
  margin-bottom: 8px;
  color: var(--text);
}

.subject-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 18px;
  flex-grow: 1;
}

.topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.tag {
  background: #f1f5f9;
  color: #475569;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.btn-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--sub-gradient, linear-gradient(135deg, #4f46e5, #6366f1));
  color: white;
  text-decoration: none;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: opacity 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn-start:hover {
  opacity: 0.92;
}

/* Page Header in Subject Pages */
.lesson-header {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.lesson-info h1 {
  font-size: 1.8rem;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-info p {
  color: var(--text-muted);
  font-size: 1rem;
}

.score-box {
  background: var(--sub-bg, #f8fafc);
  border: 2px solid var(--sub-color, #4f46e5);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  text-align: center;
  min-width: 140px;
}

.score-box .score-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--sub-color, #4f46e5);
  line-height: 1;
}

.score-box .score-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Tabs */
.tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

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

.tab-btn.active {
  color: var(--sub-color, var(--primary));
  border-bottom-color: var(--sub-color, var(--primary));
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Audio Master Control */
.audio-bar {
  background: #1e293b;
  color: white;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-md);
}

.audio-bar-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-icon-pulse {
  width: 36px;
  height: 36px;
  background: #334155;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.audio-bar.speaking .audio-icon-pulse {
  background: var(--success);
  animation: pulse-ring 1.5s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.audio-controls {
  display: flex;
  gap: 8px;
}

.btn-audio {
  background: #334155;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-audio:hover {
  background: #475569;
}

.btn-audio.primary {
  background: var(--sub-color, var(--primary));
}

.btn-audio.primary:hover {
  filter: brightness(1.1);
}

/* Hap Bilgiler (Quick Summary) Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.summary-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 20px;
  border-left: 4px solid var(--sub-color, var(--primary));
  box-shadow: var(--shadow-sm);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.summary-card h4 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-card ul {
  padding-left: 20px;
  color: #334155;
}

.summary-card li {
  margin-bottom: 8px;
  font-size: 0.95rem;
}

/* Question Cards */
.question-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  padding: 24px;
  transition: all 0.25s;
}

.question-card:hover {
  box-shadow: var(--shadow-md);
}

.question-card.active-reading {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.q-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.q-badge {
  background: var(--sub-bg, #eef2ff);
  color: var(--sub-color, var(--primary));
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 20px;
}

.q-points {
  background: #fef3c7;
  color: #b45309;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 20px;
}

.q-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.5;
}

.q-image-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}

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

.q-interactive-area {
  margin-top: 16px;
  margin-bottom: 16px;
}

.text-answer-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  min-height: 80px;
  resize: vertical;
}

.text-answer-input:focus {
  outline: none;
  border-color: var(--sub-color, var(--primary));
}

.q-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.btn-q {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-q-audio {
  background: #f1f5f9;
  color: #334155;
}
.btn-q-audio:hover {
  background: #e2e8f0;
}

.btn-q-hint {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fef08a;
}
.btn-q-hint:hover {
  background: #fef08a;
}

.btn-q-solution {
  background: var(--sub-bg, #eef2ff);
  color: var(--sub-color, var(--primary));
  border-color: var(--sub-color, var(--primary));
}
.btn-q-solution:hover {
  background: var(--sub-color, var(--primary));
  color: white;
}

/* Collapsible Solution / Hint Boxes */
.hint-box, .solution-box {
  display: none;
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  animation: fadeIn 0.25s ease;
}

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

.hint-box.show {
  display: block;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  color: #92400e;
}

.solution-box.show {
  display: block;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.solution-box h5 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: #15803d;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Grading / Scoring Buttons inside Card */
.self-grading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.self-grading span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.grade-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: white;
  cursor: pointer;
  transition: all 0.2s;
}

.grade-btn.full:hover, .grade-btn.full.active {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.grade-btn.half:hover, .grade-btn.half.active {
  background: #f59e0b;
  color: white;
  border-color: #f59e0b;
}

.grade-btn.zero:hover, .grade-btn.zero.active {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* PDF Viewer Grid in Tab 3 */
.pdf-pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.pdf-page-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pdf-page-card .page-head {
  padding: 10px 16px;
  background: #f1f5f9;
  font-weight: 700;
  font-size: 0.9rem;
  color: #334155;
  display: flex;
  justify-content: space-between;
}

.pdf-page-card img {
  width: 100%;
  display: block;
}

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

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

.modal-content {
  background: white;
  max-width: 500px;
  width: 100%;
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-score {
  font-size: 4rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin: 16px 0;
}

.btn-modal {
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

@media (max-width: 768px) {
  .hero h1 { font-size: 1.7rem; }
  .subject-grid { grid-template-columns: 1fr; }
  .nav-bar { flex-direction: column; gap: 12px; }
  .lesson-header { flex-direction: column; text-align: center; }
  .tabs-nav { justify-content: flex-start; }
}
