/* ==========================================================================
   style.css – Zentrales Stylesheet für FOS Chemie (olaf-menkhaus.de)
   Unterstützt: 1. Schüler-Webansicht | 2. Smartboard-Modus | 3. DIN-A4-Druck
   ========================================================================== */

:root {
  --primary: #0369a1;
  --primary-dark: #0c4a6e;
  --primary-light: #e0f2fe;
  --accent: #d97706;
  --accent-light: #fef3c7;
  --success: #15803d;
  --success-light: #dcfce7;
  --danger: #b91c1c;
  --danger-light: #fee2e2;
  --bg: #f1f5f9;
  --text: #0f172a;
}

* {
  box-sizing: border-box;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

body {
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  font-size: 10.5pt;
  color: var(--text);
  line-height: 1.45;
  margin: 0;
  background: var(--bg);
}

/* ==================== SMARTBOARD-MODUS (Für die elektronische Tafel) ==================== */
body.board-mode { font-size: 15.5pt; }
body.board-mode .app-wrapper { max-width: 1440px; }
body.board-mode .header-title-bar { font-size: 19pt; padding: 12px 20px; }
body.board-mode .station-header { font-size: 15.5pt; padding: 10px 18px; }
body.board-mode .step-tab { font-size: 13.5pt; padding: 10px; }
body.board-mode input[type="text"],
body.board-mode select.inline-select,
body.board-mode .btn { font-size: 14pt; padding: 7px 14px; }
body.board-mode .math-highlight,
body.board-mode .math-formula { font-size: 18pt; }

/* ==================== GRUNDLAYOUT & CONTAINER ==================== */
.app-wrapper {
  max-width: 1020px;
  margin: 16px auto;
  padding: 0 14px;
}

.sheet {
  display: none;
  background: #ffffff;
  width: 186mm;
  min-height: 275mm;
  margin: 0 auto;
  padding: 10mm;
  box-sizing: border-box;
}

/* ==================== ECHTER HEADER ==================== */
.header-card {
  border: 2px solid var(--primary);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.header-title-bar {
  background: var(--primary);
  color: #ffffff;
  padding: 8px 14px;
  font-size: 13pt;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.header-info-bar {
  background: #f8fafc;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9pt;
  border-top: 1px solid #bae6fd;
  flex-wrap: wrap;
  gap: 10px;
}
.meta-field {
  border-bottom: 1px dotted #334155;
  display: inline-block;
  min-width: 130px;
  text-align: center;
  font-weight: 600;
}

/* ==================== INHALTLICHE BLÖCKE (STATIONEN) ==================== */
.station-box {
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.station-header {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 9.8pt;
  padding: 6px 12px;
  border-bottom: 1.5px solid #bae6fd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.station-body { padding: 10px 14px; }

ul { margin: 4px 0 4px 20px; padding: 0; }
li { margin-bottom: 4px; }
p { margin: 4px 0; }

/* ==================== NAVIGATION & TABS ==================== */
.top-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.step-nav { display: grid; gap: 6px; margin-bottom: 14px; }
.step-nav.cols-4 { grid-template-columns: repeat(4, 1fr); }
.step-nav.cols-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 720px) {
  .step-nav.cols-4, .step-nav.cols-5 { grid-template-columns: 1fr 1fr; }
}
.step-tab {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  font-size: 9.5pt;
  color: #475569;
  cursor: pointer;
}
.step-tab:hover { border-color: var(--primary); color: var(--primary); }
.step-tab.active { background: var(--primary); color: #ffffff; border-color: var(--primary); }
.step-tab.done { border-color: var(--success); background: var(--success-light); color: var(--success); }
.step-tab.done.active { background: var(--success); color: #ffffff; }

.station-view { display: none; }
.station-view.active { display: block; }

/* ==================== TAFELBILD- & LERNPFAD-KOMPONENTEN ==================== */
.timeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 10px 0; }
@media (max-width: 800px) { .timeline { grid-template-columns: 1fr; } }

.time-card, .info-box {
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  padding: 14px;
  background: #f8fafc;
}
.year-badge {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 6px;
}
.scientist-name { font-size: 1.15em; font-weight: 800; margin: 4px 0; }

.compare-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 16px; align-items: stretch; }
@media (max-width: 750px) { .compare-grid { grid-template-columns: 1fr; } }

.gap {
  display: inline-block;
  min-width: 95px;
  background: #ffffff;
  border: 2px dashed #64748b;
  border-radius: 6px;
  color: transparent;
  padding: 1px 10px;
  margin: 0 2px;
  cursor: pointer;
  text-align: center;
  user-select: none;
}
.gap::after { content: "👆 Tippen"; color: #64748b; font-size: 0.85em; font-weight: 600; }
.gap.revealed { background: var(--success-light); border: 2px solid var(--success); color: var(--success); font-weight: 700; }
.gap.revealed::after { content: ""; }

.info-popup-btn {
  background: #e0f2fe;
  color: #0369a1;
  border: 1.5px solid #0284c7;
  padding: 5px 10px;
  font-size: 0.9em;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 6px;
}
.popup-box, .hint-box {
  display: none;
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-left: 4px solid #d97706;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 8px;
  font-size: 0.92em;
}
.popup-box.show, .hint-box.show { display: block; }

.math-highlight {
  background: #f8fafc;
  border: 1px solid #94a3b8;
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  padding: 6px 10px;
  margin: 6px 0;
  font-family: 'Cambria Math', Georgia, serif;
  font-size: 10.5pt;
  font-weight: bold;
  text-align: center;
}
.math-step {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-left: 6px solid var(--primary);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  flex-wrap: wrap;
  gap: 10px;
}
.math-step.hidden-step .math-formula { filter: blur(8px); opacity: 0.25; user-select: none; }
.math-step.hidden-step::after {
  content: "👆 Rechenschritt aufdecken";
  background: var(--primary);
  color: #fff;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 700;
}
.math-formula { font-size: 1.2em; font-weight: 800; font-family: 'Cambria Math', Georgia, serif; }

.frac { display: inline-block; vertical-align: middle; text-align: center; font-size: 95%; margin: 0 3px; }
.frac > span { display: block; padding: 0 4px; }
.frac > span.top { border-bottom: 1.5px solid currentColor; }

/* PSE Mini-Kacheln */
.pse-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 12px 0;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  align-items: center;
}
.pse-mini {
  width: 68px;
  height: 72px;
  border: 2px solid #1e293b;
  border-radius: 5px;
  background: #fef9c3;
  padding: 3px 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 8pt;
}
.pse-mini-top { display: flex; justify-content: space-between; font-weight: 700; }
.pse-mini-sym { font-size: 16pt; font-weight: 800; text-align: center; line-height: 1; }
.pse-mini-name { font-size: 6.5pt; text-align: center; font-weight: 600; }

/* Aufgaben, Formeldreieck & Mol-Brücke */
.task-row {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 10px;
  margin-bottom: 8px;
}
.input-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
input[type="text"], select.inline-select {
  border: 1.5px solid #64748b;
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 10pt;
  font-weight: 700;
  background: #ffffff;
}
input[type="text"] { width: 95px; text-align: center; }

.btn {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 6px 14px;
  font-size: 9.5pt;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--primary-dark); }
.btn-print { background: #0f172a; }
.btn-secondary { background: #64748b; }
.btn-hint { background: #e0f2fe; color: #0369a1; border: 1px solid #0284c7; padding: 4px 10px; font-size: 8.5pt; }

.feedback { margin-top: 6px; padding: 6px 10px; border-radius: 5px; font-size: 0.95em; display: none; }
.feedback.ok { display: block; background: var(--success-light); color: var(--success); border-left: 4px solid var(--success); font-weight: 600; }
.feedback.err { display: block; background: var(--danger-light); color: var(--danger); border-left: 4px solid var(--danger); }

.triangle-grid { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: center; }
.bridge-grid { display: grid; grid-template-columns: 1fr 85px 1fr 85px 1fr; gap: 6px; align-items: center; text-align: center; margin: 12px 0; }
@media (max-width: 700px) { .triangle-grid, .bridge-grid { grid-template-columns: 1fr; } }

.bridge-card { border: 2px solid var(--primary); border-radius: 8px; padding: 8px; background: #f0f9ff; }
.bridge-card.mol { border-color: var(--success); background: var(--success-light); }
.bridge-arrow { font-size: 8.5pt; font-weight: 700; color: #92400e; background: var(--accent-light); padding: 4px; border-radius: 6px; border: 1px solid #f59e0b; }

.nav-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; flex-wrap: wrap; gap: 8px; }

.write-line {
  display: inline-block;
  border-bottom: 1.2px dotted #334155;
  min-width: 100px;
  height: 13px;
  text-align: center;
  font-weight: 700;
  color: #0369a1;
  padding: 0 4px;
}

/* ==================== DRUCK-KORREKTUR (DIN A4 ohne blauen Außenrahmen) ==================== */
@media print {
  @page { size: A4 portrait; margin: 10mm 12mm; }
  body { background: #ffffff !important; font-size: 9.5pt !important; line-height: 1.4 !important; }
  .app-wrapper { display: none !important; }
  .sheet {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 186mm !important;
    min-height: auto !important;
    box-shadow: none !important;
    border: none !important;
  }
  .header-card, .station-box { box-shadow: none !important; }
}