:root {
  --bg: #eef2f8;
  --bg-strong: #dde5f0;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #f8faff;
  --text: #0f1e3a;
  --muted: #4a5b7a;
  --line: rgba(30, 60, 120, 0.12);
  --brand: #1a4fa0;
  --brand-deep: #102d6e;
  --accent: #e6a700;
  --success: #146c43;
  --danger: #9c2f2f;
  --shadow: 0 24px 60px rgba(10, 30, 80, 0.10);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 220, 50, 0.12), transparent 30%),
    radial-gradient(circle at right 20%, rgba(26, 79, 160, 0.12), transparent 28%),
    linear-gradient(160deg, #eef2f8 0%, #dde5f0 54%, #e8edf8 100%);
}

body.is-loading {
  overflow: hidden;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.deploy-note {
  margin-bottom: 22px;
  padding: 16px 18px;
  color: #102d6e;
  background: rgba(26, 79, 160, 0.09);
  border: 1px solid rgba(26, 79, 160, 0.2);
  border-radius: 18px;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy,
.hero-stats,
.panel {
  backdrop-filter: blur(16px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 12px;
  color: var(--brand-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.lead {
  max-width: 48ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 20px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(11, 122, 117, 0.08);
}

.stat-card.accent {
  background: linear-gradient(145deg, rgba(26, 79, 160, 0.93), rgba(16, 45, 110, 0.95));
  color: #f0f6ff;
}

.stat-label {
  color: inherit;
  opacity: 0.78;
  font-size: 0.9rem;
}

.stat-value {
  font-size: 1.25rem;
  line-height: 1.2;
}

.workspace {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
  margin-bottom: 22px;
}

.panel {
  padding: 28px;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.generator-form {
  display: grid;
  gap: 12px;
}

.subject-fieldset {
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(36, 25, 15, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.45);
}

.subject-fieldset legend {
  padding: 0 8px;
  font-weight: 800;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.subject-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(11, 122, 117, 0.1);
  cursor: pointer;
}

.subject-chip input {
  accent-color: var(--brand);
}

label {
  font-weight: 700;
}

select,
textarea,
input[type="number"] {
  width: 100%;
  padding: 14px 16px;
  color: var(--text);
  font: inherit;
  border: 1px solid rgba(36, 25, 15, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  outline: none;
}

select:focus,
textarea:focus,
input[type="number"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 122, 117, 0.14);
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.hint,
.empty-state,
.output-meta,
.topic-card p {
  color: var(--muted);
}

.primary-button {
  width: 100%;
  padding: 15px 18px;
  border: 0;
  border-radius: 999px;
  color: #0f1e3a;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #FFED00, #e6a700);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 16px 28px rgba(230, 167, 0, 0.30);
}

.primary-button:hover {
  transform: translateY(-1px);
}

.message {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid transparent;
}

.message.success {
  color: var(--success);
  background: rgba(20, 108, 67, 0.08);
  border-color: rgba(20, 108, 67, 0.16);
}

.message.error {
  color: var(--danger);
  background: rgba(156, 47, 47, 0.08);
  border-color: rgba(156, 47, 47, 0.16);
}

.topic-grid {
  display: grid;
  gap: 12px;
}

.topic-card {
  padding: 16px 18px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(69, 43, 22, 0.08);
}

.topic-card h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.outputs-panel {
  padding-bottom: 18px;
}

.output-list {
  display: grid;
  gap: 12px;
}

.output-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(69, 43, 22, 0.08);
}

.output-title {
  margin-bottom: 4px;
  font-weight: 800;
}

.output-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.output-actions a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--brand-deep);
  text-decoration: none;
  font-weight: 700;
  background: rgba(11, 122, 117, 0.1);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(21, 15, 10, 0.42);
  backdrop-filter: blur(8px);
}

.loading-card {
  width: min(460px, 100%);
  padding: 32px 28px;
  text-align: center;
  border-radius: 28px;
  background: #f0f5ff;
  box-shadow: 0 30px 70px rgba(10, 30, 80, 0.2);
}

.loading-card h2 {
  margin-bottom: 10px;
}

.loading-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.loading-spinner {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 5px solid rgba(11, 122, 117, 0.14);
  border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Havuz İstatistikleri ────────────────────────────────────────────────── */
.stats-panel {
  margin-bottom: 22px;
}

.stats-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.stats-bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 48px;
  align-items: center;
  gap: 12px;
}

.stats-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(26, 79, 160, 0.09);
  overflow: hidden;
}

.stats-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-deep));
  transition: width 0.6s ease;
  min-width: 4px;
}

.stats-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-deep);
  text-align: right;
}

.stats-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--muted);
}

/* ── Önizleme Paneli ─────────────────────────────────────────────────────── */
.preview-panel {
  margin-bottom: 22px;
}

.preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dl-button {
  padding: 11px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: transform 0.15s;
}

.dl-button:hover {
  transform: translateY(-1px);
}

.dl-docx {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fffdf8;
}

.dl-json {
  background: rgba(11, 122, 117, 0.12);
  color: var(--brand-deep);
}

.subject-preview {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}

.subject-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.6);
  list-style: none;
  user-select: none;
}

.subject-summary::-webkit-details-marker { display: none; }

.subject-summary:hover {
  background: rgba(11, 122, 117, 0.06);
}

.subject-name {
  font-weight: 800;
  font-size: 1rem;
}

.subject-count {
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(11, 122, 117, 0.1);
  padding: 4px 12px;
  border-radius: 999px;
}

.question-list {
  padding: 16px;
  display: grid;
  gap: 14px;
  background: rgba(255, 252, 247, 0.6);
}

.question-card {
  padding: 16px 18px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(69, 43, 22, 0.08);
}

.q-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.q-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.q-tag {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.diagram-tag {
  background: rgba(212, 105, 63, 0.12);
  color: var(--accent);
}

.topic-tag {
  background: rgba(11, 122, 117, 0.1);
  color: var(--brand-deep);
}

.flag-tag {
  background: rgba(156, 47, 47, 0.1);
  color: var(--danger);
  cursor: help;
}

.verify-tag {
  background: rgba(20, 108, 67, 0.1);
  color: var(--success);
}

.q-text {
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 12px;
  color: var(--text);
}

.q-diagram {
  margin: 12px 0;
  text-align: center;
}

.diagram-img {
  max-width: 100%;
  width: min(480px, 100%);
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

.q-diagram-fallback {
  padding: 10px;
  background: rgba(212, 105, 63, 0.06);
  border-radius: 10px;
  display: inline-block;
}

.q-options {
  display: grid;
  gap: 6px;
}

.q-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  border: 1px solid transparent;
  background: rgba(0,0,0,0.02);
}

.q-option.correct {
  background: rgba(20, 108, 67, 0.08);
  border-color: rgba(20, 108, 67, 0.2);
  color: var(--success);
}

.opt-key {
  font-weight: 800;
  width: 20px;
  flex-shrink: 0;
}

.opt-text {
  flex: 1;
}

.opt-check {
  font-weight: 700;
  color: var(--success);
}

.regen-form {
  padding: 12px 16px;
  background: rgba(0,0,0,0.02);
  border-top: 1px solid var(--line);
}

.regen-button {
  width: 100%;
  padding: 11px;
  border: 1.5px dashed rgba(11, 122, 117, 0.35);
  border-radius: 12px;
  background: transparent;
  color: var(--brand-deep);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.regen-button:hover {
  background: rgba(11, 122, 117, 0.07);
  border-color: var(--brand);
}

/* ── Public klasörüne de kopyala (web_app.py /styles.css route'u public'ten okuyor) */

@media (max-width: 900px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .panel,
  .hero-copy {
    padding: 22px;
  }

  .output-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .subject-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Mode Tabs ─────────────────────────────────────────── */
.mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border, #e2e8f0);
  padding-bottom: 0;
}

.mode-tab {
  padding: 10px 22px;
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color 0.15s, border-color 0.15s;
}

.mode-tab:hover {
  color: var(--accent, #2563eb);
}

.mode-tab.active {
  color: var(--accent, #2563eb);
  border-bottom-color: var(--accent, #2563eb);
}

/* ── Branş info box ─────────────────────────────────────── */
.brans-info-box {
  background: var(--accent-light, #eff6ff);
  border: 1px solid var(--accent, #2563eb);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent, #2563eb);
  margin-bottom: 4px;
  min-height: 20px;
}
