/* ============================================================
   studio.css – editor podcastov a epizód v artist konzole
   (dialógy, karty podcastov, potvrdenia, toasty).
   Načítava sa PO style.css -> dedí premenné, dark mode aj accent.js.
   ============================================================ */

:root {
  --st-danger: #e5484d;
  --st-danger-rgb: 229, 72, 77;
  --st-ok: #2fa86b;
}

/* ---------- Karta „Moje podcasty" ---------- */
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 4px;
}
.card-head h2 { margin-bottom: 0; }
.card-head .btn { padding: 9px 18px; gap: 6px; }

.pod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.pod-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-rows: auto auto;
  gap: 4px 14px;
  align-items: center;
  width: 100%;
  padding: 12px;
  text-align: left;
  font: inherit; color: var(--text);
  background: var(--surface-light);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .12s, box-shadow .18s;
}
.pod-card:hover {
  border-color: rgba(var(--accent-rgb), .45);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.pod-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pod-card-cover {
  grid-row: 1 / 3;
  width: 64px; height: 64px; border-radius: 10px;
  object-fit: cover; background: var(--bg);
}
.pod-card-cover.ph {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; color: var(--text-muted);
}
.pod-card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pod-card-title {
  font-weight: 700; font-size: .98rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pod-card-meta { font-size: .78rem; color: var(--text-secondary); }
.pod-card-tag {
  align-self: flex-start;
  font-size: .7rem; font-weight: 600;
  padding: 2px 9px; border-radius: 60px;
  background: var(--bg); color: var(--text-muted);
}
.pod-card-tag.on { background: rgba(var(--accent-rgb), .15); color: var(--accent); }
.pod-card-edit {
  grid-column: 2;
  font-size: .76rem; font-weight: 600; color: var(--accent);
  opacity: 0; transform: translateX(-4px);
  transition: opacity .18s, transform .18s;
}
.pod-card:hover .pod-card-edit,
.pod-card:focus-visible .pod-card-edit { opacity: 1; transform: none; }

.pod-empty {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 28px 16px;
  font: inherit; color: var(--text);
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.pod-empty span { font-size: .85rem; color: var(--text-secondary); }
.pod-empty:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), .05); }

.ep-edit-btn { border: 1px solid var(--border); }
.ep-edit-btn:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

/* ============================================================
   DIALÓG
   ============================================================ */
dialog.studio {
  padding: 0; border: none; background: transparent; color: var(--text);
  max-width: none; max-height: none;
  width: 100%; height: 100%;
  margin: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
dialog.studio:not([open]) { display: none; }
dialog.studio::backdrop {
  background: rgba(10, 6, 20, .42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: st-fade .2s ease;
}

.studio-panel {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(var(--accent-rgb), .28), 0 2px 8px rgba(0, 0, 0, .08);
  animation: st-pop .26s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}
.studio-confirm .studio-panel { width: min(420px, calc(100% - 32px)); }

@keyframes st-fade { from { opacity: 0; } }
@keyframes st-pop {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

dialog.studio.busy .studio-body { opacity: .65; pointer-events: none; transition: opacity .2s; }

/* ---------- hlavička ---------- */
.studio-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .07), transparent);
}
.studio-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.studio-kicker {
  font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.studio-title {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.25;
  overflow-wrap: anywhere;
}
.studio-sub { font-size: .8rem; color: var(--text-secondary); }
.studio-stats {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.studio-stats span {
  font-size: .72rem; padding: 2px 9px; border-radius: 60px;
  background: var(--surface-light); color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.studio-x {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: background .15s, color .15s;
}
.studio-x:focus { outline: none; }
.studio-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-x:hover { background: var(--surface-light); color: var(--text); }

/* ---------- telo ---------- */
.studio-body {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 22px 8px;
  display: flex; flex-direction: column; gap: 18px;
}

.studio-top {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 20px;
  align-items: start;
}
.studio-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.studio-field { display: flex; flex-direction: column; gap: 6px; border: none; min-width: 0; }
.studio-field > span,
.studio-field > legend {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: .8rem; font-weight: 600; color: var(--text-secondary);
  padding: 0;
}
.studio-field > legend { margin-bottom: 6px; }
.studio-field em {
  font-style: normal; font-weight: 500; font-size: .72rem;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.studio-field em.near { color: var(--st-danger); }

.studio input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.studio textarea,
.studio select { margin: 0; }
.studio textarea { resize: vertical; min-height: 96px; line-height: 1.5; font-family: inherit; }
.studio .invalid {
  border-color: var(--st-danger) !important;
  box-shadow: 0 0 0 3px rgba(var(--st-danger-rgb), .15) !important;
}

/* ---------- obal ---------- */
.studio-cover-wrap { display: flex; flex-direction: column; gap: 8px; }
.studio-cover {
  position: relative;
  width: 168px; aspect-ratio: 1 / 1;
  padding: 0; border-radius: 16px; overflow: hidden;
  border: 2px dashed var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .18s, background .18s;
}
.studio-cover:hover, .studio-cover.drag {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), .06);
}
.studio-cover.has { border-style: solid; border-color: transparent; }
.studio-cover img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.studio-cover-ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: .8rem; text-align: center; padding: 10px;
}
.studio-cover-ph b { color: var(--text); font-weight: 600; }
.studio-cover-ph i { font-style: normal; font-size: .7rem; }
.studio-cover.has .studio-cover-ph { display: none; }
.studio-cover-hover {
  position: absolute; inset: auto 0 0 0;
  padding: 22px 8px 10px;
  font-size: .78rem; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6));
  opacity: 0; transition: opacity .18s;
}
.studio-cover.has:hover .studio-cover-hover,
.studio-cover.has:focus-visible .studio-cover-hover { opacity: 1; }
.studio-cover:not(.has) .studio-cover-hover { display: none; }
.studio-cover-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  min-height: 18px;
  font-size: .72rem; color: var(--text-muted);
}
.studio-link {
  border: none; background: none; padding: 0;
  font: inherit; font-weight: 600; color: var(--st-danger); cursor: pointer;
}
.studio-link:hover { text-decoration: underline; }

/* ---------- kategórie ---------- */
.studio-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.studio-cat { position: relative; cursor: pointer; }
.studio-cat input { position: absolute; opacity: 0; pointer-events: none; }
.studio-cat span {
  display: inline-block;
  padding: 7px 13px; border-radius: 60px;
  font-size: .82rem; font-weight: 500;
  background: var(--surface-light); color: var(--text-secondary);
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.studio-cat:hover span { color: var(--text); border-color: var(--border); }
.studio-cat input:checked + span {
  background: var(--accent); color: var(--accent-ink, #fff); font-weight: 600;
}
html.dark .studio-cat input:checked + span { color: var(--bg); }
.studio-cat input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- box (predplatné, audio) ---------- */
.studio-box {
  padding: 16px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
}

.studio-switch { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.studio-switch input { position: absolute; opacity: 0; pointer-events: none; }
.studio-switch-ui {
  flex: none; position: relative;
  width: 42px; height: 24px; margin-top: 1px;
  border-radius: 60px; background: var(--border);
  transition: background .2s;
}
.studio-switch-ui::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .22s cubic-bezier(.3, 1.4, .5, 1);
}
.studio-switch input:checked + .studio-switch-ui { background: var(--accent); }
.studio-switch input:checked + .studio-switch-ui::after { transform: translateX(18px); }
.studio-switch input:focus-visible + .studio-switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-switch-text { display: flex; flex-direction: column; gap: 2px; }
.studio-switch-text b { font-size: .95rem; }
.studio-switch-text i { font-style: normal; font-size: .8rem; color: var(--text-secondary); line-height: 1.45; }

.studio-sub-price { display: flex; flex-direction: column; gap: 8px; padding-left: 54px; }
.studio-sub-price[hidden] { display: none; }

.studio-money {
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 220px;
}
.studio-money input {
  width: 110px !important;
  font-size: 1.05rem !important; font-weight: 700;
  font-variant-numeric: tabular-nums; text-align: right;
}
.studio-money span { font-size: .85rem; color: var(--text-secondary); white-space: nowrap; }

.studio-hint { font-size: .78rem; color: var(--text-secondary); line-height: 1.5; }
.studio-hint.warn {
  padding: 8px 12px; border-radius: 10px;
  background: rgba(255, 170, 60, .13); color: #b86a00;
}
html.dark .studio-hint.warn { color: #ffb74d; }
.studio-hint[hidden] { display: none; }

/* ---------- cena epizódy ---------- */
.studio-price-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.studio-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.studio-chip {
  padding: 6px 12px; border-radius: 60px;
  font: inherit; font-size: .8rem; font-weight: 600;
  background: var(--surface-light); color: var(--text-secondary);
  border: 1px solid transparent; cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background .15s, color .15s, border-color .15s;
}
.studio-chip:hover { color: var(--text); border-color: var(--border); }
.studio-chip.active { background: rgba(var(--accent-rgb), .16); color: var(--accent); border-color: rgba(var(--accent-rgb), .4); }

/* ---------- audio ---------- */
.studio-audio {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 14px;
}
.studio-audio-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--accent-rgb), .14); color: var(--accent);
}
.studio-audio-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.studio-audio-info b { font-size: .92rem; }
.studio-audio-info span { font-size: .8rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.studio-audio-note { grid-column: 1 / -1; margin-top: 6px; }
.studio-outline { border: 1px solid var(--border); padding: 7px 14px; }
.studio-outline:hover { border-color: var(--accent); color: var(--accent); background: transparent; }

.studio-progress {
  height: 4px; margin-top: 6px; border-radius: 4px;
  background: var(--border); overflow: hidden;
}
.studio-progress[hidden] { display: none; }
.studio-progress span {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: inherit;
  transition: width .2s ease;
}

/* ---------- zmazanie ---------- */
.studio-danger {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(var(--st-danger-rgb), .28);
  background: rgba(var(--st-danger-rgb), .05);
}
.studio-danger div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.studio-danger b { font-size: .9rem; color: var(--st-danger); }
.studio-danger span { font-size: .78rem; color: var(--text-secondary); }

.studio .btn.danger,
.btn.danger.studio-btn {
  gap: 6px;
  background: var(--st-danger); color: #fff;
  box-shadow: 0 4px 10px rgba(var(--st-danger-rgb), .25);
}
.studio .btn.danger:hover { background: #cf3a3f; }
.studio .btn.small.danger { padding: 7px 14px; }

/* ---------- pätička ---------- */
.studio-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.studio-foot .btn { padding: 10px 20px; }
.studio-foot .btn.ghost { border: 1px solid var(--border); }
.studio-err {
  flex: 1; margin: 0;
  font-size: .82rem; color: var(--st-danger); line-height: 1.4;
}
.studio-err:empty { visibility: hidden; }

/* ---------- potvrdenie ---------- */
.studio-confirm-body { padding: 22px 22px 6px; }
.studio-confirm-body h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; overflow-wrap: anywhere; }
.studio-confirm-body p { font-size: .88rem; color: var(--text-secondary); line-height: 1.5; }
.studio-confirm .studio-foot { border-top: none; padding-top: 16px; }

/* ============================================================
   TOASTY
   ============================================================ */
.toast-host {
  position: fixed; left: 50%; bottom: 24px; z-index: 3000;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: calc(100% - 32px);
  pointer-events: none;
}
.toast {
  padding: 11px 18px; border-radius: 12px;
  font-size: .88rem; font-weight: 600; line-height: 1.4;
  color: var(--surface); background: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  opacity: 0; transform: translateY(10px);
  transition: opacity .25s, transform .25s cubic-bezier(.2, .8, .2, 1);
}
.toast.in { opacity: 1; transform: none; }
.toast.error { background: var(--st-danger); color: #fff; }

/* ============================================================
   MOBIL – editor ako spodný panel
   ============================================================ */
@media (max-width: 640px) {
  dialog.studio.studio-editor { align-items: flex-end; }
  .studio-editor .studio-panel {
    width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top) - 16px);
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    animation: st-up .3s cubic-bezier(.2, .8, .2, 1);
  }
  @keyframes st-up { from { transform: translateY(40px); opacity: 0; } }

  .studio-head { padding: 16px 16px 12px; }
  .studio-body { padding: 16px 16px 8px; }
  .studio-foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    flex-wrap: wrap;
  }
  .studio-err { flex-basis: 100%; }
  .studio-err:empty { display: none; }
  .studio-foot .btn { flex: 1; }

  .studio-top { grid-template-columns: 1fr; }
  .studio-cover-wrap { flex-direction: row; align-items: center; gap: 14px; }
  .studio-cover { width: 104px; flex: none; }
  .studio-cover-meta { flex-direction: column; align-items: flex-start; }
  .studio-sub-price { padding-left: 0; }
  .studio-audio { grid-template-columns: auto 1fr; }
  .studio-audio .studio-outline { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }
  .studio-danger { flex-direction: column; align-items: stretch; }
  .studio input, .studio textarea, .studio select { font-size: 16px !important; } /* iOS nezoomuje */

  .pod-grid { grid-template-columns: 1fr; }
  .pod-card-edit { opacity: 1; transform: none; }
  .toast-host { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .studio-panel, dialog.studio::backdrop, .toast { animation: none !important; transition: none !important; }
}
