/* YouTube article workspace — page-scoped styles (/yt/).
   Overview cards + editor shell (#yt-root tokens) + topbar pencil + article. */

/* ── Shared small helpers ─────────────────────────────────────────── */
.yt-status { font-size: 0.78rem; color: #9ca3af; min-height: 1.1rem; }
.yt-status.is-success { color: #34d399; }
.yt-status.is-error { color: #f87171; }
.hidden { display: none !important; }

/* ── Overview cards (base_app shell) ──────────────────────────────── */
.yt-card-media img { transition: transform 0.2s ease; }
.yt-card-media:hover img { transform: scale(1.03); }
.yt-play-badge {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.4rem; color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.yt-duration-chip {
  position: absolute; right: 0.4rem; bottom: 0.4rem;
  background: rgba(0, 0, 0, 0.78); color: #fff;
  font-size: 0.68rem; font-weight: 600;
  padding: 0.1rem 0.35rem; border-radius: 4px;
  pointer-events: none;
}

/* Part number of a split transcription ("del 2"), lifted out of the title so
   it survives the card's two-line clamp — see YouTubeVideo.part_label. */
.yt-part-chip {
  display: inline-block; vertical-align: baseline;
  background: rgba(236, 91, 19, 0.15); color: #f7a06b;
  border: 1px solid rgba(236, 91, 19, 0.35);
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.05rem 0.3rem; border-radius: 4px;
  margin-right: 0.15rem;
}

/* ── Topbar pencil link (viewer .reader-editor-link look) ─────────── */
.yt-editor-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: #ec5b13; border: 1px solid #d16839;
  color: #ffffff; text-decoration: none; flex-shrink: 0;
  box-shadow: 0 0 12px rgba(236, 91, 19, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.yt-editor-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(236, 91, 19, 0.45);
}
.yt-editor-link .material-symbols-outlined { font-size: 1.2rem; line-height: 1; }

/* ── Editor shell (#yt-root) ──────────────────────────────────────── */
/* Canonical topbar contract (docs/template-layout-target.md §4), scoped to
   #yt-root so the overview page (base_app shell) is unaffected. */
#yt-root .app-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: 3.5rem;
  padding: 0 1rem;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--bar-border);
}
#yt-root .app-topbar h1 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
}
#yt-root .app-back {
  color: var(--text-faint);
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.15s;
}
#yt-root .app-back:hover { color: var(--text-primary); }
#yt-root .app-topbar-divider {
  flex-shrink: 0;
  width: 1px;
  height: 1.4rem;
  background: var(--bar-border);
  margin: 0 0.15rem;
}
#yt-root .yt-topbar-tabs {
  display: flex; gap: 0.4rem; min-width: 0; overflow-x: auto;
}
#yt-root .yt-workflow-tab {
  /* /boeger workflow-tab look: rounded rect, not pill */
  font: inherit; font-size: 0.72rem; font-weight: 600; text-align: left;
  color: var(--text-muted);
  background: var(--ctrl-bg); border: 1px solid var(--ctrl-border);
  border-radius: 0.25rem; padding: 0.375rem 0.75rem;
  cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, filter 0.15s;
}
#yt-root .yt-workflow-tab:hover {
  color: var(--text-primary); border-color: rgba(236, 91, 19, 0.5);
}
#yt-root .yt-workflow-tab.is-active {
  color: #fff; border-color: #ec5b13;
  background: rgba(236, 91, 19, 0.2);
}
#yt-root .yt-workflow-tab.is-active:hover { filter: brightness(1.1); }
/* The pill sizes to its own text — the workflow tabs (flex: 1) give up the
   room. The cap only kicks in when the title would crowd out the tabs. */
#yt-root .app-topbar-meta {
  color: var(--text-muted); font-size: 0.78rem; margin: 0;
  white-space: nowrap; overflow: hidden; max-width: 50vw;
  flex: 0 1 auto; min-width: 0;
}
/* Selected-record indicator in the topbar banner */
#yt-root .yt-selected-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  max-width: 100%; min-width: 0;
  background: rgba(236, 91, 19, 0.12);
  border: 1px solid rgba(236, 91, 19, 0.55);
  border-radius: 9999px;
  padding: 0.18rem 0.6rem;
  color: #fdba74; font-size: 0.75rem; font-weight: 600;
  white-space: nowrap;
}
#yt-root .yt-selected-chip .material-symbols-outlined {
  font-size: 0.9rem; line-height: 1; color: #ec5b13; flex-shrink: 0;
}
#yt-root .yt-selected-chip-id {
  flex-shrink: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem; padding: 0.05rem 0.28rem; border-radius: 4px;
  background: rgba(236, 91, 19, 0.22); color: #fed7aa;
}
#yt-root .yt-selected-chip-label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
#yt-root .app-avatar-wrap { position: relative; flex-shrink: 0; }
#yt-root .app-avatar {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  overflow: hidden; cursor: pointer; border: 1px solid var(--ctrl-border);
}
#yt-root .app-avatar img { width: 100%; height: 100%; object-fit: cover; }
#yt-root .app-avatar-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 0.4rem);
  min-width: 11rem; background: var(--card-bg);
  border: 1px solid var(--card-border); border-radius: 10px;
  padding: 0.4rem; z-index: 40;
}
#yt-root .app-avatar-menu a,
#yt-root .app-avatar-menu button {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  background: none; border: none; font: inherit; font-size: 0.8rem;
  color: var(--text-primary); text-align: left; text-decoration: none;
  padding: 0.45rem 0.55rem; border-radius: 7px; cursor: pointer;
}
#yt-root .app-avatar-menu a:hover,
#yt-root .app-avatar-menu button:hover { background: rgba(236, 91, 19, 0.07); }

.yt-editor-body { flex: 1; min-height: 0; overflow: hidden; padding: 1rem; }
.yt-tab-panel { height: 100%; min-height: 0; overflow: hidden; }
.yt-tab-layout {
  display: grid; gap: 1rem;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  max-width: 120rem; margin: 0 auto; min-height: 0;
  height: 100%;
}
.yt-tab-layout > section {
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
}
.yt-tab-layout > section > .yt-card { flex: 1; min-height: 0; }
.yt-tab-layout-wide {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
/* Tab 3: Udgivelse 1/3 — Forhåndsvisning 2/3 */
.yt-tab-layout-publish {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}
.yt-tab-layout-narrow { grid-template-columns: minmax(0, 55rem); justify-content: center; }
@media (max-width: 900px) {
  .yt-tab-layout, .yt-tab-layout-wide, .yt-tab-layout-publish { grid-template-columns: 1fr; height: auto; }
  .yt-tab-layout > section > .yt-card { flex: none; }
  .yt-editor-body { overflow-y: auto; }
  .yt-tab-panel { overflow: visible; height: auto; }
}

/* Narrow black scrollbars on every overflowing area of the workspace */
#yt-root * {
  scrollbar-width: thin;
  scrollbar-color: #000000 transparent;
}
#yt-root ::-webkit-scrollbar { width: 6px; height: 6px; }
#yt-root ::-webkit-scrollbar-track { background: transparent; }
#yt-root ::-webkit-scrollbar-thumb {
  background: #000000; border-radius: 9999px;
}
#yt-root ::-webkit-scrollbar-thumb:hover { background: #2d333b; }
#yt-root ::-webkit-scrollbar-corner { background: transparent; }

/* Panels */
.yt-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 12px; padding: 1rem 1.1rem;
}
.jt-fullheight { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.yt-card h2 {
  font-size: 0.95rem; font-weight: 600; color: var(--text-primary);
  margin: 0;
}
.yt-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 0.75rem; flex-shrink: 0;
}
.yt-hint { color: var(--text-muted); font-size: 0.78rem; margin: 0.35rem 0 0.75rem; }
.yt-hint-inline { color: var(--text-faint); font-size: 0.72rem; }
.yt-empty-hint {
  border: 1px dashed var(--ctrl-border); border-radius: 10px;
  color: var(--text-muted); font-size: 0.8rem; padding: 0.85rem;
  background: var(--ctrl-bg);
}
.is-disabled { opacity: 0.45; pointer-events: none; }

/* Records column */
.yt-records-column {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 12px; padding: 1rem 1.1rem;
}
.yt-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem; flex-shrink: 0;
}
.yt-panel-head h2 { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.yt-records-list { display: flex; flex-direction: column; gap: 0.4rem; flex: 1; min-height: 0; overflow-y: auto; }
.yt-record-row {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--ctrl-bg); border: 1px solid var(--ctrl-border);
  border-radius: 10px; padding: 0.5rem 0.6rem; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.yt-record-row:hover { background: rgba(236, 91, 19, 0.07); }
.yt-record-row.is-selected {
  background: rgba(236, 91, 19, 0.12);
  border-color: rgba(236, 91, 19, 0.6);
}
.yt-record-thumb {
  width: 4rem; height: 2.25rem; border-radius: 6px; overflow: hidden;
  background: #12161b; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text-faint);
}
.yt-record-thumb img { width: 100%; height: 100%; object-fit: cover; }
.yt-record-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.yt-record-title {
  color: var(--text-primary); font-size: 0.8rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* The link must not stretch across the row — clicking anywhere but the URL
   text itself has to select the record, not open YouTube. */
.yt-record-url { min-width: 0; display: flex; }
.yt-record-url a {
  color: var(--text-faint); font-size: 0.65rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: inline-block; max-width: 100%; min-width: 0; text-decoration: none;
}
.yt-record-url a:hover { color: #ec5b13; text-decoration: underline; }
.yt-record-sub { color: var(--text-faint); font-size: 0.7rem;
  display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.yt-record-sub-text {
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.yt-record-id {
  flex-shrink: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.62rem; line-height: 1; padding: 0.15rem 0.3rem;
  border-radius: 4px; background: rgba(236, 91, 19, 0.14);
  border: 1px solid rgba(236, 91, 19, 0.3); color: #ec5b13;
}
.yt-record-actions { display: flex; gap: 0.2rem; flex-shrink: 0; }
.yt-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.7rem; height: 1.7rem; border-radius: 7px;
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.yt-icon-btn:hover { background: rgba(236, 91, 19, 0.12); color: #ec5b13; }
.yt-icon-btn .material-symbols-outlined { font-size: 1rem; }

/* Create card */
/* Tab 1's right column holds two stacked cards (bridge howto + bridge token).
   The generic `.yt-tab-layout > section > .yt-card { flex: 1 }` would stretch
   each to half of the fixed-height panel and clip whatever didn't fit — which
   cut the token card off. Let the cards size to their content and scroll the
   column instead. */
.yt-create-column { min-width: 0; gap: 1rem; overflow-y: auto; }
.yt-tab-layout > section.yt-create-column > .yt-card { flex: none; }
#yt-root label {
  display: block; font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted); margin: 0.6rem 0 0.25rem;
}
#yt-root input[type="text"], #yt-root select, #yt-root textarea {
  width: 100%; font: inherit; font-size: 0.82rem;
  background: var(--ctrl-bg); color: var(--text-primary);
  border: 1px solid var(--ctrl-border); border-radius: 8px;
  padding: 0.45rem 0.6rem; outline: none;
}
#yt-root input:focus, #yt-root select:focus, #yt-root textarea:focus {
  border-color: #ec5b13; box-shadow: 0 0 0 2px rgba(236, 91, 19, 0.18);
}
#yt-root textarea { resize: vertical; }
#yt-root textarea.yt-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.yt-actions-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.9rem; }
.yt-actions-row.yt-wrap { flex-wrap: wrap; }
.yt-actions-row.yt-between { justify-content: space-between; }

/* Visually hidden (screen-reader accessible) form controls */
#yt-root .yt-visually-hidden {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important;
  white-space: nowrap !important; border: 0 !important;
}

/* Styled file-picker row (replaces the raw file input look) */
.yt-file-row {
  display: flex; align-items: center; gap: 0.6rem;
  margin-top: 0.7rem; min-width: 0;
}
.yt-file-row .yt-btn-secondary { flex-shrink: 0; }
.yt-file-name {
  font-size: 0.78rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; flex: 1;
}
.yt-file-name.has-file { color: var(--text-primary); }

/* Cookie summary (what the stored cookies.txt actually contains) */
.yt-cookie-summary {
  margin-top: 0.75rem; padding: 0.6rem 0.7rem;
  background: var(--ctrl-bg); border: 1px solid var(--ctrl-border);
  border-radius: 8px;
}
.yt-cookie-headline {
  font-size: 0.75rem; font-weight: 600; color: var(--text-primary);
  margin: 0 0 0.35rem;
}
.yt-cookie-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 9.5rem; overflow-y: auto;
}
#yt-root .yt-cookie-list li { margin: 0; padding: 0; }
.yt-cookie-row {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.72rem; color: var(--text-muted);
  padding: 0.14rem 0;
}
.yt-cookie-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem; color: var(--text-primary);
}
.yt-cookie-badge {
  font-size: 0.62rem; font-weight: 700; line-height: 1;
  padding: 0.18rem 0.38rem; border-radius: 999px;
  background: rgba(52, 211, 153, 0.15); color: #34d399;
}
.yt-cookie-badge.is-dropped {
  background: rgba(248, 113, 113, 0.15); color: #f87171;
}
.yt-cookie-note { font-size: 0.68rem; color: var(--text-muted); margin: 0.45rem 0 0; }

/* Progress log for the "Hent transskription" button */
.yt-progress {
  margin-top: 0.7rem; padding: 0.55rem 0.7rem;
  background: var(--ctrl-bg); border: 1px solid var(--ctrl-border);
  border-radius: 8px; max-height: 13rem; overflow-y: auto;
}
.yt-progress-list { list-style: none; margin: 0; padding: 0; }
#yt-root .yt-progress-list li { margin: 0; padding: 0; }
.yt-progress-line {
  display: flex; align-items: baseline; gap: 0.5rem;
  font-size: 0.72rem; color: var(--text-muted);
  padding: 0.14rem 0;
}
.yt-progress-line.is-success { color: #34d399; }
.yt-progress-line.is-warning { color: #fbbf24; }
.yt-progress-line.is-error { color: #f87171; }
.yt-progress-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.65rem; opacity: 0.75; flex-shrink: 0;
}
.yt-checkbox-label {
  display: inline-flex !important; align-items: center; gap: 0.4rem;
  flex-direction: row; margin: 0 !important; font-size: 0.78rem !important;
}
.yt-checkbox-label input { accent-color: #ec5b13; }

.yt-btn-primary {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-size: 0.78rem; font-weight: 600;
  color: #fff; background: #ec5b13; border: 1px solid #d44e0d;
  border-radius: 8px; padding: 0.45rem 0.85rem; cursor: pointer;
  transition: background 0.15s;
}
.yt-btn-primary:hover { background: #d44e0d; }
.yt-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.yt-btn-secondary {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-size: 0.75rem; font-weight: 600;
  color: var(--text-primary); background: #2d333b;
  border: 1px solid var(--ctrl-border); border-radius: 8px;
  padding: 0.4rem 0.75rem; cursor: pointer; text-decoration: none;
  transition: background 0.15s;
}
.yt-btn-secondary:hover { background: #373e47; }
.yt-btn-secondary .material-symbols-outlined,
.yt-btn-primary .material-symbols-outlined { font-size: 1rem; }

.yt-spinner {
  width: 0.85rem; height: 0.85rem; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff; border-radius: 50%;
  animation: yt-spin 0.7s linear infinite;
}
@keyframes yt-spin { to { transform: rotate(360deg); } }

/* Prompt tab */
.yt-prompt-column, .yt-preview-column, .yt-publish-column, .yt-transcript-column { min-width: 0; }
.yt-prompt-fields { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
.yt-preview-iframe {
  flex: 1; width: 100%; border: 1px solid var(--ctrl-border);
  border-radius: 8px; background: #ffffff; min-height: 12rem;
}
/* Editable fetched transcript — fills its card like the preview pane */
#yt-transcript-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden;
}
#yt-transcript-input {
  flex: 1; min-height: 12rem; resize: none; line-height: 1.55;
}
.yt-empty-hint { flex-shrink: 0; }
.yt-actions-row.yt-end { justify-content: flex-end; }

/* Publish tab */
.yt-meta-summary { margin: 0.25rem 0 0.5rem; }
.yt-meta-summary > div {
  display: flex; gap: 0.6rem; padding: 0.3rem 0;
  border-bottom: 1px solid var(--card-border);
}
.yt-meta-summary dt {
  color: var(--text-faint); font-size: 0.75rem; flex-shrink: 0;
  width: 7.5rem;
}
.yt-meta-summary dd {
  margin: 0; color: var(--text-primary); font-size: 0.8rem;
  min-width: 0; overflow-wrap: anywhere;
}
.yt-meta-summary dd a { color: #ec5b13; text-decoration: none; }
.yt-meta-summary dd a:hover { text-decoration: underline; }
.yt-publish-body {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  overflow-y: auto;
}

@media (max-width: 640px) {
  #yt-root .yt-topbar-tabs { display: none; }
  #yt-root .app-topbar-meta { max-width: 10rem; }
  .yt-editor-body { padding: 0.75rem; }
}