/* Video Library section — extends the dashboard's dark+gold theme. */

.video-library {
    margin-bottom: 3rem;
}
.video-library .section-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.video-library .totals {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.video-controls {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}
.video-controls input[type=search],
.video-controls select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
}
.video-controls input[type=search] {
    flex: 1 1 200px;
    min-width: 200px;
}
.video-controls select {
    flex: 0 0 auto;
}
.status-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.status-chip {
    padding: 0.3rem 0.75rem;
    border-radius: 16px;
    font-size: 0.8rem;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}
.status-chip[aria-pressed="true"] {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
@media (max-width: 900px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .video-grid { grid-template-columns: 1fr; }
    .video-controls { flex-direction: column; align-items: stretch; }
}
.video-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, border-color 0.2s;
}
.video-card:hover { transform: translateY(-3px); border-color: var(--accent-gold); }
.video-card .thumb {
    aspect-ratio: 16 / 9;
    background: #000;
    position: relative;
    overflow: hidden;
}
.video-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.video-card .thumb .duration-overlay {
    position: absolute;
    bottom: 0.4rem;
    right: 0.4rem;
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
}
.video-card .body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}
.video-card h3 {
    font-size: 1rem;
    line-height: 1.35;
    color: var(--text-primary);
}
.video-card h3 a {
    color: inherit;
    text-decoration: none;
}
.video-card h3 a:hover { color: var(--accent-gold); }
.video-card .meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.video-card .stats {
    color: var(--text-secondary);
    font-size: 0.8rem;
}
.video-card .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}
.video-card .actions button,
.video-card .actions a.btn-mini {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}
.video-card .actions button:hover,
.video-card .actions a.btn-mini:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}
.video-card .actions button[aria-pressed="true"] {
    background: rgba(245,158,11,0.15);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}
.video-card .actions button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge.pending      { background: rgba(245,158,11,0.15); color: var(--accent-gold); }
.badge.fetched      { background: rgba(34,197,94,0.15);  color: var(--accent-bullish); }
.badge.error        { background: rgba(239,68,68,0.15);  color: var(--accent-bearish); }
.badge.downloading  { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge.skipped      { background: rgba(107,114,128,0.20); color: var(--accent-neutral); }

.spinner {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border-radius: 12px;
}

.toast-region {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    pointer-events: none;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: toast-in 0.18s ease-out;
    pointer-events: auto;
}
.toast.success { border-left-color: var(--accent-bullish); }
.toast.error   { border-left-color: var(--accent-bearish); }
.toast.info    { border-left-color: var(--accent-gold); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

dialog.video-dialog {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 720px;
    width: 90%;
}
dialog.video-dialog::backdrop { background: rgba(0,0,0,0.7); }
dialog.video-dialog h3 { margin-bottom: 1rem; color: var(--accent-gold); }
dialog.video-dialog textarea {
    width: 100%;
    min-height: 120px;
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}
dialog.video-dialog .transcript-body {
    max-height: 60vh;
    overflow: auto;
    background: var(--bg-dark);
    padding: 1rem;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    line-height: 1.5;
}
dialog.video-dialog .dialog-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
dialog.video-dialog button {
    background: var(--accent-gold);
    color: #000;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
}
dialog.video-dialog button.secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
