/* ===== CERMAT Presentations — Shared Styles ===== */
/* Accent colors (--accent, --accent-light, --accent-dark) are set per-file */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg: #FFF8F0;
  --surface: #FFFFFF;
  --text: #2D1B06;
  --text-muted: #8B7355;
  --primary: #FF6B35;
  --success: #2EC4B6;
  --success-light: #D4F5F2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  /* Aliases for backward compat */
  --card: var(--surface);
  --text-light: var(--text-muted);
}

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

body {
  font-family: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  padding-bottom: 90px;
  background-image:
    url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 40V0h40' fill='none' stroke='%23E8D5C0' stroke-width='0.5' opacity='0.4'/%3E%3C/svg%3E");
}

/* ===== Typography ===== */

header, header h1, .krok-header, .vysledek-label, .vysledek-cislo,
.tabs-label, .shrnuti-header h2, .pravidlo h3 {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif;
}

/* ===== Header ===== */

header {
  background: linear-gradient(135deg, var(--accent, #FF6B35), var(--accent-dark, #C44D1A));
  color: white;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255,255,255,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 0.3rem;
  font-weight: 800;
  position: relative;
}

header .popis {
  opacity: 0.92;
  font-size: 1.05rem;
  position: relative;
}

/* ===== Back link bar ===== */

.back-bar {
  background: rgba(45, 27, 6, 0.9);
  padding: 0.4rem 1.5rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.back-bar a {
  color: #C9B99A;
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}

.back-bar a:hover {
  color: #F5E6D0;
}

/* ===== Rule box ===== */

.pravidlo-box {
  max-width: 800px;
  margin: -1rem auto 0;
  padding: 0 1.5rem;
}

.pravidlo {
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.2rem 1.5rem;
  box-shadow: 0 4px 20px rgba(45, 27, 6, 0.08);
  border-left: 5px solid var(--warning);
}

.pravidlo h3 {
  color: #92400E;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.pravidlo ol {
  padding-left: 1.5rem;
  font-size: 0.95rem;
}

.pravidlo li { margin-bottom: 0.2rem; }

.pravidlo .priority-1 { color: var(--danger); font-weight: 700; }
.pravidlo .priority-2 { color: var(--accent, var(--primary)); font-weight: 600; }
.pravidlo .priority-3 { color: var(--text-muted); }

/* ===== Problem tabs ===== */

.tabs-wrapper {
  max-width: 800px;
  margin: 1.2rem auto 0;
  padding: 0 1.5rem;
}

.tabs-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.problem-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.problem-tab {
  flex-shrink: 0;
  padding: 0.5rem 1.1rem;
  border: 2px solid #E8D5C0;
  border-radius: 2rem;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  font-family: inherit;
  color: var(--text);
}

.problem-tab.active {
  background: var(--accent, var(--primary));
  color: white;
  border-color: var(--accent, var(--primary));
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transform: scale(1.03);
}

.problem-tab:hover:not(.active) {
  border-color: var(--accent, var(--primary));
  color: var(--accent, var(--primary));
  background: rgba(255, 107, 53, 0.06);
}

.problem-tab .exam-badge {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ===== Main content ===== */

.content {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.uloha { display: none; }
.uloha.active { display: block; }

.zadani {
  background: var(--accent-light, #FFF0EB);
  border-left: 4px solid var(--accent, var(--primary));
  padding: 1rem 1.2rem;
  border-radius: 0 0.75rem 0.75rem 0;
  margin-bottom: 1.2rem;
}

.zadani-label {
  font-weight: 700;
  color: var(--accent-dark, #C44D1A);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.zadani-body {
  font-size: 1rem;
}

.zadani-body .body-label {
  font-weight: 600;
  margin-top: 0.5rem;
}

/* ===== Steps ===== */

[data-step] {
  scroll-margin-bottom: 90px;
}

.krok {
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 1rem 1.2rem;
  margin-bottom: 0.8rem;
  box-shadow: 0 2px 8px rgba(45, 27, 6, 0.06);
  display: none;
  border-left: 4px solid transparent;
  transition: border-color 0.3s;
}

.krok.visible {
  display: block;
  animation: slideIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-left-color: var(--accent, var(--primary));
}

.krok-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--accent-dark, #C44D1A);
  font-size: 0.95rem;
}

.krok-num {
  background: var(--accent, var(--primary));
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.krok p { margin-bottom: 0.5rem; }

/* ===== Math expressions ===== */

.math {
  font-size: 1.25rem;
  font-weight: 500;
  background: #FFF5EE;
  padding: 0.7rem 1rem;
  border-radius: 0.6rem;
  text-align: center;
  margin: 0.6rem 0;
  overflow-x: auto;
  font-family: 'Cambria Math', 'Times New Roman', Georgia, serif;
  border: 1px solid #F0DDD0;
}

.math .hl {
  background: var(--warning-light);
  padding: 0.1em 0.3em;
  border-radius: 0.25rem;
  border-bottom: 2px solid var(--warning);
}

.math .res {
  color: var(--success);
  font-weight: 700;
}

.math .unknown {
  display: inline-block;
  width: 2rem;
  height: 1.8rem;
  border: 2px dashed var(--danger);
  border-radius: 0.3rem;
  vertical-align: middle;
  margin: 0 0.2rem;
  background: #FEF2F2;
}

.math .found {
  color: var(--danger);
  font-weight: 800;
  border-bottom: 3px solid var(--danger);
}

/* ===== Result ===== */

.vysledek {
  background: linear-gradient(135deg, #E8FAF8, var(--success-light));
  border: 2px solid var(--success);
  border-radius: 1rem;
  padding: 1.4rem;
  text-align: center;
  margin: 1rem 0;
  display: none;
  position: relative;
  overflow: hidden;
}

.vysledek::before {
  content: '✓';
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 5rem;
  opacity: 0.07;
  font-weight: 900;
  color: var(--success);
  pointer-events: none;
}

.vysledek.visible {
  display: block;
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vysledek-label {
  font-size: 0.85rem;
  color: #0D7377;
  font-weight: 700;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.vysledek-cislo {
  font-size: 1.8rem;
  font-weight: 800;
  color: #0F9690;
}

/* ===== Tips ===== */

.tip {
  background: #FFFBEB;
  border-left: 4px solid var(--warning);
  padding: 1rem 1.2rem;
  border-radius: 0 0.75rem 0.75rem 0;
  margin: 0.8rem 0;
  display: none;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.1);
}

.tip.visible {
  display: block;
  animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tip-header {
  font-weight: 700;
  color: #92400E;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.tip p, .tip ul { font-size: 0.93rem; }
.tip ul { padding-left: 1.2rem; margin-top: 0.3rem; }
.tip li { margin-bottom: 0.2rem; }

/* ===== Variants table ===== */

.variants-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
  font-size: 0.95rem;
}

.variants-table th {
  background: var(--accent-light, #FFF0EB);
  color: var(--accent-dark, #C44D1A);
  padding: 0.5rem 0.8rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
}

.variants-table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid #E8D5C0;
}

.variants-table tr:last-child td { border-bottom: none; }

.variants-table .jarda { background: #FEF3C7; }
.variants-table .hl-row { background: #FEF3C7; }
.variants-table .res-row { background: var(--success-light); }

/* ===== Cross-reference ===== */

.xref {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #E8D5C0;
  display: none;
}

.xref.visible { display: block; animation: slideIn 0.3s ease-out; }

.xref a {
  color: var(--accent, var(--primary));
  text-decoration: none;
  font-weight: 600;
}

/* ===== Image styling ===== */

.obrazek-zadani { margin: 0.8rem 0 0; text-align: center; }
.obrazek-zadani img, .obrazek-reseni img { max-width: 100%; border-radius: 0.6rem; box-shadow: 0 3px 12px rgba(45, 27, 6, 0.1); }
.obrazek-reseni { background: #FFF5EE; border-radius: 0.75rem; padding: 1rem; text-align: center; display: none; }
.obrazek-reseni.visible { display: block; animation: slideIn 0.4s ease-out; }
.obrazek-reseni-header { font-weight: 700; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 0.5rem; }

/* ===== Navigation bar (glassmorphism) ===== */

.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid rgba(232, 213, 192, 0.6);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 100;
}

.nav-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent, var(--primary));
  background: var(--surface);
  color: var(--accent, var(--primary));
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.nav-btn:hover:not(:disabled) {
  background: var(--accent, var(--primary));
  color: white;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.progress-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 200px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #E8D5C0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.dot.active {
  background: var(--accent, var(--primary));
  transform: scale(1.5);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.2);
}

.dot.done { background: var(--success); }

.step-counter {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 3.5rem;
  text-align: center;
}

/* ===== Animations ===== */

@keyframes slideIn {
  0% { opacity: 0; transform: translateY(18px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.8); }
  60% { opacity: 1; transform: scale(1.06); }
  80% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

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

/* ===== Summary section ("Rady pro CERMAT") ===== */

.shrnuti {
  max-width: 800px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
  display: none;
}

.shrnuti.visible {
  display: block;
  animation: slideIn 0.4s ease-out;
}

.shrnuti-header {
  text-align: center;
  margin-bottom: 1rem;
}

.shrnuti-header h2 {
  font-size: 1.3rem;
  color: var(--accent-dark, #C44D1A);
  font-weight: 700;
}

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

.shrnuti-blok {
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 1rem 1.2rem;
  margin-bottom: 0.8rem;
  box-shadow: 0 2px 8px rgba(45, 27, 6, 0.06);
}

.shrnuti-blok-header {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.shrnuti-blok.strategie { border-left: 4px solid var(--accent, var(--primary)); }
.shrnuti-blok.strategie .shrnuti-blok-header { color: var(--accent-dark, #C44D1A); }

.shrnuti-blok.chytaky { border-left: 4px solid var(--warning); }
.shrnuti-blok.chytaky .shrnuti-blok-header { color: #92400E; }

.shrnuti-blok.chyby { border-left: 4px solid var(--danger); }
.shrnuti-blok.chyby .shrnuti-blok-header { color: #991B1B; }

.shrnuti-blok {
  display: none;
}

.shrnuti-blok.visible {
  display: block;
  animation: slideIn 0.4s ease-out;
}

.shrnuti-blok ul { padding-left: 1.2rem; font-size: 0.93rem; }
.shrnuti-blok li { margin-bottom: 0.3rem; }

/* ===== Responsive ===== */

@media (max-width: 640px) {
  header h1 { font-size: 1.4rem; }
  header { padding: 1.5rem 1rem 1.2rem; }
  .math { font-size: 1.1rem; }
  .content, .pravidlo-box, .tabs-wrapper { padding-left: 1rem; padding-right: 1rem; }
  .vysledek-cislo { font-size: 1.4rem; }
  .krok-num { width: 26px; height: 26px; font-size: 0.8rem; }
}
