@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg-main: #090d16;
  --bg-surface: rgba(17, 24, 39, 0.7);
  --bg-surface-solid: #0f172a;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --primary-color: var(--primary);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --sidebar-width: 400px;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  background-image:
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.08) 0px, transparent 50%);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Custom Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* Header */
header {
  min-height: 65px;
  height: auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.logo-section { display: flex; align-items: center; gap: 12px; }

.logo-icon {
  width: 32px; height: 32px;
  background: var(--primary-gradient);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-family: var(--font-title); color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

h1 {
  font-family: var(--font-title); font-size: 1.25rem; font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #ffffff, #e0e7ff);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

/* =============================================
   BUTTON STYLES
   ============================================= */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px;
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); border: none;
}
.btn-primary {
  background: var(--primary-gradient); color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35); filter: brightness(1.05); }
.btn-secondary { background: rgba(255, 255, 255, 0.05); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); }
.btn-icon-only { padding: 10px 12px; }
.btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

/* Viditelný focus jen z klávesnice — custom controls (harmoniky, pickery) jinak
   nemají žádný fokusový stav a klávesová navigace je neviditelná */
button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--border-focus, #6366f1);
  outline-offset: 2px;
}

/* Play/pause toggle swaps labels (Přehrát animace / Pozastavit / Pokračovat) —
   fixed min-width sized to the longest label so the header never shifts */
#btn-play-all {
  min-width: 172px;
  justify-content: center;
}
.btn-success { background: var(--success); color: white; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2); }
.btn-success:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* BUG 5 FIX: btn-sm was missing */
.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
}

/* App Main Container */
.app-container { display: flex; flex: 1; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  backdrop-filter: blur(16px);
  display: flex; flex-direction: column;
  overflow: visible; z-index: 5;
}

/* Sticky Header Wrapper */
.sidebar-sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

/* Context switcher */
.context-switcher {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-solid);
  flex-shrink: 0;
}

/* Tab Navigation */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-surface-solid); /* Made opaque to prevent text from showing through when scrolling */
  flex-shrink: 0;
  /* Prevent tabs from being squished smaller than their content */
  overflow: hidden;
}
.tab-btn {
  flex: 1;
  min-width: 0;           /* allow flex children to shrink */
  padding: 12px 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;     /* slightly smaller so all 4 fit */
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  letter-spacing: -0.01em;
}
.tab-btn:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.03); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  font-size: 0.8rem;
}

/* Tab Content */
.tab-content { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.tab-panel { display: none; }
.tab-panel.active { display: flex; flex-direction: column; gap: 12px; }

/* =============================================
   COLLAPSIBLE SECTIONS (Accordion)
   ============================================= */
.collapsible-section {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(17, 24, 39, 0.4);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.collapsible-section.open {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
  user-select: none;
  gap: 8px;
}
.collapsible-header:hover {
  background: rgba(255, 255, 255, 0.06);
}
.collapsible-section.open .collapsible-header {
  background: rgba(99, 102, 241, 0.05);
  border-bottom-color: var(--border-color);
}

.collapsible-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  transition: color 0.2s ease;
}
.collapsible-section.open .collapsible-title {
  color: #a5b4fc;
}

.collapsible-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.25s ease, color 0.25s ease;
}
.collapsible-section.open .collapsible-icon {
  transform: rotate(180deg);
  color: #a5b4fc;
}

.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 14px;
}
.collapsible-section.open .collapsible-body {
  max-height: 3000px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Form Groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}

.input,
input[type="text"],
input[type="url"],
select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.82rem;
  transition: all 0.2s;
  line-height: 1.4;
}
.input:focus,
input[type="text"]:focus,
input[type="url"]:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* =============================================
   CUSTOM FONT PICKER (Dropdown)
   ============================================= */
.custom-font-select {
  position: relative;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.custom-font-select:focus, .custom-font-select.active {
  outline: none;
  border-color: var(--border-focus);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.custom-font-select::after {
  content: '▼';
  font-size: 0.6rem;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.cfs-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 16px;
}
.cfs-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background: var(--bg-surface-solid);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 100;
  display: none;
  flex-direction: column;
}
.custom-font-select.active .cfs-dropdown {
  display: flex;
}
.cfs-option {
  padding: 8px 12px;
  font-size: 1rem;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s;
}
.cfs-option:hover {
  background: rgba(99, 102, 241, 0.15);
}
.cfs-option.selected {
  background: rgba(99, 102, 241, 0.25);
  color: var(--primary);
}

/* =============================================
   RANGE SLIDER (Custom dark theme)
   ============================================= */
.range-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 2px;
}
.range-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.range-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
}
.range-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  font-family: monospace;
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
  cursor: pointer; transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
  cursor: pointer;
}

/* =============================================
   3x3 POSITION GRID
   ============================================= */
.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 100px;
  aspect-ratio: 1;
}
.position-grid-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.position-grid-btn:hover { background: rgba(99, 102, 241, 0.15); border-color: var(--primary); }
.position-grid-btn.active {
  background: var(--primary); border-color: var(--primary);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}
.position-grid-btn .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
}
.position-grid-btn.active .dot { background: white; }

.position-control {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
}
.position-sliders {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* =============================================
   CHECKBOX TOGGLE
   ============================================= */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  gap: 12px;
  /* thin separator between consecutive toggles */
  border-top: 1px solid rgba(255,255,255,0.04);
}
.toggle-row:first-of-type { border-top: none; }
.toggle-label {
  font-size: 0.8rem;
  color: var(--text-main);
  font-weight: 500;
  line-height: 1.3;
  flex: 1;
}
.toggle-switch {
  position: relative; width: 36px; height: 20px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px; transition: 0.2s;
}
.toggle-slider:before {
  position: absolute; content: ""; height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background: var(--text-muted); border-radius: 50%; transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(16px); background: white;
}

/* Color Picker Grid */
.color-picker-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.color-input-wrapper {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, 0.2); border: 1px solid var(--border-color);
  padding: 6px 10px; border-radius: 8px;
}
.color-input-wrapper input[type="color"] {
  -webkit-appearance: none; border: none;
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; background: none;
}
.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-input-wrapper input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255,255,255,0.15); border-radius: 6px;
}
.color-val-text {
  font-size: 0.85rem; font-family: monospace; color: var(--text-main); text-transform: uppercase;
}
.color-val-text[contenteditable="true"], input.color-val-text {
  outline: none;
  cursor: text;
  background: transparent;
  border: none;
  font-size: 0.85rem;
  font-family: monospace;
  color: var(--text-main);
  text-transform: uppercase;
  width: 75px;
  padding: 2px 4px;
  text-align: center;
  display: inline-block;
  user-select: text;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.25);
  transition: all 0.2s;
  border-radius: 4px;
}
.color-val-text[contenteditable="true"]:hover, input.color-val-text:hover {
  background: rgba(255, 255, 255, 0.04);
  border-bottom-color: rgba(255, 255, 255, 0.5);
}
.color-val-text[contenteditable="true"]:focus, input.color-val-text:focus {
  border-bottom: 1px solid var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Dropzone */
.image-upload-wrapper { display: flex; flex-direction: column; gap: 6px; }
.dropzone {
  border: 1.5px dashed var(--border-color);
  border-radius: 8px;
  padding: 14px 12px;
  text-align: center;
  background: rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
  transform: scale(1.005);
}
.dropzone-icon { color: var(--text-muted); line-height: 1; }
.dropzone-text { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.dropzone-hint { font-size: 0.7rem; color: rgba(156, 163, 175, 0.55); margin-top: 1px; }

.image-preview-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  padding: 7px 10px;
  border-radius: 8px;
  margin-top: 4px;
}
.image-preview-thumb {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  object-fit: contain;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.image-preview-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Focal point — thumbnail indicator (click opens the composition editor) */
.focal-picker-wrap {
  position: relative;
  width: 64px;
  flex-shrink: 0;
  cursor: pointer;
  line-height: 0;
}
.focal-picker-wrap .image-preview-thumb {
  width: 100%;
  height: auto;
}
.focal-dot {
  position: absolute;
  width: 12px; height: 12px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.85);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 0 6px rgba(99,102,241,0.8);
  pointer-events: none;
}

/* Focal tabs & indicators */
.focal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.focal-tabs .btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
  font-weight: 600;
}
.focal-tabs .btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
  color: var(--text-main);
}
.focal-tabs .btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.focal-tabs .btn svg {
  opacity: 0.7;
}
.focal-tabs .btn.active svg {
  opacity: 1;
}
.override-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid #1e293b;
  box-shadow: 0 0 5px rgba(99, 102, 241, 0.8);
  pointer-events: none;
}

/* Per-image composition editor (expanded under the image card) */
.composition-editor {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  margin: -4px 0 10px;
}
.focal-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
}
.focal-header svg {
  color: var(--primary);
  flex-shrink: 0;
}
.composition-preview {
  position: relative;
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #1e293b;
  /* Fixed aspect ratio so object-fit: cover actually crops and focal point matters */
  aspect-ratio: 16 / 9;
  max-height: 200px;
}
.composition-preview.global-mode {
  cursor: crosshair;
}
/* Red hatching appears when focal point causes the image to not fully cover the container */
.composition-preview.has-gap {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 30, 30, 0.5),
    rgba(255, 30, 30, 0.5) 8px,
    rgba(30, 0, 0, 0.5) 8px,
    rgba(30, 0, 0, 0.5) 16px
  );
}
.composition-preview.has-gap::after {
  content: '⚠ Fotka nevyplní celý banner';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(220, 38, 38, 0.9);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  z-index: 10;
  white-space: nowrap;
  pointer-events: none;
}

.composition-wireframes {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 5;
}
.wireframe {
  position: absolute;
  border: 1px dashed rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
  pointer-events: none;
}
.wireframe.override {
  border-color: rgba(255, 100, 100, 0.6);
  background: rgba(255, 100, 100, 0.1);
}

.composition-preview.is-dragging {
  cursor: grabbing;
}
.composition-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.composition-split-overlay {
  position: absolute;
  background: repeating-linear-gradient(
    45deg,
    rgba(15, 23, 42, 0.6),
    rgba(15, 23, 42, 0.6) 10px,
    rgba(15, 23, 42, 0.8) 10px,
    rgba(15, 23, 42, 0.8) 20px
  );
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.split-overlay-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  white-space: nowrap;
  letter-spacing: 0.05em;
  transform: rotate(0deg);
}
.composition-split-overlay[style*="width"] .split-overlay-text {
  transform: rotate(-90deg);
}
.composition-cross {
  position: absolute;
  width: 18px; height: 18px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 0 10px rgba(99,102,241,0.9);
  pointer-events: none;
}
.composition-cross::before, .composition-cross::after {
  content: '';
  position: absolute;
  background: #fff;
}
.composition-cross::before { left: 50%; top: -6px; width: 1px; height: 5px; }
.composition-cross::after { top: 50%; left: -6px; height: 1px; width: 5px; }
.composition-cross.ghost {
  opacity: 0.4;
  border-style: dashed;
  background: transparent;
}
.composition-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: flex-start;
}
.composition-grid {
  width: 72px;
  flex-shrink: 0;
}
.composition-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.composition-readout {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}
.composition-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Header check status (Kontrola) — traffic light + dropdown panel */
.check-status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 2px;
  flex-shrink: 0;
}
.check-status-dot.pass { background: var(--success, #10b981); box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
.check-status-dot.warn { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.7); }
.check-status-dot.danger { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.7); }
.check-status-count {
  align-items: center; justify-content: center;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  font-size: 0.7rem; font-weight: 800;
}
#check-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--bg-surface-solid, #0f172a);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}
#check-panel .checklist-panel {
  border: none;
  background: transparent;
}

/* Zone toggles (panel vs. photo) — shown only while split layout is active */
.split-zone-row { display: none; }
body.split-active .split-zone-row { display: block; }

/* Global position section disabled when every slide has its own focal */
.position-control.bg-position-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Generic disabled state for pickers gated by another control (e.g. CTA Auto) */
.control-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Standalone toggle button (CTA "Auto") — must look like a button in BOTH states
   (.icon-btn is transparent/borderless and relies on its group wrapper) */
.placement-auto-btn {
  display: block;
  width: 100%;
  font-size: 0.8rem;
  padding: 7px 8px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.placement-auto-btn:hover {
  border-color: var(--primary);
  color: var(--text-color);
}
.placement-auto-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 600;
}

/* Edge controls spacing */
#split-edge-flip-row { margin-bottom: 4px; }
#split-edge-blur-group { margin-top: 12px; }

/* Quick layout presets (Rychlá rozložení) */
.layout-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.layout-preset-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  text-align: center;
}
.layout-preset-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
/* Three generated mini frames per card: lišta · čtverec · na výšku —
   visually communicates that each format type gets its own composition */
.lp-scheme-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 2px;
  background: var(--bg-surface);
  border-radius: 4px;
  margin-bottom: 6px;
  min-height: 44px;
}
.lp-frame {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.lp-photo {
  position: absolute;
  background: linear-gradient(135deg, #64748b, #334155);
}
.lp-lines {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 1px;
  justify-content: center;
}
.lp-line {
  height: 1.5px;
  border-radius: 1px;
  background: #cbd5e1;
  width: 100%;
}
.lp-cta {
  position: absolute;
  border-radius: 2px;
  background: var(--primary);
}
.lp-logo {
  position: absolute;
  width: 4px;
  height: 3px;
  border-radius: 1px;
  background: #fbbf24;
}
.lp-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Attention pulse on the composition button after multi-upload */
@keyframes compositionPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
  50% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.45); }
}
.btn-open-composition.pulse-attention {
  animation: compositionPulse 0.9s ease-in-out 3;
  border-color: var(--primary-color, #6366f1);
}
.image-preview-name {
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}
.btn-remove-image {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: transform 0.2s, opacity 0.2s;
  flex-shrink: 0;
  opacity: 0.7;
}
.btn-remove-image:hover { transform: scale(1.15); opacity: 1; }

/* =============================================
   CTA VARIANT VISUAL PICKER
   ============================================= */
.cta-variant-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.cta-variant-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,0.2);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 7px 3px 6px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 0;
}
.cta-variant-btn:hover {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.06);
}
.cta-variant-btn.active {
  border-color: var(--primary);
  background: rgba(99,102,241,0.12);
  box-shadow: 0 0 0 1px var(--primary);
}

.cta-variant-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 5px;
  border-radius: 4px;
  width: 100%;
  max-width: 62px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cta-variant-filled { background: #6366f1; color: white; }
.cta-variant-outlined { background: transparent; color: #6366f1; border: 1.5px solid #6366f1; }
.cta-variant-ghost { background: transparent; color: #6366f1; text-decoration: underline; }
.cta-variant-pill { background: #6366f1; color: white; border-radius: 999px; }
.cta-variant-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.cta-variant-btn.active .cta-variant-name { color: var(--primary); }

/* =============================================
   ANIMATION EFFECT PICKER
   ============================================= */
.anim-effect-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.anim-effect-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,0.2);
  border: 1.5px solid var(--border-color);
  border-radius: 7px;
  padding: 7px 3px 6px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.anim-effect-btn:hover {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.06);
}
.anim-effect-btn.active {
  border-color: var(--primary);
  background: rgba(99,102,241,0.14);
  box-shadow: 0 0 0 1px var(--primary);
}

.anim-effect-icon {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
  transition: all 0.3s;
  display: block;
  min-height: 20px;
}
.anim-effect-btn.active .anim-effect-icon { color: var(--primary); }
.anim-effect-btn:hover .anim-effect-icon { color: var(--text-main); }

.anim-effect-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-align: center;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.anim-effect-btn.active .anim-effect-label { color: var(--primary); }

/* Hover animations on effect icons */
.anim-effect-btn:hover .anim-preview-fade { animation: previewFade 0.5s ease; }
.anim-effect-btn:hover .anim-preview-slide-up { animation: previewSlideUp 0.5s ease; }
.anim-effect-btn:hover .anim-preview-slide-down { animation: previewSlideDown 0.5s ease; }
.anim-effect-btn:hover .anim-preview-slide-left { animation: previewSlideLeft 0.5s ease; }
.anim-effect-btn:hover .anim-preview-slide-right { animation: previewSlideRight 0.5s ease; }
.anim-effect-btn:hover .anim-preview-zoom { animation: previewZoom 0.5s ease; }
.anim-effect-btn:hover .anim-preview-bounce { animation: previewBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.anim-effect-btn:hover .anim-preview-type    { animation: previewType    0.5s steps(4); }
.anim-effect-btn:hover .anim-preview-blur    { animation: previewBlur    0.5s ease; }
.anim-effect-btn:hover .anim-preview-flip    { animation: previewFlip    0.5s ease; }
.anim-effect-btn:hover .anim-preview-pulse   { animation: previewPulse   0.6s ease-in-out; }
.anim-effect-btn:hover .anim-preview-shimmer { animation: previewShimmer 0.7s linear; }
.anim-effect-btn:hover .anim-preview-float   { animation: previewFloat   0.7s ease-in-out; }
.anim-effect-btn:hover .anim-preview-spin    { animation: previewSpin    0.5s linear; }
.anim-effect-btn:hover .anim-preview-words   { animation: previewFade    0.5s ease; }
.anim-effect-btn:hover .anim-preview-kenburns { animation: previewZoom      1s ease; }
.anim-effect-btn:hover .anim-preview-parallax { animation: previewSlideLeft 0.6s ease; }
.anim-effect-btn:hover .anim-preview-curtain  { animation: previewCurtain  0.5s ease; }
.anim-effect-btn:hover .anim-preview-chars    { animation: previewFade     0.5s ease; }

@keyframes previewFade      { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes previewSlideUp   { 0% { transform: translateY(8px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes previewSlideDown { 0% { transform: translateY(-8px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes previewSlideLeft { 0% { transform: translateX(-8px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes previewSlideRight{ 0% { transform: translateX(8px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes previewZoom      { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes previewBounce    { 0% { transform: scale(0.3); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes previewType      { 0% { clip-path: inset(0 100% 0 0); } 100% { clip-path: inset(0 0 0 0); } }
@keyframes previewBlur      { 0% { filter: blur(6px); opacity: 0; } 100% { filter: blur(0); opacity: 1; } }
@keyframes previewFlip      { 0% { transform: rotateY(90deg); opacity: 0; } 100% { transform: rotateY(0); opacity: 1; } }
@keyframes previewPulse     { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes previewShimmer   { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes previewFloat     { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes previewSpin      { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes previewCurtain   { 0% { clip-path: inset(0 100% 0 0); } 100% { clip-path: inset(0 0% 0 0); } }

/* ── BG PRESET CHIPS ── */
.bg-preset-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.bg-preset-chip {
  flex: 1;
  padding: 5px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  background: rgba(0,0,0,0.2);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  white-space: nowrap;
}
.bg-preset-chip:hover { border-color: rgba(99,102,241,0.5); background: rgba(99,102,241,0.06); color: var(--text-main); }
.bg-preset-chip.active { border-color: var(--primary); background: rgba(99,102,241,0.15); color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

/* ── KEN BURNS DIRECTION GRID ── */
.kb-dir-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.kb-dir-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 5px;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  background: rgba(0,0,0,0.2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.kb-dir-btn:hover { border-color: rgba(99,102,241,0.5); background: rgba(99,102,241,0.06); color: var(--text-main); }
.kb-dir-btn.active { border-color: var(--primary); background: rgba(99,102,241,0.15); color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.kb-dir-arrow { font-size: 1.05rem; line-height: 1; }
.kb-dir-label { font-size: 0.54rem; color: inherit; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ── POKROČILÉ COLLAPSIBLE ── */
.anim-advanced-section { margin-top: 8px; }
.anim-advanced-toggle {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  border-top: 1px solid var(--border-color);
  transition: color 0.15s;
}
.anim-advanced-toggle::-webkit-details-marker { display: none; }
.anim-advanced-toggle::before { content: '▸'; font-size: 0.6rem; transition: transform 0.15s; flex-shrink: 0; }
details[open] > .anim-advanced-toggle::before { transform: rotate(90deg); }
.anim-advanced-toggle:hover { color: var(--text-main); }
.anim-advanced-section > div, .anim-advanced-section > .form-group { margin-top: 8px !important; }

/* ── VLASTNÍ PRESET CHIP ── */
.bg-preset-chip[data-preset="custom"] { cursor: default; }
.bg-preset-chip[data-preset="custom"]:not(.active) { opacity: 0.45; pointer-events: none; }
.bg-preset-chip[data-preset="custom"].active { opacity: 1; }

/* ── TRANSITION GROUP HEADERS ── */
.trans-group-header {
  grid-column: 1 / -1;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 5px 2px 2px;
  border-top: 1px solid var(--border-color);
  margin-top: 2px;
}
.trans-group-header:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* Category label inside effect picker — spans full grid width */
.anim-category-label {
  grid-column: 1 / -1;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 2px 2px;
  border-top: 1px solid var(--border-color);
  margin-top: 2px;
}
.anim-category-label:first-of-type { border-top: none; padding-top: 2px; margin-top: 0; }

/* Animation controls box (used by shapes) */
.anim-controls-box {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =============================================
   BAR ANIMATION ICON PICKER (compact 3-col)
   ============================================= */
.bar-anim-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.bar-anim-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.2);
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 3px 4px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 0;
}
.bar-anim-btn:hover {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.06);
}
.bar-anim-btn.active {
  border-color: var(--primary);
  background: rgba(99,102,241,0.14);
  box-shadow: 0 0 0 1px var(--primary);
}
.bar-anim-icon {
  font-size: 1rem;
  line-height: 1;
  color: var(--text-muted);
  display: block;
  min-height: 18px;
}
.bar-anim-btn.active .bar-anim-icon { color: var(--primary); }
.bar-anim-btn:hover .bar-anim-icon { color: var(--text-main); }

.bar-anim-label {
  font-size: 0.55rem;
  color: var(--text-muted);
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.bar-anim-btn.active .bar-anim-label { color: var(--primary); }

/* =============================================
   ANIMATION ELEMENT CARDS (new inline design)
   ============================================= */
.anim-element-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.anim-element-card:not(.anim-card-off) {
  border-color: rgba(99, 102, 241, 0.35);
}
@keyframes tl-card-flash {
  0%   { box-shadow: 0 0 0 0 rgba(99,102,241,0); border-color: rgba(99,102,241,0.35); }
  20%  { box-shadow: 0 0 0 4px rgba(99,102,241,0.5); border-color: rgba(99,102,241,0.9); }
  60%  { box-shadow: 0 0 0 6px rgba(99,102,241,0.25); border-color: rgba(99,102,241,0.7); }
  100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); border-color: rgba(99,102,241,0.35); }
}
.anim-element-card.tl-card-highlighted {
  animation: tl-card-flash 1.6s ease forwards;
}

.anim-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: default;
  background: rgba(255, 255, 255, 0.02);
  gap: 8px;
}
.anim-card-off .anim-card-header {
  opacity: 0.65;
}

.anim-card-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  color: var(--text-muted);
}
.anim-card-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.anim-card-off .anim-card-name {
  color: var(--text-muted);
}

.anim-rename-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
  flex-shrink: 0;
}
.anim-card-header:hover .anim-rename-btn {
  opacity: 1;
}
.anim-rename-btn:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.anim-card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.anim-card-status {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  transition: background 0.2s, color 0.2s;
}
.anim-status-on {
  background: rgba(99, 102, 241, 0.18);
  color: var(--primary);
}
.anim-status-off {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}
.btn-play-anim-card {
  background: transparent;
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--primary);
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}
.btn-play-anim-card:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary);
  transform: scale(1.05);
}

/* Card body — hidden by default, shown when ON */
.anim-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.25s;
  padding: 0 14px;
  opacity: 0;
  pointer-events: none;
}
.anim-card-chevron {
  transition: transform 0.3s ease;
}
.anim-card-chevron.rotate {
  transform: rotate(180deg);
}

.anim-card-body.anim-card-body-open {
  max-height: 1200px;
  padding: 12px 14px 14px;
  opacity: 1;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-color);
}

/* =============================================
   VIEWPORT AREA
   ============================================= */
.viewport-area {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background-color: #0b0f19; position: relative;
}
.viewport-toolbar {
  height: 50px; border-bottom: 1px solid var(--border-color);
  background: rgba(9, 13, 22, 0.4);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.toolbar-info {
  font-size: 0.85rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
}
.toolbar-controls { display: flex; align-items: center; gap: 12px; }

.zoom-controls {
  display: flex; align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color); border-radius: 6px; padding: 2px;
}
.zoom-btn {
  background: transparent; border: none; color: var(--text-muted);
  width: 26px; height: 26px; cursor: pointer; border-radius: 4px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.zoom-btn:hover { color: var(--text-main); background: rgba(255, 255, 255, 0.05); }
.zoom-text { font-size: 0.8rem; font-weight: 600; width: 48px; text-align: center; }

/* Preview Canvas */
.canvas-workspace {
  flex: 1; padding: 40px; overflow: auto;
  display: flex; align-content: flex-start; align-items: flex-start; justify-content: center;
  background-color: #080b12;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 0);
  background-size: 20px 20px;
}
.canvas-grid {
  display: flex; flex-direction: column; gap: 34px; width: 100%;
  /* top left: při zoomu > 100 % roste plocha doprava/dolů (scrollovatelné);
     center by utekla doleva pod sidebar, kam scroll nedosáhne */
  transform-origin: top left; transition: transform 0.2s ease-out;
}

/* Sekce plochy podle kompozičních skupin (D10-A) */
.canvas-section-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.canvas-section-title {
  font-family: var(--font-body); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted);
  white-space: nowrap;
}
.canvas-section-count { color: rgba(255,255,255,0.3); font-weight: 600; }
.canvas-section-edit {
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  font-family: var(--font-body); font-size: 0.74rem; font-weight: 600;
  color: var(--primary); white-space: nowrap;
}
.canvas-section-edit:hover { text-decoration: underline; }
.canvas-section-line { flex: 1; height: 1px; background: var(--border-color); }
.canvas-section-cards {
  display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start;
}

/* Skrytý formát (oko): NE display:none — iframe musí zůstat vyrenderovaný,
   aby text-fit měření a Kontrola dál platily pro všech 14 formátů */
.preview-card.format-hidden {
  position: absolute !important;
  left: -200vw !important; top: 0 !important;
  pointer-events: none !important;
}
.btn-eye {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-muted); cursor: pointer; padding: 3px 5px;
  display: inline-flex; align-items: center;
}
.btn-eye:hover { color: var(--text-main); border-color: var(--border-color); }
.hidden-chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hidden-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.04); border: 1px dashed var(--border-color);
  border-radius: 999px; padding: 2px 10px; cursor: pointer;
  font-family: var(--font-body); font-size: 0.68rem; color: var(--text-muted);
}
.hidden-chip:hover { color: var(--text-main); border-color: rgba(99, 102, 241, 0.5); }

/* Přehled klávesových zkratek */
.shortcuts-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.shortcuts-table td { padding: 7px 0; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.shortcuts-table tr:last-child td { border-bottom: none; }
.shortcuts-table td:first-child { white-space: nowrap; padding-right: 18px; color: var(--text-muted); }
.shortcuts-table kbd {
  display: inline-block; padding: 2px 7px; border-radius: 5px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border-color);
  border-bottom-width: 2px; font-family: monospace; font-size: 0.75rem; color: var(--text-main);
}

/* Preview Cards */
.preview-card {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-color); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.preview-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 36px rgba(99, 102, 241, 0.1);
}

/* Context scope highlighting (global = no classes, group/format = active members + dimmed rest) */
.preview-card.context-active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
}
.preview-card.context-dimmed {
  opacity: 0.45;
  filter: saturate(0.6);
}
.preview-card.context-dimmed iframe {
  pointer-events: none;
}

.override-badge {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.5px;
  padding: 1px 6px; border-radius: 4px;
  background: rgba(99, 102, 241, 0.18);
  color: var(--primary-color, #818cf8);
  border: 1px solid rgba(99, 102, 241, 0.4);
  cursor: help;
}

/* BUG 6 FIX: unified card-header styles */
.card-header {
  padding: 10px 14px; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.02);
  flex-wrap: wrap; gap: 6px;
}
.card-title {
  font-size: 0.8rem; font-weight: 700; color: var(--text-main); font-family: var(--font-title);
  display: flex; align-items: center; gap: 6px;
}
.card-size {
  font-size: 0.8rem; color: var(--text-muted); font-family: monospace; font-weight: 400;
}

.preview-frame-container { background: #000; position: relative; overflow: hidden; }
.preview-frame { border: none; width: 100%; height: 100%; background: #000; display: block; }

.card-size-tag {
  font-size: 0.7rem; padding: 2px 6px; border-radius: 4px;
  background: rgba(16, 185, 129, 0.1); color: var(--success); font-weight: 700;
}
.card-size-tag.warning { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* =============================================
   CHECKLIST
   ============================================= */
.checklist-panel {
  display: flex; flex-direction: column; gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color); border-radius: 10px;
  padding: 16px; margin-top: 10px;
}
.checklist-title {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted);
}
.checklist-item { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.checklist-indicator {
  width: 12px; height: 8px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0;
}
.checklist-indicator.pass { background: var(--success); box-shadow: 0 0 6px var(--success); }
.checklist-indicator.warn { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.checklist-indicator.danger { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.checklist-text { color: var(--text-main); }

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(9, 13, 22, 0.8); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-card {
  width: 480px; background: #0f172a;
  border: 1px solid var(--border-color); border-radius: 16px;
  padding: 28px; display: flex; flex-direction: column; gap: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-title { font-family: var(--font-title); font-size: 1.2rem; font-weight: 700; }
.modal-close {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.4rem; line-height: 1;
  padding: 0; flex-shrink: 0;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text-main); }
.modal-body { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

.progress-bar-container {
  width: 100%; height: 8px;
  background: rgba(255,255,255,0.05); border-radius: 4px; overflow: hidden;
}
.progress-bar-fill {
  width: 0%; height: 100%;
  background: var(--primary-gradient); transition: width 0.2s ease;
}

/* =============================================
   SECTION DIVIDER & MISC
   ============================================= */
.section-divider {
  height: 1px; background: var(--border-color); margin: 4px 0;
}

/* =============================================
   TEMPLATES MODAL — Rich Banner Previews
   ============================================= */
.templates-modal-card {
  width: 780px;
  max-width: 92vw;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.templates-modal-card .modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 16px 0 0 0;
}

/* Hlavní modal šablon: pevná výška — okno se nesmí přizpůsobovat počtu
   vyfiltrovaných karet. Filtry drží pozici, scrolluje pouze grid s výpisem. */
#templates-modal .templates-modal-card {
  height: 88vh;
}
#templates-modal .modal-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  min-height: 0;
}
#templates-modal #template-filters {
  flex: 0 0 auto;
}
#templates-modal .templates-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  /* Řádky gridu se NIKDY nesmí stlačit podle počtu karet — výška karty
     musí být konstantní a přebytek se scrolluje (bug: 35 karet = proužky,
     4 karty = OK). max-content kompresi řádků zakazuje. */
  grid-auto-rows: max-content;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 16px 20px 20px;
}

/* =============================================
   TEMPLATE FACET FILTERS
   ============================================= */
#template-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px 28px;
  align-items: start;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--surface-hover);
}
.tpl-filter-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.tpl-filter-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  opacity: 0.7;
  white-space: nowrap;
  line-height: 1;
}
.tpl-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tpl-chip {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.tpl-chip:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}
.tpl-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.tpl-filter-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 24px;
  margin-top: -2px;
}
.tpl-filter-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 3px 9px;
  border-radius: 999px;
}
.tpl-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 2.4;
}
.tpl-mood-badge { display: inline-flex; align-items: center; gap: 4px; }
.tpl-mood-dot {
  width: 12px; height: 7px; border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.25);
}
.tpl-tempo-badge { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.template-card {
  background: rgba(0,0,0,0.2);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.template-card:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.15);
}

/* Mini banner preview inside template card.
   Pevná výška místo aspect-ratio — ratio se v praxi neaplikovalo
   a náhledy se hroutily na barevné proužky (user-reported). */
.template-banner-preview {
  width: 100%;
  height: 150px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  overflow: hidden;
}

.tpl-preview-logo-bar {
  display: flex;
  align-items: center;
  gap: 5px;
}
.tpl-preview-logo-dot {
  width: 12px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.tpl-preview-logo-line {
  height: 3px; border-radius: 2px;
  background: rgba(255,255,255,0.15);
  width: 28px;
}

.tpl-preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 4px 0;
}
.tpl-preview-headline {
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tpl-preview-subline {
  font-size: 0.52rem;
  line-height: 1.2;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tpl-preview-cta {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 3px 7px;
  display: inline-block;
  align-self: flex-start;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-info {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.template-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}
.template-font-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: monospace;
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
}
.template-meta {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 3px;
}
.template-layout-badge {
  font-size: 0.6rem;
  color: var(--primary);
  background: rgba(99,102,241,0.12);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}
.template-card:hover .template-name { color: var(--primary); }

/* =============================================
   TEMPLATE HOVER ANIMATION SYSTEM
   Elements briefly disappear then animate in
   on hover — creating a live preview effect.
   ============================================= */

/* Keyframes */
@keyframes tplSlideUp   { from { opacity: 0; transform: translateY(7px); }   to { opacity: 1; transform: translateY(0); } }
@keyframes tplSlideDown { from { opacity: 0; transform: translateY(-7px); }  to { opacity: 1; transform: translateY(0); } }
@keyframes tplSlideLeft { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes tplSlideRight{ from { opacity: 0; transform: translateX(8px); }  to { opacity: 1; transform: translateX(0); } }
@keyframes tplZoom      { from { opacity: 0; transform: scale(0.65); }       to { opacity: 1; transform: scale(1); } }
@keyframes tplBounce    { 0% { opacity: 0; transform: scale(0.5); } 65% { opacity: 1; transform: scale(1.1); } 100% { opacity: 1; transform: scale(1); } }
@keyframes tplFade      { from { opacity: 0; }                                to { opacity: 1; } }

/* Shared timing properties on hover */
.template-card:hover .tpl-preview-logo-bar  { animation-duration: 0.32s; animation-delay: 0.00s; animation-fill-mode: both; }
.template-card:hover .tpl-preview-headline  { animation-duration: 0.36s; animation-delay: 0.10s; animation-fill-mode: both; }
.template-card:hover .tpl-preview-subline   { animation-duration: 0.36s; animation-delay: 0.20s; animation-fill-mode: both; }
.template-card:hover .tpl-preview-cta       { animation-duration: 0.36s; animation-delay: 0.30s; animation-fill-mode: both; }

/* slide-up */
.template-card:hover .tpl-anim-slide-up .tpl-preview-logo-bar,
.template-card:hover .tpl-anim-slide-up .tpl-preview-headline,
.template-card:hover .tpl-anim-slide-up .tpl-preview-subline,
.template-card:hover .tpl-anim-slide-up .tpl-preview-cta       { animation-name: tplSlideUp; animation-timing-function: ease; }

/* slide-left */
.template-card:hover .tpl-anim-slide-left .tpl-preview-logo-bar,
.template-card:hover .tpl-anim-slide-left .tpl-preview-headline,
.template-card:hover .tpl-anim-slide-left .tpl-preview-subline,
.template-card:hover .tpl-anim-slide-left .tpl-preview-cta     { animation-name: tplSlideLeft; animation-timing-function: ease; }

/* slide-right */
.template-card:hover .tpl-anim-slide-right .tpl-preview-logo-bar,
.template-card:hover .tpl-anim-slide-right .tpl-preview-headline,
.template-card:hover .tpl-anim-slide-right .tpl-preview-subline,
.template-card:hover .tpl-anim-slide-right .tpl-preview-cta    { animation-name: tplSlideRight; animation-timing-function: ease; }

/* slide-down */
.template-card:hover .tpl-anim-slide-down .tpl-preview-logo-bar,
.template-card:hover .tpl-anim-slide-down .tpl-preview-headline,
.template-card:hover .tpl-anim-slide-down .tpl-preview-subline,
.template-card:hover .tpl-anim-slide-down .tpl-preview-cta     { animation-name: tplSlideDown; animation-timing-function: ease; }

/* bounce */
.template-card:hover .tpl-anim-bounce .tpl-preview-logo-bar,
.template-card:hover .tpl-anim-bounce .tpl-preview-headline,
.template-card:hover .tpl-anim-bounce .tpl-preview-subline,
.template-card:hover .tpl-anim-bounce .tpl-preview-cta         { animation-name: tplBounce; animation-timing-function: cubic-bezier(0.175,0.885,0.32,1.28); }

/* zoom */
.template-card:hover .tpl-anim-zoom .tpl-preview-logo-bar,
.template-card:hover .tpl-anim-zoom .tpl-preview-headline,
.template-card:hover .tpl-anim-zoom .tpl-preview-subline,
.template-card:hover .tpl-anim-zoom .tpl-preview-cta           { animation-name: tplZoom; animation-timing-function: cubic-bezier(0.34,1.56,0.64,1); }

/* fade */
.template-card:hover .tpl-anim-fade .tpl-preview-logo-bar,
.template-card:hover .tpl-anim-fade .tpl-preview-headline,
.template-card:hover .tpl-anim-fade .tpl-preview-subline,
.template-card:hover .tpl-anim-fade .tpl-preview-cta           { animation-name: tplFade; animation-timing-function: ease; }

/* cascade (extra slow stagger) */
.template-card:hover .tpl-anim-cascade .tpl-preview-logo-bar   { animation-name: tplSlideUp; animation-delay: 0.00s; }
.template-card:hover .tpl-anim-cascade .tpl-preview-headline   { animation-name: tplSlideUp; animation-delay: 0.18s; }
.template-card:hover .tpl-anim-cascade .tpl-preview-subline    { animation-name: tplSlideUp; animation-delay: 0.36s; }
.template-card:hover .tpl-anim-cascade .tpl-preview-cta        { animation-name: tplSlideUp; animation-delay: 0.54s; }

/* ── Nové preset animace ── */
@keyframes tplTypewriter { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes tplBlurIn     { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: blur(0); } }
@keyframes tplCurtain    { from { clip-path: inset(0 50%); opacity: 0.4; } to { clip-path: inset(0 0); opacity: 1; } }
@keyframes tplPulse      { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes tplFloatY     { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* typewriter */
.template-card:hover .tpl-anim-typewriter .tpl-preview-logo-bar { animation-name: tplFade; }
.template-card:hover .tpl-anim-typewriter .tpl-preview-headline { animation-name: tplTypewriter; animation-duration: 0.9s; animation-timing-function: steps(14, end); }
.template-card:hover .tpl-anim-typewriter .tpl-preview-subline  { animation-name: tplFade; animation-delay: 0.9s; }
.template-card:hover .tpl-anim-typewriter .tpl-preview-cta      { animation-name: tplFade; animation-delay: 1.0s; }

/* stagger (slova/písmena — simulováno rychlou kaskádou s odskokem) */
.template-card:hover .tpl-anim-stagger .tpl-preview-logo-bar { animation-name: tplSlideDown; }
.template-card:hover .tpl-anim-stagger .tpl-preview-headline { animation-name: tplSlideUp; animation-timing-function: cubic-bezier(0.34,1.56,0.64,1); animation-delay: 0.08s; }
.template-card:hover .tpl-anim-stagger .tpl-preview-subline  { animation-name: tplSlideUp; animation-timing-function: cubic-bezier(0.34,1.56,0.64,1); animation-delay: 0.26s; }
.template-card:hover .tpl-anim-stagger .tpl-preview-cta      { animation-name: tplBounce; animation-delay: 0.44s; }

/* curtain */
.template-card:hover .tpl-anim-curtain .tpl-preview-logo-bar { animation-name: tplFade; }
.template-card:hover .tpl-anim-curtain .tpl-preview-headline { animation-name: tplCurtain; }
.template-card:hover .tpl-anim-curtain .tpl-preview-subline  { animation-name: tplCurtain; }
.template-card:hover .tpl-anim-curtain .tpl-preview-cta      { animation-name: tplSlideUp; }

/* pulse (CTA pulzuje nepřetržitě) */
.template-card:hover .tpl-anim-pulse .tpl-preview-logo-bar { animation-name: tplZoom; }
.template-card:hover .tpl-anim-pulse .tpl-preview-headline { animation-name: tplBounce; }
.template-card:hover .tpl-anim-pulse .tpl-preview-subline  { animation-name: tplFade; }
.template-card:hover .tpl-anim-pulse .tpl-preview-cta      { animation-name: tplPulse; animation-duration: 1.1s; animation-iteration-count: infinite; animation-delay: 0.4s; }

/* blur */
.template-card:hover .tpl-anim-blur .tpl-preview-logo-bar { animation-name: tplBlurIn; }
.template-card:hover .tpl-anim-blur .tpl-preview-headline { animation-name: tplBlurIn; animation-duration: 0.6s; }
.template-card:hover .tpl-anim-blur .tpl-preview-subline  { animation-name: tplBlurIn; animation-duration: 0.6s; }
.template-card:hover .tpl-anim-blur .tpl-preview-cta      { animation-name: tplFade; }

/* float (tvary se vznášejí, obsah jen fade) */
.template-card:hover .tpl-anim-float .tpl-preview-logo-bar { animation-name: tplFade; }
.template-card:hover .tpl-anim-float .tpl-preview-headline { animation-name: tplBlurIn; }
.template-card:hover .tpl-anim-float .tpl-preview-subline  { animation-name: tplFade; }
.template-card:hover .tpl-anim-float .tpl-preview-cta      { animation-name: tplZoom; }
.template-card:hover .tpl-anim-float .tpl-shape-deco { animation: tplFloatY 3s ease-in-out infinite; }
.template-card:hover .tpl-anim-float .tpl-shape-deco:nth-child(odd) { animation-duration: 4s; animation-delay: 0.5s; }

/* Logo obrázek a tvarové dekorace v náhledu */
.tpl-preview-logo-img {
  width: 14px; height: 14px;
  border-radius: 3px;
  object-fit: contain;
  flex-shrink: 0;
}
.tpl-shape-deco {
  position: absolute;
  z-index: 0;
  pointer-events: none;
}

/* Slideshow simulation */
@keyframes previewSlideShowFade {
  0%, 45% { opacity: 0; }
  50%, 95% { opacity: 1; }
  100% { opacity: 0; }
}
.template-card:hover .template-banner-preview.tpl-anim-fade .tpl-bg-layer-2 {
  animation: previewSlideShowFade 4s infinite;
}

/* =============================================
   TEMPLATE PREVIEW LAYOUT HELPERS
   ============================================= */
.tpl-preview-logo-bar.tpl-centered  { justify-content: center; }
.tpl-preview-logo-bar.tpl-right     { flex-direction: row-reverse; }
.tpl-preview-content.tpl-centered   { align-items: center; }
.tpl-preview-cta.tpl-cta-center     { align-self: center; }
.tpl-preview-content.tpl-content-fill { flex: 1; justify-content: center; }

/* Bold/large headline variant (no-subline layout) */
.tpl-preview-headline.tpl-headline-lg {
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.2;
  -webkit-line-clamp: 3;
}

/* Large italic subline (no-headline layout) */
.tpl-preview-subline.tpl-subline-lg {
  font-size: 0.6rem;
  line-height: 1.35;
  -webkit-line-clamp: 3;
  opacity: 1 !important;
  font-style: italic;
}

/* Full-width CTA */
.tpl-preview-cta.tpl-cta-wide {
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

/* code tag in modalbody */
/* Brand name separator inside logo section */
.brand-name-group {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Checklist panel spacing */
.checklist-panel + .checklist-panel {
  margin-top: 0; /* gap handles it from tab-panel flex */
}

/* Section divider (used inline in template tabs) */
.section-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

code {
  background: rgba(99,102,241,0.12);
  color: var(--primary);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: monospace;
}

/* =============================================
   VISUAL GRID PICKERS (BG SIZE, OVERLAY ETC.)
   ============================================= */
.visual-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 4px;
}
.visual-picker-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,0.2);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 4px 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-color);
  min-width: 0;
}
.visual-picker-btn:hover {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.06);
}
.visual-picker-btn.active {
  border-color: var(--primary);
  background: rgba(99,102,241,0.12);
  box-shadow: 0 0 0 1px var(--primary);
}
.visual-picker-btn svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-color);
  fill: none;
  stroke-width: 1.5;
}
.visual-picker-btn svg .outer-rect {
  stroke-dasharray: 2 2;
}
.visual-picker-btn.active svg {
  stroke: var(--primary);
}

/* Transition type hover previews — animate SVG elements to hint at the transition */
.trans-type-picker .visual-picker-btn:hover svg rect:last-child,
.trans-type-picker .visual-picker-btn:hover svg polygon {
  animation: transPrevShift 0.5s ease forwards;
}
@keyframes transPrevShift {
  0%   { opacity: 0.4; transform: translateX(0)  translateY(0); }
  50%  { opacity: 0.9; transform: translateX(3px) translateY(-1px); }
  100% { opacity: 0.6; transform: translateX(0)  translateY(0); }
}
.trans-type-picker .visual-picker-btn:hover svg circle {
  animation: transPrevPulse 0.5s ease forwards;
}
@keyframes transPrevPulse {
  0%,100% { opacity: 0.5; transform: scale(1); }
  50%     { opacity: 1;   transform: scale(1.25); }
}
/* Fade preview — full rect pulses */
.trans-type-picker .visual-picker-btn[data-value="fade"]:hover svg rect:last-child {
  animation: transPrevFade 0.5s ease forwards;
}
@keyframes transPrevFade {
  0%,100% { opacity: 0.4; } 50% { opacity: 1; }
}

.visual-picker-name {
  font-size: 0.7rem;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* =============================================
   ICON BUTTON GROUPS (ALIGN & POSITION)
   ============================================= */
.icon-btn-group {
  display: flex;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  padding: 2px;
  margin-top: 4px;
}
.icon-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-color);
}
.icon-btn.active {
  background: var(--primary);
  color: white;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Detailed colors collapsible styling */
.form-group-mini {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.color-reset-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 4px;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.2s;
}
.color-reset-btn:hover {
  color: var(--primary);
  transform: rotate(-45deg);
}
.collapsible-icon-mini.active {
  transform: rotate(180deg);
}

/* =============================================
   LAYERS PANEL
   ============================================= */
.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: border-color 0.2s, background 0.2s;
}
.layer-item:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.05);
}
.layer-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.layer-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.layer-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-controls {
  display: flex;
  align-items: center;
  gap: 2px;
}
.layer-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
}
.layer-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}
.layer-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.layer-item.dragging {
  opacity: 0.5;
  background: rgba(99, 102, 241, 0.2);
  border-style: dashed;
}

.layer-item.drag-over-top {
  border-top-color: var(--primary);
  border-top-width: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.layer-item.drag-over-bottom {
  border-bottom-color: var(--primary);
  border-bottom-width: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.layer-item {
  cursor: grab;
}

.layer-item:active {
  cursor: grabbing;
}

/* =============================================
   MAIN COLUMN (viewport + timeline)
   ============================================= */
.main-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* =============================================
   TIMELINE PANEL
   ============================================= */
.timeline-panel {
  flex-shrink: 0;
  border-top: 2px solid var(--border-color);
  background: rgba(6, 9, 18, 0.97);
  display: flex;
  flex-direction: column;
  user-select: none;
  z-index: 4;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: height;
}

.timeline-header {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid transparent;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.timeline-panel:not(.tl-collapsed) .timeline-header {
  border-bottom-color: var(--border-color);
}

.panel-title-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 5px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.panel-title-btn:hover {
  color: var(--primary-color, #4f46e5);
  background: rgba(99, 102, 241, 0.08);
}

.tl-chevron, .sb-chevron { transition: transform 0.2s ease; }
.timeline-panel:not(.tl-collapsed) .tl-chevron { transform: rotate(180deg); }
.sidebar.panel-collapsed .sb-chevron { transform: rotate(180deg); }

.timeline-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.tl-total-dur-group {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.tl-total-dur-input {
  width: 48px;
  padding: 3px 6px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-main);
  font-size: 0.8rem;
  text-align: center;
  font-family: var(--font-body);
  font-weight: 600;
}
.tl-total-dur-input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 2px rgba(99,102,241,0.15); }

/* Timeline body (hidden when collapsed) */
.timeline-panel.tl-collapsed .timeline-body {
  opacity: 0;
  pointer-events: none;
}

.timeline-body {
  height: 220px;
  display: flex;
  overflow: hidden;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

/* Labels column */
.tl-labels-col {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.15);
}

.tl-col-resizer {
  width: 4px;
  cursor: ew-resize;
  background: var(--border-color);
  transition: background 0.15s;
  flex-shrink: 0;
  z-index: 10;
}
.tl-col-resizer:hover, .tl-col-resizer:active {
  background: rgba(255,255,255,0.25);
}

.tl-col-header {
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0,0,0,0.1);
}

.tl-labels-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.tl-label-row {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid rgba(255,255,255,0.035);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  gap: 6px;
  flex-shrink: 0;
}
.tl-label-row:hover { background: rgba(99,102,241,0.06); color: var(--text-main); }
/* Odstraněna plošná opacity: 0.38 pro .tl-label-row.tl-no-anim kvůli zachování čitelnosti textu (DESIGN.md 2) */
.tl-label-row.tl-no-anim .tl-label-sub, .tl-label-row.tl-no-anim .tl-icon-anim { opacity: 0.38; }
.tl-label-row.tl-selected { background: rgba(99,102,241,0.14); color: var(--primary); }
.tl-label-row.tl-selected .tl-label-name { color: var(--primary); }

.tl-label-name {
  font-family: var(--font-body), 'Plus Jakarta Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.tl-label-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

.tl-label-row { position: relative; justify-content: space-between; }
.tl-row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.tl-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.6;
  transition: all 0.15s;
}
.tl-label-row:hover .tl-action-btn {
  opacity: 1;
  background: rgba(255,255,255,0.05);
}
.tl-action-btn:hover {
  color: var(--primary);
  background: rgba(99,102,241,0.18) !important;
  border-color: rgba(99,102,241,0.4);
}

/* "+ Přidat prvek" button + popup menu at the bottom of the labels column */
.tl-labels-col { position: relative; }
.tl-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: calc(100% - 12px);
  margin: 6px;
  padding: 5px 0;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed rgba(99,102,241,0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.tl-add-btn:hover { color: var(--primary); border-color: var(--primary); background: rgba(99,102,241,0.08); }
.tl-tracks-spacer {
  height: 36px;
  flex-shrink: 0;
}
.tl-add-menu {
  /* Anchored to .timeline-panel (position: relative, no overflow) — escapes
     .timeline-body's overflow: hidden even when the panel is resized small */
  position: absolute;
  bottom: 42px;
  left: 6px;
  width: 170px;
  z-index: 60;
  flex-direction: column;
  background: var(--surface, #1e293b);
  border: 1px solid var(--border-color, rgba(255,255,255,0.12));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  padding: 4px;
  overflow: hidden;
}
.tl-add-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font-size: 0.74rem;
  text-align: left;
  color: var(--text-main, #e2e8f0);
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
.tl-add-item:hover { background: rgba(99,102,241,0.15); color: var(--primary); }
.tl-add-ico {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.8;
}
.tl-label-name { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }

/* Tracks column */
.tl-tracks-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-width: 0;
}

/* Ruler */
.tl-ruler {
  height: 26px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}

.tl-ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
}
.tl-ruler-line {
  width: 1px;
  background: rgba(255,255,255,0.08);
  height: 10px;
  margin-top: auto;
}
.tl-ruler-line.major { background: rgba(255,255,255,0.18); height: 14px; }
.tl-ruler-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  line-height: 1;
  padding: 3px 3px 0;
  white-space: nowrap;
  font-family: var(--font-body);
  font-weight: 600;
}

/* Track rows */
.tl-rows-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.tl-track-row {
  height: 34px;
  border-bottom: 1px solid rgba(255,255,255,0.035);
  position: relative;
  flex-shrink: 0;
}

/* Animation bar */
.tl-bar {
  position: absolute;
  top: 5px;
  height: 24px;
  border-radius: 5px;
  cursor: grab;
  display: flex;
  align-items: stretch;
  min-width: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  transition: filter 0.12s, box-shadow 0.12s;
  touch-action: none;
}
.tl-bar:hover { filter: brightness(1.25); box-shadow: 0 3px 12px rgba(0,0,0,0.5); }
.tl-bar.tl-dragging { filter: brightness(1.35); cursor: grabbing; z-index: 10; box-shadow: 0 4px 16px rgba(0,0,0,0.6); }
.tl-bar.tl-no-anim-bar { opacity: 0.18; cursor: default; pointer-events: none; }
.tl-bar.tl-selected-bar { box-shadow: 0 0 0 2px #fff, 0 3px 10px rgba(0,0,0,0.5); filter: brightness(1.15); }

/* ---- Compound bar (bgimage with 3 zones) ---- */
.tl-compound-bar {
  position: absolute;
  top: 5px;
  height: 24px;
  border-radius: 5px;
  overflow: hidden;
  pointer-events: none; /* container itself non-interactive; zones handle events */
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.tl-compound-bar.tl-selected-bar { box-shadow: 0 0 0 2px #fff, 0 3px 10px rgba(0,0,0,0.5); }

/* Base zone */
.tl-zone {
  position: absolute;
  top: 0; bottom: 0;
  pointer-events: all;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: filter 0.12s;
}
.tl-zone:hover { filter: brightness(1.35); }

/* Zone 1: display time — full width, semi-transparent */
.tl-zone-display {
  left: 0; right: 0;
  opacity: 0.38;
  border-radius: 5px;
}

/* Zone 2: entry animation — bright solid, positioned within bar */
.tl-zone-anim {
  opacity: 0.95;
  z-index: 2;
  border-radius: 3px;
  overflow: hidden;
}
.tl-zone-anim.tl-dragging { cursor: grabbing; filter: brightness(1.4); }

/* Zone 3: transition out — gradient fade at right edge */
.tl-zone-trans {
  right: 0;
  z-index: 3;
  background: linear-gradient(to right, transparent 0%, rgba(255,255,255,0.35) 100%);
  border-radius: 0 5px 5px 0;
  min-width: 12px;
}

/* Zone: no-anim hint */
.tl-zone-noanim {
  left: 0; right: 0;
  z-index: 2;
  justify-content: flex-start;
  opacity: 0.55;
}

/* Label inside zone */
.tl-zone-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  padding: 0 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Label sub-line in bgimage rows */
.tl-label-sub {
  font-size: 0.6rem;
  color: var(--text-muted);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

/* Highlighted field (slider) in sidebar — pulse ring */
@keyframes tl-field-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(99,102,241,0); background: transparent; }
  25%  { box-shadow: 0 0 0 3px rgba(99,102,241,0.5); background: rgba(99,102,241,0.1); }
  70%  { box-shadow: 0 0 0 4px rgba(99,102,241,0.2); background: rgba(99,102,241,0.06); }
  100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); background: transparent; }
}
.tl-field-highlighted {
  border-radius: 6px;
  animation: tl-field-pulse 1.8s ease forwards;
}

.tl-bar-inner {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 0 6px 0 7px;
  font-size: 0.6rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: rgba(255,255,255,0.9);
  pointer-events: none;
  display: flex;
  align-items: center;
  letter-spacing: 0.02em;
}

.tl-bar-resize {
  position: absolute;
  top: 0; bottom: 0;
  width: 16px;
  flex-shrink: 0;
  cursor: ew-resize;
  background: rgba(0,0,0,0.25);
  border-radius: 0 4px 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.tl-bar-resize.tl-bar-resize-left {
  left: 0; right: auto; border-radius: 4px 0 0 4px;
}
.tl-bar-resize.tl-bar-resize-right {
  right: 0; left: auto; border-radius: 0 4px 4px 0;
}
.tl-bar-resize::after {
  content: '';
  width: 2px;
  height: 14px;
  border-radius: 2px;
  background: rgba(255,255,255,0.7);
}
.tl-fx-zone:hover .tl-bar-resize, .tl-bar:hover .tl-bar-resize { opacity: 1; }

/* Time cursor line */
.tl-time-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(99,102,241,0.5);
  pointer-events: none;
  z-index: 5;
}

/* Empty state */
.tl-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.45;
  font-style: italic;
  padding: 0 20px;
  text-align: center;
}

/* =============================================
   TIMELINE v2 — Compound bars + Transitions
   ============================================= */

/* Header controls (simplified) */
.tl-dur-group {
  display: flex;
  align-items: center;
  gap: 5px;
}
.tl-play-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.tl-play-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); }

/* Transition label/track rows — same height, lighter styling */
.tl-trans-label-row {
  background: rgba(99,102,241,0.04);
  border-bottom-color: rgba(255,255,255,0.02) !important;
}
.tl-trans-label-row:hover { background: rgba(99,102,241,0.08); }

/* Compound outer bar — visible "static/present" zone with diagonal hatching */
.tl-comp-outer {
  position: absolute;
  top: 5px;
  height: 24px;
  border-radius: 5px;
  pointer-events: all;
  cursor: pointer;
  touch-action: none;
  /* background-color set inline; stripe overlay via ::after */
}
.tl-comp-outer::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255,255,255,0) 0px, rgba(255,255,255,0) 3px,
    rgba(255,255,255,0.09) 3px, rgba(255,255,255,0.09) 4px
  );
  pointer-events: none;
}
.tl-comp-outer:hover { filter: brightness(1.1); }
.tl-comp-outer.tl-comp-no-anim { opacity: 0.28; }
.tl-comp-outer.tl-comp-no-anim:hover { opacity: 0.55; }
.tl-comp-outer.tl-selected-bar { box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 2px 10px rgba(0,0,0,0.5); }

/* FX zone — bright solid overlay inside compound bar */
.tl-fx-zone {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: grab;
  z-index: 2;
  transition: filter 0.1s;
  touch-action: none;
}
.tl-fx-zone:hover { filter: brightness(1.3); }
.tl-fx-zone.tl-dragging { cursor: grabbing; filter: brightness(1.45); z-index: 5; }

/* Continuous effect bar — dotted, full width of outer */
.tl-continuous-bar {
  position: absolute;
  top: 25%; bottom: 25%;
  left: 0; right: 0;
  border-radius: 3px;
  border-width: 2px;
  border-style: dashed;
  background: transparent !important;
  display: flex;
  align-items: center;
  padding: 0 6px;
  cursor: pointer;
  opacity: 0.85;
  overflow: hidden;
}
.tl-continuous-bar:hover { opacity: 1; }

/* FX badge ("FX" microtext in top-left of FX zone) */
.tl-fx-badge {
  position: absolute;
  top: 2px; left: 14px;
  font-size: 0.42rem;
  font-weight: 900;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.08em;
  pointer-events: none;
  line-height: 1;
  text-transform: uppercase;
}

/* Zone label (inside FX zone and transition bar) */
.tl-zone-label {
  padding: 0 16px 0 16px;
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

/* Transition bar between slides */
.tl-transition-bar {
  position: absolute;
  top: 9px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(99,102,241,0.55) 0%, rgba(168,85,247,0.45) 100%);
  border: 1px dashed rgba(168,85,247,0.65);
  cursor: ew-resize;
  display: flex;
  align-items: center;
  overflow: hidden;
  min-width: 6px;
  touch-action: none;
  transition: filter 0.12s;
  z-index: 1;
}
.tl-transition-bar:hover { filter: brightness(1.35); border-style: solid; }
.tl-transition-bar.tl-dragging { filter: brightness(1.5); cursor: ew-resize; }
.tl-transition-bar.tl-selected-bar { box-shadow: 0 0 0 2px rgba(168,85,247,0.8); }

/* Updated label sub-line for bgimage rows */
.tl-label-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
  opacity: 0.8;
}

/* ---- Per-image background anim cards ---- */
.bg-anim-card { margin-bottom: 10px; }

/* Outer bar right-edge resize handle (slideDuration drag) */
.tl-comp-outer-resize {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 12px;
  cursor: ew-resize;
  z-index: 4;
  border-radius: 0 5px 5px 0;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: all;
}
.tl-comp-outer-resize::after {
  content: '';
  width: 2px; height: 12px;
  background: rgba(255,255,255,0.45);
  border-radius: 2px;
  pointer-events: none;
}
.tl-comp-outer:hover .tl-comp-outer-resize { opacity: 1; }
.tl-comp-outer-resize.tl-dragging { opacity: 1; cursor: ew-resize; }

/* Outer bar left-edge resize handle — shortens element visibility from the start */
.tl-comp-outer-resize-left {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 12px;
  cursor: ew-resize;
  z-index: 4;
  border-radius: 5px 0 0 5px;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: all;
}
.tl-comp-outer-resize-left::after {
  content: '';
  width: 2px; height: 12px;
  background: rgba(255,255,255,0.45);
  border-radius: 2px;
  pointer-events: none;
}
.tl-comp-outer:hover .tl-comp-outer-resize-left { opacity: 1; }
.tl-comp-outer-resize-left.tl-dragging { opacity: 1; cursor: ew-resize; }

/* Trimmed outer bar — right edge is a hard cut, not a fade to timeline end */
.tl-comp-outer.tl-has-visible-end {
  border-right: 2px solid rgba(255,255,255,0.4);
}
.tl-comp-outer.tl-has-visible-end .tl-comp-outer-resize {
  opacity: 0.6;
}



/* ---- Content Set (Block) bars ---- */
.tl-block-bar {
  position: absolute;
  top: 3px;
  height: 28px;
  border-radius: 5px;
  border: 1.5px solid var(--block-color, #6366f1);
  background: color-mix(in srgb, var(--block-color, #6366f1) 15%, transparent);
  cursor: grab;
  display: flex;
  align-items: center;
  padding: 0 16px;
  min-width: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  touch-action: none;
}
.tl-block-bar:active { cursor: grabbing; }
.tl-block-bar .tl-zone-label { font-size: 0.7rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tl-block-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 16px;
  background: rgba(0,0,0,0.25);
  cursor: ew-resize;
  opacity: 0.6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
}
.tl-block-handle::after {
  content: '';
  width: 2px;
  height: 14px;
  border-radius: 2px;
  background: rgba(255,255,255,0.7);
}
.tl-block-bar:hover .tl-block-handle { opacity: 1; }
.tl-block-handle-left  { left: 0;  border-radius: 4px 0 0 4px; }
.tl-block-handle-right { right: 0; border-radius: 0 4px 4px 0; }
.tl-block-label-row {
  background: rgba(99,102,241,0.06);
  border-bottom: 1px solid rgba(99,102,241,0.12) !important;
}
.tl-block-label-row:hover { background: rgba(99,102,241,0.1) !important; }
.tl-block-track-row { height: 34px; border-bottom: 1px solid rgba(99,102,241,0.12); }

/* Expand button */
.tl-expand-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px 3px; display: flex; align-items: center; flex-shrink: 0;
}
.tl-expand-btn:hover { color: var(--text-color); }

/* Sub-rows inside expanded blocks */
.tl-subrow { background: rgba(0,0,0,0.12) !important; height: 28px; }
.tl-subrow:hover { background: rgba(99,102,241,0.06) !important; }
.tl-subrow-track { background: rgba(0,0,0,0.08); height: 28px; }
.tl-subrow-track .tl-comp-outer { height: 18px; top: 5px; }

/* =============================================
   TIMELINE v3 — Resize, Zoom, Playhead
   ============================================= */

/* Resize drag handle */
.tl-resize-handle {
  position: absolute;
  top: -5px; left: 0; right: 0;
  height: 10px;
  cursor: ns-resize;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tl-resize-handle::after {
  content: '';
  width: 32px; height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.12);
  transition: background 0.15s;
}
.tl-resize-handle:hover::after { background: rgba(255,255,255,0.28); }
/* make panel relative for the absolute handle */
.timeline-panel { position: relative; }

/* Timeline body — flex: 1, no fixed height */
.timeline-body {
  display: flex;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

/* Zoom controls */
.tl-zoom-group {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}
.tl-zoom-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 24px; height: 24px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
  flex-shrink: 0;
  line-height: 1;
}
.tl-zoom-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.08); }
.tl-zoom-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
  text-align: center;
  padding: 0 2px;
  pointer-events: none;
}

/* Tracks column — updated structure */
.tl-tracks-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

/* Ruler wrapper — hides overflow, JS syncs scrollLeft */
.tl-ruler-wrap {
  flex-shrink: 0;
  overflow: hidden;
  height: 26px;
  width: 100%;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0,0,0,0.1);
}
.tl-ruler {
  height: 26px;
  position: relative;
}

/* Rows outer — THE scroll container (both x and y) */
.tl-rows-outer {
  flex: 1;
  overflow: auto;
  position: relative;
  min-height: 0;
  width: 100%;
}
.tl-rows-list {
  position: relative;
  /* min-width set via JS based on zoom */
}

/* Playhead vertical line */
.tl-playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: rgba(168, 85, 247, 0.85);
  pointer-events: none;
  z-index: 8;
  display: none;
  will-change: left;
}
.tl-playhead::before {
  content: '';
  position: absolute;
  top: -1px; left: -4px;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid rgba(168, 85, 247, 0.85);
}
/* Ruler playhead marker */
.tl-ruler-playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: rgba(168, 85, 247, 0.85);
  pointer-events: none;
  z-index: 8;
  display: none;
}

/* Interactive seek — click on ruler places the playhead */
.tl-ruler { cursor: pointer; }
.tl-playhead.tl-seeked,
.tl-ruler-playhead.tl-seeked { background: rgba(245, 158, 11, 0.9); }
.tl-playhead.tl-seeked::before { border-top-color: rgba(245, 158, 11, 0.9); }

/* Override old tl-rows-list overflow that could interfere */
.tl-rows-list {
  overflow: visible !important;
  flex: none !important;
}

/* Auto-save status indicator */
.autosave-status {
  font-size: 0.7rem;
  color: transparent;
  align-self: center;
  white-space: nowrap;
  padding: 0 8px;
  min-width: 100px;
  text-align: center;
  transition: color 0.3s;
}
.autosave-status.pending { color: var(--text-muted); }
.autosave-status.saving  { color: var(--text-muted); }
.autosave-status.saved   { color: #4ade80; animation: save-confirm 0.4s ease-out both; }
.autosave-status.error   { color: #f87171; }

@keyframes save-confirm {
  0%   { opacity: 0.5; transform: scale(0.93); }
  55%  { opacity: 1;   transform: scale(1.05); }
  100% { opacity: 1;   transform: scale(1); }
}

/* =============================================
   TEMPLATE CARDS — DEFINITIVNÍ VZHLED (SAFEGUARD)
   Záměrně na konci souboru: přebíjí případné kolize
   výše v kaskádě. Náhled má pevnou výšku 150 px.
   ============================================= */
.template-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  /* Tvrdá spodní hranice velikosti karty — karta se nesmí stlačit,
     ani kdyby grid řádky komprimoval (náhled 150 + info sekce). */
  min-height: 225px;
}
.template-banner-preview {
  width: 100%;
  height: 150px;
  min-height: 150px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  overflow: hidden;
}
.tpl-preview-logo-bar { display: flex; align-items: center; gap: 5px; }
.tpl-preview-logo-img { width: 14px; height: 14px; border-radius: 3px; object-fit: contain; flex-shrink: 0; }
.tpl-preview-logo-dot { width: 12px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tpl-preview-logo-line { height: 3px; width: 28px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.tpl-preview-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 4px 0;
}
.tpl-preview-headline { font-size: 0.7rem; font-weight: 700; line-height: 1.2; overflow: hidden; }
.tpl-preview-subline { font-size: 0.52rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-preview-cta {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 3px 7px;
  display: inline-block;
  align-self: flex-start;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.template-info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.template-name { font-size: 0.82rem; font-weight: 700; color: var(--text-main); }

/* Segmented Control for Cards (Obsah vs Animace) */
.card-segmented-control {
  display: flex;
  background: rgba(0,0,0,0.05);
  border-radius: 6px;
  padding: 2px;
  margin-bottom: 12px;
}
.card-segmented-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 0;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1;
  transition: all 0.2s ease;
}
.card-segmented-btn:hover {
  background: rgba(0,0,0,0.03);
}
.card-segmented-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* === Object-centric UI Additions === */

/* Collapsible Left Panel */
.sidebar {
  position: relative;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  will-change: width;
}

.sidebar.panel-collapsed {
  width: 38px;
  cursor: pointer;
}

.sidebar.panel-collapsed:hover {
  background: rgba(99, 102, 241, 0.04);
}

.sidebar.panel-collapsed:hover #btn-sidebar-toggle {
  color: var(--primary-color, #4f46e5);
}

.sidebar.panel-collapsed #sidebar-inner-scroll {
  overflow: hidden;
}

#elements-list-container,
#element-detail-view {
  transition: opacity 0.2s ease;
}

.sidebar.panel-collapsed #elements-list-container,
.sidebar.panel-collapsed #element-detail-view {
  opacity: 0 !important;
  pointer-events: none;
}

.sidebar.panel-collapsed .sidebar-sticky-header > div:last-child {
  display: none !important;
}

.sidebar.panel-collapsed .sidebar-sticky-header {
  height: 100%;
  padding: 0 !important;
  border-bottom: none !important;
}

.sidebar.panel-collapsed #btn-sidebar-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  width: 100%;
  padding: 24px 0 !important;
  margin: 0 !important;
  border-radius: 0;
  gap: 20px;
  background: none;
}

.sidebar.panel-collapsed #btn-sidebar-toggle span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  margin: 12px 0;
}

.sidebar.panel-collapsed #btn-sidebar-toggle .sb-chevron {
  margin-top: auto;
}

/* Segmented controls for detail view — active state uses primary color text */
.segmented-control-wrapper .card-segmented-btn.active {
  background: rgba(99,102,241,0.12);
  box-shadow: none;
  color: var(--primary);
}

/* Canvas filtering */
.canvas-grid.view-only-strip .preview-card:not([data-height="90"]) { display: none !important; }
.canvas-grid.view-only-mini .preview-card:not([data-width="320"]) { display: none !important; }
.canvas-grid.view-only-landscape .preview-card:not([data-width="480"]):not([data-width="970"][data-height="250"]):not([data-width="970"][data-height="310"]) { display: none !important; }
.canvas-grid.view-only-square .preview-card:not([data-width="300"][data-height="250"]):not([data-width="336"]):not([data-width="300"][data-height="300"]) { display: none !important; }
.canvas-grid.view-only-portrait .preview-card:not([data-width="300"][data-height="600"]):not([data-width="160"]):not([data-width="320"][data-height="480"]):not([data-width="720"]) { display: none !important; }

/* Timeline Collapsed Header Styling */
.timeline-panel.tl-collapsed .timeline-header {
  cursor: pointer;
  transition: background-color 0.2s;
}

.timeline-panel.tl-collapsed .timeline-header:hover {
  background: rgba(99, 102, 241, 0.04);
}

.timeline-panel.tl-collapsed .timeline-header:hover .panel-title-btn {
  color: var(--primary-color, #4f46e5);
}

.timeline-panel.tl-collapsed {
  height: 38px !important;
  overflow: hidden;
}

.timeline-panel.tl-resizing {
  transition: none !important;
}

/* Layer items */
.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-main);
  font-weight: 700;
}
.layer-item:hover {
  border-color: var(--primary-color);
}
.layer-item.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 1px var(--primary-color);
}


.sidebar-sticky-header {
    background: var(--bg-surface-solid);
    padding-top: 16px;
    z-index: 20;
}

.viewport-toolbar .context-switcher {
    padding: 0;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
}
.viewport-toolbar .context-switcher > div {
    margin-bottom: 0 !important;
    align-items: center !important;
}
.viewport-toolbar .context-switcher select {
    margin-bottom: 0;
    width: auto;
    min-width: 200px;
}

/* Hide nested legacy segmented controls in detail view since we have master tabs now */
#element-detail-content .card-segmented-control {
    display: none !important;
}

/* Hide legacy 'add element' buttons inside the detail view */
#element-detail-content #btn-add-headline,
#element-detail-content #btn-add-subline,
#element-detail-content #btn-add-shape,
#element-detail-content #btn-add-shape-new,
#element-detail-content #btn-add-shape-img,
#element-detail-content #btn-add-shape-yt {
    display: none !important;
}

/* Force complete hiding of dimmed preview cards to fulfill the implementation plan requirement */
.preview-card.context-dimmed {
    display: none !important;
}

.image-preview-card.active-slide-card {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
  position: relative;
}
.image-preview-card.active-slide-card::after {
  content: 'Aktivní';
  position: absolute;
  top: -6px;
  right: 8px;
  background: var(--primary);
  color: white;
  font-size: 0.6rem;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1;
}

/* Color and hover animations for detail tab buttons */
.card-segmented-btn[data-detail-tab="obsah"] svg { color: #0ea5e9; }
.card-segmented-btn[data-detail-tab="vzhled"] svg { color: #a855f7; }
.card-segmented-btn[data-detail-tab="kompozice"] svg { color: #f97316; }
.card-segmented-btn[data-detail-tab="animace"] svg { color: #6366f1; }

.card-segmented-btn svg {
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s, color 0.2s;
}
.card-segmented-btn:hover svg,
.card-segmented-btn.active svg {
  opacity: 1;
  transform: scale(1.15);
}

/* =============================================
   OBSAHOVÉ SADY (content set grouping)
   ============================================= */

.sada-section {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 7px;
  overflow: visible;
  margin-bottom: 6px;
  position: relative;
}

.sada-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  background: rgba(99,102,241,0.08);
  border-radius: 6px 6px 0 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary);
  min-height: 28px;
}

/* Sada kebab dropdown — positioned relative to .sada-section */
.sada-section > .kebab-dropdown {
  top: 28px;
  right: 4px;
  left: auto;
}

.sada-time-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 2px;
}

.sada-actions {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}

.sada-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 4px 4px 10px;
  border-left: 2px solid rgba(99,102,241,0.2);
  margin-left: 4px;
  margin-bottom: 2px;
}

.sada-body .layer-item {
  border-radius: 5px;
}

/* =============================================
   TYPOGRAPHY UNIFICATION SYSTEM
   ============================================= */

/* Sidebar section main titles (Outfit font, large bold title) */
.sidebar-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
  margin: 0;
}

/* Panel group headings inside cards (e.g. "Nadpis 1", "Tvar 1") */
.panel-group-title {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
  margin-bottom: 8px;
}

/* Standardized labels fallback */
.form-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

/* Tiny text-muted labels */
.text-muted-xs {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.4;
}

.text-muted-sm {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  line-height: 1.4;
}

/* Helper navigation links (Styly -> Typografie etc) */
.helper-link {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s, text-decoration 0.2s;
  display: inline-flex;
  align-items: center;
}
.helper-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Informative container boxes with dashed border */
.hint-box {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.06);
  border: 1px dashed rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  padding: 8px 12px;
  line-height: 1.4;
}
.hint-box-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Error/warning tags */
.alert-warning {
  font-family: var(--font-body);
  font-size: 0.78rem;
  background: rgba(239, 68, 68, 0.1);
  border-left: 4px solid var(--danger);
  color: #fca5a5;
  padding: 10px 12px;
  border-radius: 4px;
  line-height: 1.4;
}

/* Smaller buttons and text-based icon-btn configurations */
.btn-xs {
  padding: 3px 6px;
  font-size: 0.68rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-plus-circle, .plus-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.icon-btn-text {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 8px;
}

.layer-folder-header {
  user-select: none;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: rgba(99, 102, 241, 0.15) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.layer-folder-header:hover {
  background: rgba(99, 102, 241, 0.16) !important;
  border-color: rgba(99, 102, 241, 0.35) !important;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.layer-folder-header:hover svg,
.layer-folder.open .layer-folder-header svg {
  color: #a5b4fc !important;
}

.layer-folder.open .layer-folder-header {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%) !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.12);
}

.layer-folder {
  transition: margin 0.2s ease;
}

.layer-folder.open {
  margin-bottom: 12px;
}

.kebab-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
  z-index: 1000;
  min-width: 140px;
  padding: 4px;
}

.kebab-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-color);
  border-radius: 4px;
  transition: background 0.15s;
}

.kebab-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.kebab-dropdown-item.danger {
  color: #ef4444;
}

/* Sidebar toggle visibility in collapsed/expanded states */
#btn-sidebar-toggle span {
  display: none;
}
.sidebar.panel-collapsed #btn-sidebar-toggle span {
  display: block;
}
.sidebar.panel-collapsed .sidebar-title {
  display: none !important;
}
.sidebar.panel-collapsed .sidebar-header-row {
  height: 100%;
  margin: 0 !important;
  display: block !important;
}


.tl-playhead-time {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
}
.tl-seeked .tl-playhead-time { background: var(--warning, #f59e0b); }

/* =============================================
   MICRO-ANIMATIONS — personality touches
   ============================================= */

/* Check-status dot: jemný pulse při warn (3× a stop) */
@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}
.check-status-dot.warn {
  animation: dot-pulse 0.9s ease-in-out 3;
}

/* Dropzone: shake při neplatném formátu souboru */
@keyframes dropzone-shake {
  0%, 100% { transform: translateX(0); }
  18%       { transform: translateX(-5px); }
  36%       { transform: translateX(5px); }
  54%       { transform: translateX(-4px); }
  72%       { transform: translateX(3px); }
}
.dropzone.invalid-drop {
  animation: dropzone-shake 0.38s ease;
  border-color: var(--danger) !important;
}

/* Export tlačítko: ring pulse po úspěšném exportu */
@keyframes export-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(99, 102, 241, 0.55); }
  65%  { box-shadow: 0 0 0 9px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0   rgba(99, 102, 241, 0); }
}
.export-success {
  animation: export-pulse 1.1s ease-out;
}

/* Play tlačítko: drobný bounce na ikoně při kliknutí */
@keyframes play-icon-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35); }
  60%  { transform: scale(0.88); }
  100% { transform: scale(1); }
}
#btn-play-all.playing svg {
  animation: play-icon-bounce 0.38s ease both;
}

/* Logo ikona v headeru: lehký naklonění na hover */
.logo-icon {
  transition: transform 0.22s ease;
}
.logo-icon:hover {
  transform: rotate(4deg) scale(1.08);
}

/* Template card hover lift — umístěno pod SAFEGUARD blokem */
.template-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.template-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.35);
}
