/* web/static/css/uploadYouTube.css */

.yt-page {
  max-width: 980px;
  margin: 0 auto;
}

/* Prevent long titles from running off-screen */
.yt-page h1,
.yt-meta .title {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.yt-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

/* Base Card Style */
.yt-card {
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.dark-mode .yt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.yt-card h2,
.yt-card h3 {
  margin: 0 0 10px;
}

/* Forms */
.yt-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.yt-form label {
  display: grid;
  gap: 6px;
}

.yt-form input[type="url"],
.yt-form input[type="text"],
.yt-form input[type="number"],
.yt-form select {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  box-sizing: border-box;
}

.dark-mode .yt-form input[type="url"],
.dark-mode .yt-form input[type="text"],
.dark-mode .yt-form input[type="number"],
.dark-mode .yt-form select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

/* Actions Bar */
.yt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}

.yt-actions button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  cursor: pointer;
}

.yt-actions button.primary {
  background: #0a7cff;
  border-color: #0a7cff;
  color: #fff;
}

.yt-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}

.dark-mode .yt-actions button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

.dark-mode .yt-actions button.primary {
  background: #2b7cff;
  border-color: #2b7cff;
  color: #fff;
}

/* Meta Section */
.yt-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.yt-meta img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.dark-mode .yt-meta img {
  border: 1px solid var(--border);
}

.yt-meta .title {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.25;
}

.yt-meta .sub {
  opacity: 0.82;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  margin-top: 4px;
}

.yt-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 640px) {
  .yt-grid-2 {
    grid-template-columns: 1fr;
  }
}

.yt-status {
  margin-left: 2px;
  opacity: 0.85;
}

/* ─────────────────────────────────────────────────────────────
   Chapter Editor List
   ───────────────────────────────────────────────────────────── */

.yt-chapter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

/* Chapter Card */
.yt-chapter-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dark-mode .yt-chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

/* Toolbar (Search/Expand) */
.yt-chapter-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.yt-chapter-toolbar input {
  flex: 1;
  min-width: 160px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.15);
}

.dark-mode .yt-chapter-toolbar input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

/* Chapter Header Row */
.yt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.yt-title-input {
  flex: 1 1 220px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  font-weight: 650;
  box-sizing: border-box;
}

.dark-mode .yt-title-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

.yt-lock-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9em;
  user-select: none;
}

/*
   Time Blocks Grid
   Using 145px min allows side-by-side on devices > 310px width.
*/
.yt-times-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.yt-time-block {
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dark-mode .yt-time-block {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}

.yt-time-label {
  font-weight: 600;
  font-size: 0.9em;
  opacity: 0.9;
}

.yt-time-input {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  box-sizing: border-box;
}

.dark-mode .yt-time-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

.yt-time-error {
  color: #cc0000;
  font-size: 0.8em;
  min-height: 1.1em;
  line-height: 1.1;
}

.dark-mode .yt-time-error {
  color: #ff6b6b;
}

.yt-time-actions {
  display: flex;
  gap: 6px;
}

.yt-time-actions button {
  flex: 1;
  padding: 6px 4px;
  font-size: 0.85em;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  cursor: pointer;
}

.dark-mode .yt-time-actions button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

/* Chapter Actions (Footer) */
.yt-chap-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.yt-chap-actions button {
  padding: 6px 10px;
  font-size: 0.9em;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fcfcfc;
  cursor: pointer;
}

.dark-mode .yt-chap-actions button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

/* ─────────────────────────────────────────────────────────────
   Guided Review UI
   ───────────────────────────────────────────────────────────── */

.yt-gr {
  display: grid;
  gap: 12px;
}

.yt-gr-top {
  display: grid;
  gap: 4px;
}

.yt-gr-title {
  font-weight: 850;
}

.yt-gr-sub {
  opacity: 0.85;
  font-size: 0.95rem;
}

.yt-gr-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

@media (max-width: 720px) {
  .yt-gr-controls {
    grid-template-columns: 1fr;
  }
}

.yt-gr-field {
  display: grid;
  gap: 6px;
}

.yt-gr-label {
  font-size: 0.88rem;
  opacity: 0.85;
}

.yt-gr-field input,
.yt-gr-field select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  box-sizing: border-box;
}

.dark-mode .yt-gr-field input,
.dark-mode .yt-gr-field select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

.yt-gr-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.yt-gr-actions button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  cursor: pointer;
}

.yt-gr-actions button.primary {
  background: #0a7cff;
  border-color: #0a7cff;
  color: #fff;
}

.dark-mode .yt-gr-actions button {
  background: var(--bg-input);
  color: var(--fg-primary);
  border: 1px solid var(--border);
}

.dark-mode .yt-gr-actions button.primary {
  background: #2b7cff;
  border-color: #2b7cff;
  color: #fff;
}

.yt-gr-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 900px) {
  .yt-gr-main {
    grid-template-columns: 1fr;
  }
}

.yt-gr-left,
.yt-gr-right {
  display: grid;
  gap: 10px;
}

.yt-gr-boundary-title {
  font-weight: 800;
}

.yt-gr-boundary-meta {
  opacity: 0.85;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

.yt-gr-audio audio {
  width: 100%;
}

.yt-gr-transport {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.yt-gr-transport button {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  cursor: pointer;
}

.dark-mode .yt-gr-transport button {
  background: var(--bg-input);
  color: var(--fg-primary);
  border: 1px solid var(--border);
}

.yt-gr-nowline {
  display: flex;
  gap: 10px;
  align-items: center;
}

.yt-gr-nowline strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.yt-gr-apply-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.yt-gr-apply-actions button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  cursor: pointer;
}

.yt-gr-apply-actions button.primary {
  background: #0a7cff;
  border-color: #0a7cff;
  color: #fff;
}

.dark-mode .yt-gr-apply-actions button {
  background: var(--bg-input);
  color: var(--fg-primary);
  border: 1px solid var(--border);
}

.dark-mode .yt-gr-apply-actions button.primary {
  background: #2b7cff;
  border-color: #2b7cff;
  color: #fff;
}

.yt-gr-nudge {
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.02);
}

.dark-mode .yt-gr-nudge {
  background: color-mix(in oklab, var(--bg-card) 85%, #000 15%);
  border: 1px solid var(--border);
}

.yt-gr-nudge-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.yt-gr-nudge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.yt-gr-nudge-row button {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  cursor: pointer;
}

.dark-mode .yt-gr-nudge-row button {
  background: var(--bg-input);
  color: var(--fg-primary);
  border: 1px solid var(--border);
}

.yt-gr-candidates {
  display: grid;
  gap: 10px;
}

.yt-gr-empty {
  opacity: 0.85;
}

.yt-gr-cand-list {
  display: grid;
  gap: 10px;
}

.yt-gr-cand {
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
}

.dark-mode .yt-gr-cand {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

.yt-gr-cand-top {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.yt-gr-cand-time {
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.yt-gr-cand-key {
  opacity: 0.85;
  font-size: 0.95rem;
}

.yt-gr-cand-body pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  opacity: 0.9;
}

.yt-muted {
  opacity: 0.8;
  font-size: 0.95rem;
}

/* Transcript follow bar */
.yt-tr-followbar {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
}

.dark-mode .yt-tr-followbar {
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: color-mix(in oklab, var(--bg-card) 85%, #000 15%);
}

.yt-preview {
  display: grid;
  gap: 8px;
}

.yt-preview audio {
  width: 100%;
}

/* ─────────────────────────────────────────────────────────────
   Per-chapter Transcript refine wrapper
   ───────────────────────────────────────────────────────────── */

.yt-tr-wrap {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.dark-mode .yt-tr-wrap {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.yt-tr-wrap-head {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.yt-tr-toggle {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  cursor: pointer;
}

.yt-tr-toggle:disabled {
  opacity: 0.55;
  cursor: default;
}

.dark-mode .yt-tr-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

.yt-tr-wrap-body {
  margin-top: 10px;
}

/* Transcript refine inner status line */
.yt-tr-statusline {
  margin-top: 8px;
}

/* ─────────────────────────────────────────────────────────────
   URL List with Reordering
   ───────────────────────────────────────────────────────────── */

.url-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.url-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  cursor: grab;
}

.dark-mode .url-list-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.url-list-item:active {
  cursor: grabbing;
}

.url-list-item.dragging {
  opacity: 0.5;
  border-style: dashed;
}

.url-list-item.drag-over {
  border-color: #007bff;
  background: rgba(0, 123, 255, 0.05);
}

.url-list-drag {
  font-size: 1.2em;
  opacity: 0.5;
  cursor: grab;
}

.url-list-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9em;
}

.url-list-title {
  font-weight: 600;
  font-size: 0.85em;
  opacity: 0.8;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-list-remove {
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: #dc3545;
  cursor: pointer;
  font-size: 1.1em;
  opacity: 0.6;
}

.url-list-remove:hover {
  opacity: 1;
}

.url-list-move {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.url-list-move button {
  padding: 2px 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  cursor: pointer;
  font-size: 0.75em;
  border-radius: 4px;
}

.dark-mode .url-list-move button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--fg-primary);
}

/* ─────────────────────────────────────────────────────────────
   Playlist Video List
   ───────────────────────────────────────────────────────────── */

.playlist-video-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.playlist-video-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 8px;
}

.dark-mode .playlist-video-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.playlist-video-item:hover {
  background: rgba(0, 0, 0, 0.02);
}

.dark-mode .playlist-video-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.playlist-video-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.playlist-video-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  background: #eee;
  flex-shrink: 0;
}

.dark-mode .playlist-video-thumb {
  background: var(--bg-input);
}

.playlist-video-info {
  flex: 1;
  min-width: 0;
}

.playlist-video-title {
  font-weight: 500;
  cursor: pointer;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-video-meta {
  font-size: 0.85em;
  opacity: 0.7;
  margin-top: 2px;
}

.yt-progress {
  display: grid;
  gap: 6px;
}

.yt-progress-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.yt-progress-bar {
  height: 100%;
  width: 0%;
  background: #0a7cff;
  transition: width 0.25s ease;
}

.yt-progress-text {
  font-size: 0.9em;
  opacity: 0.85;
}

.dark-mode .yt-progress-track {
  background: rgba(255, 255, 255, 0.12);
}
