/* ==========================================================================
   telc Deutsch B1 Planner Stylesheet (Gemeinsam etwas planen)
   Modern, High-Contrast, Responsive with Print Support
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --dark: #0f172a;
  --slate: #334155;
  --muted: #64748b;
  --light-bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --font-ar: 'Cairo', system-ui, -apple-system, sans-serif;
  --font-de: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-ar);
  background-color: #f1f5f9;
  color: var(--dark);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
}

/* ---------------- Top App Header ---------------- */
.app-header {
  background: var(--card-bg);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 20px;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 2rem;
  background: #fef3c7;
  border: 1.5px solid #fbbf24;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.brand-group h1 {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--dark);
}

.brand-group p {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-nav {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  border: 1.5px solid var(--border-strong);
  background: #ffffff;
  color: var(--dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-nav:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn-print {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

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

/* ---------------- TELC Exam Training Hub ---------------- */
.telc-hub-section {
  background: #ffffff;
  border: 2px solid #3b82f6;
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
  margin-bottom: 20px;
}

.telc-hub-header {
  margin-bottom: 12px;
}

.telc-hub-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.telc-hub-title .hub-icon {
  font-size: 2rem;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.telc-hub-title h3 {
  font-size: 1.15rem;
  font-weight: 900;
  color: #1e3a8a;
  margin-bottom: 2px;
}

.telc-hub-title p {
  font-size: 0.84rem;
  color: #64748b;
  font-weight: 600;
}

.telc-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.telc-hub-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.telc-hub-card:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.15);
}

.telc-hub-card.active {
  background: #eff6ff;
  border-color: #2563eb;
  border-width: 2px;
}

.hub-card-icon {
  font-size: 1.8rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hub-card-info {
  flex: 1;
  min-width: 0;
}

.hub-card-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 900;
  color: #2563eb;
  background: #dbeafe;
  padding: 1px 6px;
  border-radius: 4px;
  margin-bottom: 3px;
}

.hub-card-info h4 {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 2px;
  line-height: 1.3;
}

.hub-card-info p {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.3;
}

.hub-card-status {
  font-size: 0.72rem;
  font-weight: 800;
  color: #1e40af;
  background: #bfdbfe;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.hub-card-go {
  font-size: 0.72rem;
  font-weight: 800;
  color: #2563eb;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

/* ---------------- Exam Strategy Hero ---------------- */
.exam-hero {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  padding: 18px 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.exam-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.badge-pill {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 800;
}

.btn-toggle-info {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.strategy-content {
  margin-top: 16px;
  border-top: 1px solid #f1f5f9;
  padding-top: 14px;
}

.exam-rule-card {
  background: #f8fafc;
  border-right: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.exam-rule-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 6px;
}

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

.formula-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  position: relative;
}

.formula-card.step-1 { border-top: 3px solid #3b82f6; }
.formula-card.step-2 { border-top: 3px solid #ef4444; }
.formula-card.step-3 { border-top: 3px solid #10b981; }
.formula-card.step-4 { border-top: 3px solid #f59e0b; }
.formula-card.step-5 { border-top: 3px solid #8b5cf6; }

.f-num {
  width: 24px;
  height: 24px;
  background: #0f172a;
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.f-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.f-code {
  font-family: var(--font-de);
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e40af;
  direction: ltr;
  text-align: left;
  margin-bottom: 6px;
  background: #eff6ff;
  padding: 4px 6px;
  border-radius: 4px;
}

.f-desc {
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.35;
}

/* ---------------- Filter & Search Section ---------------- */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.search-wrap {
  position: relative;
}

.search-box {
  width: 100%;
  padding: 14px 20px 14px 40px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  font-size: 0.98rem;
  font-family: inherit;
  font-weight: 600;
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s;
}

.search-box:focus {
  border-color: var(--primary);
}

.btn-clear-search {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: #cbd5e1;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 0.8rem;
  color: #334155;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-chip {
  padding: 7px 14px;
  border-radius: 20px;
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.cat-chip:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.cat-chip.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.cat-chip.cat-fav.active {
  background: #f59e0b;
  border-color: #d97706;
  color: #0f172a;
}

/* ---------------- Cards Grid ---------------- */
.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Individual Planner Card */
.planner-card {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.planner-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.badge-topic {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 6px;
}

.btn-card-fav {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: #cbd5e1;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-card-fav.is-fav {
  color: #f59e0b;
}

/* Titles */
.card-title-de {
  font-family: var(--font-de);
  font-size: 1.5rem;
  font-weight: 900;
  color: #0f172a;
  direction: ltr;
  text-align: left;
  line-height: 1.3;
}

.card-title-ar {
  font-size: 1.18rem;
  font-weight: 800;
  color: #1e3a8a;
  margin-top: 4px;
  margin-bottom: 16px;
}

/* Official Exam Task Box (Scenario & Points) */
.scenario-box {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-right: 5px solid #0284c7;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}

.scenario-label {
  font-size: 0.82rem;
  font-weight: 900;
  color: #0369a1;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scenario-de {
  font-family: var(--font-de);
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  direction: ltr;
  text-align: left;
  line-height: 1.4;
  margin-bottom: 4px;
}

.scenario-ar {
  font-size: 0.92rem;
  color: #475569;
  font-weight: 600;
  margin-bottom: 12px;
}

.bullet-points-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}

.bullet-points-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.bullet-point-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.35;
}

.bp-de {
  font-family: var(--font-de);
  font-weight: 800;
  color: #0f172a;
  direction: ltr;
  text-align: left;
}

.bp-ar {
  color: #475569;
  font-weight: 600;
}

/* ---------------- Dialogue Section ---------------- */
.dialogue-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.dialogue-turn {
  border-radius: 12px;
  padding: 12px 16px;
  border: 1.5px solid #cbd5e1;
}

.dialogue-turn.speaker-A {
  background: #f8fafc;
  border-right: 4px solid #2563eb;
}

.dialogue-turn.speaker-B {
  background: #fffbeb;
  border-right: 4px solid #d97706;
}

.turn-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.turn-speaker-badge {
  font-size: 0.78rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 6px;
}

.speaker-A .turn-speaker-badge {
  background: #dbeafe;
  color: #1e40af;
}

.speaker-B .turn-speaker-badge {
  background: #fef3c7;
  color: #92400e;
}

.turn-formula-tag {
  font-size: 0.72rem;
  font-weight: 800;
  color: #475569;
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.turn-german {
  font-family: var(--font-de);
  font-size: 1.15rem;
  font-weight: 800;
  color: #000000;
  direction: ltr;
  text-align: left;
  line-height: 1.35;
  margin-bottom: 6px;
}

.kw-planner-koennten {
  color: #0284c7;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-color: #0284c7;
  text-decoration-thickness: 2.5px;
  background: #f0f9ff;
  padding: 1px 4px;
  border-radius: 4px;
}

.kw-planner-weil {
  color: #d97706;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-color: #d97706;
  text-decoration-thickness: 2px;
  background: #fffbeb;
  padding: 1px 4px;
  border-radius: 4px;
}

.turn-german u {
  text-decoration: underline;
  text-decoration-thickness: 2.5px;
}

.turn-arabic {
  font-size: 0.96rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
}

.turn-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.btn-turn-audio {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-turn-audio:hover {
  background: #f1f5f9;
}

/* ---------------- Secret Tip & Redemittel Footer ---------------- */
.card-extras {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1.5px solid #e2e8f0;
  padding-top: 14px;
}

.secret-tip-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-right: 4px solid #16a34a;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #14532d;
  line-height: 1.4;
}

.redemittel-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rm-pill {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
  line-height: 1.35;
}

.rm-de {
  font-family: var(--font-de);
  font-weight: 800;
  color: #0f172a;
  direction: ltr;
}

.rm-ar {
  color: #475569;
  font-weight: 600;
}

.card-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.btn-play-all {
  background: #0f172a;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-play-all:hover {
  background: #334155;
}

/* ---------------- Slideshow Modal ---------------- */
.slideshow-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.slideshow-box {
  background: #ffffff;
  border-radius: 16px;
  width: 95%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.slideshow-head {
  padding: 14px 20px;
  border-bottom: 1.5px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slideshow-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.slideshow-controls {
  padding: 12px 20px;
  border-top: 1.5px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.btn-slide-nav {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

.btn-slide-speak {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

/* ---------------- Mobile & Samsung Galaxy S25 Ultra Optimizations ---------------- */
@media (max-width: 680px) {
  body {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .app-header {
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  }

  .brand-group h1 {
    font-size: 1.05rem;
  }

  .brand-group p {
    font-size: 0.78rem;
  }

  .header-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .btn-nav {
    flex: 1 1 auto;
    justify-content: center;
    font-size: 0.78rem;
    padding: 7px 10px;
  }

  .container {
    margin: 14px auto;
    padding: 0 10px;
  }

  .telc-hub-section {
    padding: 12px;
    border-radius: 12px;
  }

  .telc-hub-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

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

  .category-chips {
    gap: 6px;
  }

  .cat-chip {
    padding: 7px 12px;
    font-size: 0.78rem;
  }

  .planner-card {
    padding: 14px 12px;
    border-radius: 14px;
  }

  .card-title-de {
    font-size: 1.15rem;
  }

  .card-title-ar {
    font-size: 0.95rem;
  }

  .scenario-box {
    padding: 12px 10px;
  }

  .bullet-points-grid {
    grid-template-columns: 1fr;
  }

  .turn-german {
    font-size: 1.02rem;
  }

  .turn-arabic {
    font-size: 0.88rem;
  }

  .btn-turn-audio {
    padding: 8px 14px;
    font-size: 0.82rem;
    min-height: 40px;
  }

  .card-action-bar {
    flex-direction: column;
    gap: 8px;
  }

  .btn-play-all {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    font-size: 0.9rem;
  }

  .slideshow-box {
    width: 95vw;
    max-height: 90vh;
  }
}

/* ---------------- Print Engine (@media print) ---------------- */
.print-planner-container {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 8mm;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .exam-hero,
  .filter-section,
  .cards-grid,
  .slideshow-modal,
  .print-modal-overlay {
    display: none !important;
  }

  .print-planner-container {
    display: block !important;
  }

  .print-page-a4 {
    page-break-after: always;
    page-break-inside: avoid;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 96vh;
    padding: 10px 0;
  }

  .print-page-a4:last-child {
    page-break-after: auto;
  }

  .print-header {
    border-bottom: 2px solid #000;
    padding-bottom: 4px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 900;
  }

  .print-topic-card {
    border: 2px solid #000;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: #fff !important;
    page-break-inside: avoid;
  }

  .print-topic-title-de {
    font-family: var(--font-de);
    font-size: 1.45rem;
    font-weight: 900;
    direction: ltr;
    text-align: left;
    margin-bottom: 2px;
  }

  .print-topic-title-ar {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 10px;
  }

  .print-scenario {
    border: 1px solid #000;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 0.82rem;
  }

  .print-dialogue-turn {
    border-bottom: 1px dashed #64748b;
    padding: 6px 0;
    font-size: 0.95rem;
  }

  .print-speaker {
    font-weight: 900;
  }

  .print-de {
    font-family: var(--font-de);
    font-weight: 800;
    direction: ltr;
    text-align: left;
    font-size: 1.05rem;
  }

  .print-ar {
    font-size: 0.88rem;
    font-weight: 700;
  }

  .kw-planner-koennten {
    color: #000000 !important;
    font-weight: 900 !important;
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    background: transparent !important;
    padding: 0 !important;
  }

  .kw-planner-weil {
    color: #000000 !important;
    font-weight: 900 !important;
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    background: transparent !important;
    padding: 0 !important;
  }
}
