/* --- Simulator Styles --- */

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

body {
  background: #06090f;
  color: #e2e8f0;
  font-family: "Inter", sans-serif;
  padding: 14px;
  min-height: 100vh;
}

.app {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 14px;
  max-width: 1560px;
  margin: 0 auto;
}

.canvas-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

canvas {
  width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

#cvwf {
  background: #060c18;
}

#cv3d {
  background: #050a14;
}

#cvcs {
  background: #07101e;
}

/* Panel */
.panel {
  background: linear-gradient(160deg, #0d1626, #0a1220);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.panel h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

label {
  font-size: 0.78rem;
  color: #64748b;
  display: block;
  margin-top: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

.slider-row input[type="range"] {
  flex: 1;
  appearance: none;
  height: 5px;
  border-radius: 3px;
  background: #1e3a5f;
  outline: none;
  cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.slider-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: #60a5fa;
  min-width: 62px;
  text-align: right;
}

select {
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0b1929;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

button {
  flex: 1;
  padding: 9px 6px;
  border-radius: 10px;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}

.btn-run {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.btn-run:hover {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.btn-rst {
  background: rgba(255, 255, 255, 0.07);
}

.btn-rst:hover {
  background: rgba(255, 255, 255, 0.13);
}

.btn-opt {
  background: linear-gradient(135deg, #047857, #059669);
}

.btn-opt:hover {
  background: linear-gradient(135deg, #059669, #10b981);
}

.btn-wps {
  background: linear-gradient(135deg, #d97706, #b45309);
  margin-top: 8px;
}

.btn-wps:hover {
  background: linear-gradient(135deg, #b45309, #92400e);
}

.btn-lekce {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  margin-top: 8px;
}

.btn-lekce:hover {
  background: linear-gradient(135deg, #6d28d9, #5b21b6);
}

.btn-export {
  background: linear-gradient(135deg, #0891b2, #0e7490);
  margin-top: 8px;
}

.btn-export:hover {
  background: linear-gradient(135deg, #0e7490, #155e75);
}

.wire-hint {
  font-size: 0.74rem;
  color: #475569;
  margin-top: 4px;
  padding: 5px 8px;
  background: rgba(59, 130, 246, 0.07);
  border-radius: 7px;
  border: 1px solid rgba(59, 130, 246, 0.12);
}

.pos-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 6px;
}
.pos-pa {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
.pos-pf {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}
.pos-pe {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* WPS semaphore */
.wps-sema {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  margin-left: 8px;
}

.sema-ok {
  background: #d1fae5;
  color: #065f46;
}

.sema-warn {
  background: #fef3c7;
  color: #92400e;
}

.sema-bad {
  background: #fee2e2;
  color: #991b1b;
}

@media print {
  .wps-sema.sema-ok {
    background: #d1fae5 !important;
    color: #065f46 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .wps-sema.sema-warn {
    background: #fef3c7 !important;
    color: #92400e !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .wps-sema.sema-bad {
    background: #fee2e2 !important;
    color: #991b1b !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

.group {
  margin-top: 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.group-title {
  font-size: 0.7rem;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  margin-bottom: 7px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 0.84rem;
  color: #64748b;
}

.val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #93c5fd;
}

/* Bottom */
.bottom {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 1560px;
  margin-left: auto;
  margin-right: auto;
}

.card {
  background: linear-gradient(160deg, #0d1626, #0a1220);
  border-radius: 16px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card h3 {
  font-size: 0.88rem;
  color: #93c5fd;
  margin-bottom: 12px;
}

.stages {
  display: flex;
  gap: 6px;
  align-items: center;
}

.stage {
  flex: 1;
  padding: 9px 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  text-align: center;
  border: 1.5px solid rgba(255, 255, 255, 0.05);
  transition: 0.4s ease;
}

.stage.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: #3b82f6;
}

.stage.done {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
}

.stage-icon {
  font-size: 1.2rem;
}

.stage-lbl {
  font-size: 0.72rem;
  color: #475569;
  margin-top: 2px;
}

.stage-val {
  font-size: 0.69rem;
  color: #64748b;
  margin-top: 1px;
}

.arr {
  color: #3b82f6;
  font-size: 1rem;
}

.ai-box {
  background: linear-gradient(
    135deg,
    rgba(30, 58, 138, 0.35),
    rgba(59, 130, 246, 0.15)
  );
  border-radius: 10px;
  padding: 13px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  margin-top: 0;
}

.ai-txt {
  font-size: 0.83rem;
  line-height: 1.6;
  color: #bfdbfe;
}

.ai-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.tag-ok {
  padding: 3px 11px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}

.tag-warn {
  padding: 3px 11px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.tag-bad {
  padding: 3px 11px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

/* TISK WPS (Při běžném zobrazení je skrytý) */
#wps-print-area {
  display: none;
}

@media print {
  body {
    background: white;
    color: black;
    padding: 0;
    margin: 0;
  }

  .app,
  .bottom {
    display: none !important;
  }

  #wps-print-area {
    display: block;
    padding: 2cm;
    font-family: Arial, sans-serif;
  }

  .wps-header {
    text-align: center;
    border-bottom: 2px solid black;
    margin-bottom: 20px;
    padding-bottom: 10px;
  }

  .wps-header h1 {
    font-size: 24px;
    margin: 0;
    color: black;
  }

  .wps-header h2 {
    font-size: 14px;
    font-weight: normal;
    margin: 5px 0 0 0;
  }

  .wps-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
  }

  .wps-table th,
  .wps-table td {
    border: 1px solid black;
    padding: 10px;
    text-align: left;
  }

  .wps-table th {
    background-color: #f2f2f2 !important;
    width: 40%;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .wps-signatures {
    margin-top: 50px;
    display: flex;
    justify-content: space-between;
  }

  .wps-sig-box {
    border-top: 1px solid black;
    width: 40%;
    text-align: center;
    padding-top: 5px;
    font-size: 12px;
  }
}

/* --- Lekce Styles --- */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
#lekce-view {
  background: #06090f;
  color: #e2e8f0;
  font-family: "Inter", sans-serif;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: linear-gradient(160deg, #0d1626, #0a1220);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
}

.sidebar h1 {
  font-size: 1.2rem;
  color: #f1f5f9;
  padding: 0 20px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item {
  padding: 12px 20px;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
  border-left: 3px solid #3b82f6;
}

/* Main Content */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  scroll-behavior: smooth;
}

.lesson {
  display: none;
  max-width: 900px;
  margin: 0 auto;
  animation: fadeIn 0.4s ease;
}

.lesson.active {
  display: block;
}

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

.lesson h2 {
  font-size: 2rem;
  color: #f1f5f9;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lesson h3 {
  font-size: 1.2rem;
  color: #93c5fd;
  margin: 25px 0 15px 0;
}

.lesson p {
  line-height: 1.7;
  color: #cbd5e1;
  margin-bottom: 15px;
  font-size: 0.95rem;
}

.lesson ul {
  padding-left: 20px;
  margin-bottom: 20px;
  color: #cbd5e1;
}

.lesson li {
  margin-bottom: 8px;
  line-height: 1.6;
}

/* Formula Boxes */
.formula-box {
  background: rgba(30, 58, 138, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.formula {
  font-family: "Courier New", Courier, monospace;
  font-size: 1.3rem;
  color: #bfdbfe;
  text-align: center;
  margin-bottom: 15px;
  font-weight: 600;
  letter-spacing: 1px;
}

.formula-desc {
  font-size: 0.85rem;
  color: #94a3b8;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 15px;
  align-items: center;
}

.formula-desc strong {
  color: #93c5fd;
  text-align: right;
}

/* Information / Tip Boxes */
.info-box {
  background: rgba(16, 185, 129, 0.1);
  border-left: 4px solid #10b981;
  padding: 15px 20px;
  border-radius: 0 8px 8px 0;
  margin: 20px 0;
}

.info-box.warning {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: #f59e0b;
}

.info-title {
  font-weight: 600;
  margin-bottom: 5px;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 8px;
}
.warning .info-title {
  color: #fbbf24;
}

/* Canvas Containers */
.graph-container {
  background: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  margin: 25px 0;
  text-align: center;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

canvas {
  max-width: 100%;
  height: auto;
}

.graph-caption {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 10px;
  font-style: italic;
}

/* Interactive controls */
.controls {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 15px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.control-group label {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.control-group input[type="range"] {
  width: 150px;
  accent-color: #3b82f6;
}

.val-display {
  font-weight: 600;
  color: #60a5fa;
  font-size: 0.9rem;
  margin-top: 5px;
}

/* --- Appended Styles --- */
#lekce-view {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #06090f;
  z-index: 9999;
}
#lekce-close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  background: #ef4444;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  z-index: 10000;
}
