/* ── CSS Custom Properties (inherits root from frontend.css) ─ */
/* Variables are declared on :root / [data-theme="dark"]        */
/* in tube-dreamer-frontend.css; referenced here via var().     */

.td-single { max-width: 1200px; margin: 0 auto; }

/* ── Breadcrumb ──────────────────────────────────────────── */
.ph-breadcrumb {
    margin-bottom: 0.5em;
    font-size: 0.9em;
    color: var(--td-text-muted, #aaa);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ph-breadcrumb a             { color: var(--td-accent, #ffd500); text-decoration: none; transition: color 0.2s; }
.ph-breadcrumb a:hover       { color: var(--td-accent-hover, #fff200); text-decoration: underline; }
.ph-breadcrumb-separator     { color: var(--td-text-faint, #666); }
.ph-breadcrumb-current       { color: var(--td-text, #fff); font-weight: 500; }

/* ── Ads ─────────────────────────────────────────────────── */
.td-ad { display: grid; place-items: center; margin: 12px 0; }
.td-ad__placeholder { border: 1px dashed var(--td-border, #777); padding: 12px 16px; font-size: 12px; opacity: .8; }

/* ── Two-column layout ───────────────────────────────────── */
.td-single--with-sidebar { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 1100px) {
    .td-single--with-sidebar { grid-template-columns: minmax(0, 1fr) 360px; }
}

/* ── Player ──────────────────────────────────────────────── */
.td-player-wrap iframe,
.td-player-wrap video,
.td-player-wrap img {
    width: 98%;
    height: auto !important;
    aspect-ratio: 16/9;
    display: block;
}
.td-spacer { height: 8px; }

/* ── Single header ───────────────────────────────────────── */
.td-title { margin: 0 0 6px; line-height: 1.2; font-size: clamp(20px, 2.5vw, 28px); color: var(--td-text, #fff); }

/* ── Phase 4: Meta row (views + fav) ────────────────────── */
.td-single-meta-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 6px 0 12px;
    font-size: 0.9rem;
    color: var(--td-text-muted, #aaa);
    flex-wrap: wrap;
}
.td-views-wrap { display: inline-flex; align-items: center; gap: 5px; }
.td-view-count { font-weight: 700; color: var(--td-text, #fff); }

/* ── Phase 4: Vote bar ───────────────────────────────────── */
.td-vote-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    flex-wrap: wrap;
}
.td-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--td-surface-2, #222);
    border: 1px solid var(--td-border, #333);
    color: var(--td-text-muted, #ccc);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
}
.td-vote-btn:hover           { background: var(--td-surface-3, #2a2a2a); color: var(--td-text, #fff); border-color: var(--td-border-hover, #555); }
.td-vote-like.td-voted       { background: #1a5c1a; border-color: #2a8a2a; color: #fff; }
.td-vote-dislike.td-voted    { background: #5c1a1a; border-color: #8a2a2a; color: #fff; }
.td-vote-btn.td-vote-done    { opacity: 0.6; cursor: default; pointer-events: none; }
.td-vote-btn.td-voted.td-vote-done { opacity: 1; }
.td-vote-meter {
    flex: 1;
    min-width: 80px;
    max-width: 200px;
    height: 6px;
    background: var(--td-surface-3, #333);
    border-radius: 99px;
    overflow: hidden;
}
.td-vote-bar-fill { height: 100%; background: #1aaa1a; border-radius: 99px; transition: width 0.4s ease; }
.td-vote-summary  { font-size: 0.8rem; color: var(--td-text-faint, #888); white-space: nowrap; }

/* ── Phase 4: Favorites button (single page) ────────────── */
.td-fav-btn {
    background: none;
    border: none;
    color: var(--td-text-muted, #aaa);
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    border-radius: 50%;
    transition: color 0.2s, transform 0.15s;
    vertical-align: middle;
    line-height: 1;
}
.td-fav-btn:hover             { color: #ff4d6d; transform: scale(1.2); }
.td-fav-btn.td-fav-active     { color: #ff4d6d; }
.td-fav-btn.td-fav-active svg { fill: currentColor; }

/* ── Chips / Tags ────────────────────────────────────────── */
.td-meta  { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; opacity: .9; font-size: 13px; color: var(--td-text, #fff); }
.td-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.td-chip  { background: var(--td-surface-2, #111); color: var(--td-text, #fff); padding: 4px 8px; border-radius: 999px; font-size: 12px; text-decoration: none; }
.td-tag   { font-size: 12px; border: 1px solid var(--td-border, #333); border-radius: 999px; padding: 4px 10px; color: inherit; text-decoration: none; opacity: .9; }
.td-tag:hover { opacity: 1; }

/* ── Related / Up-next grid ──────────────────────────────── */
.td-related h2, .td-up-next h2 { color: var(--td-text, #fff); margin: 24px 0 10px; font-size: 18px; }
.td-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
@media (min-width: 900px) { .td-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Horizontal scroll on mobile for related row */
@media (max-width: 640px) {
    .td-related-grid {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .td-related-grid::-webkit-scrollbar { display: none; }
}

.td-card           { display: grid; gap: 8px; }
.td-thumb          { display: block; border-radius: 10px; overflow: hidden; background: #000; }
.td-thumb img      { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.td-card-title     { font-size: 0.95rem; line-height: 1.25; margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--td-text, #fff); }
.td-card-title a   { color: inherit; text-decoration: none; }
.td-card-title a:hover { text-decoration: underline; }

/* ── Sidebar ─────────────────────────────────────────────── */
.td-sidebar h3     { margin: 0 0 12px; font-size: 1.1rem; color: var(--td-text, #fff); }
.td-side-list      { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.td-side-item      { display: grid; grid-template-columns: 128px 1fr; gap: 12px; align-items: flex-start; }
.td-side-thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; }
.td-side-title     { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; color: var(--td-accent, #ffd500); text-decoration: none; }
.td-side-title:hover { color: var(--td-accent-hover, #fff200); }

/* ── Misc ────────────────────────────────────────────────── */
.td-fallback-msg { padding: 20px; text-align: center; background: var(--td-surface-2, #222); color: var(--td-text, #fff); border-radius: 8px; }
