/* === Unified VOD Card === */

.unified-card-group {
    padding: 0.85rem;
}

.unified-card-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 0.85rem;
}

/* === Shell === */
.unified-card-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    z-index: 0;
}

.unified-card-shell:hover {
    z-index: 1;
}

/* === Card link === */
.unified-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-primary);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        border-color 0.18s ease;
}

.unified-card:hover,
.unified-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--card-hover-border);
    outline: none;
}

/* === Thumbnail === */
.unified-card-thumb {
    position: relative;
    flex-shrink: 0;
    padding: 0.75rem 0.75rem 0;
    background: radial-gradient(circle at top, rgba(178, 155, 255, 0.08), transparent 52%);
}

.unified-card-thumb img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    border-radius: calc(var(--radius) - 2px);
}

.vod-thumbnail-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: calc(var(--radius) - 2px);
    background: var(--bg-tertiary);
}

/* === Progress bar (injected by watch-progress.js) === */
.unified-card-thumb .resume-progress-bar {
    position: absolute;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0;
    height: 4px;
    background: rgba(15, 23, 42, 0.35);
    z-index: 3;
    border-radius: 0 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px);
}

.unified-card-thumb .resume-progress-bar span {
    display: block;
    height: 100%;
    background: var(--button-gradient);
}

/* === Duration badge === */
.unified-duration-badge {
    position: absolute;
    right: 1.1rem;
    bottom: 0.5rem;
    z-index: 2;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(12, 8, 23, 0.82);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: nowrap;
}

/* When progress bar is present, shift badge up slightly */
.unified-card-thumb:has(.resume-progress-bar) .unified-duration-badge {
    bottom: 0.75rem;
}

/* === Card body === */
.unified-card-body {
    display: flex;
    flex-direction: column;
    padding: 0.65rem 0.8rem 0.6rem;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
}

/* === Slot label (e.g. "Autoplay next" in up-next sidebar) === */
.unified-slot-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent-purple);
}

/* === Title === */
.unified-card-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--text-primary);
    min-height: 0;
    flex: none;
    letter-spacing: -0.005em;
}

/* === Meta row === */
.unified-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-top: auto;
    min-width: 0;
}

/* === Number + date pill === */
.unified-card-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    background: var(--button-secondary-bg);
    border: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-width: 0;
}

.unified-pill-number {
    color: var(--accent-purple);
}

.unified-pill-sep {
    color: var(--text-secondary);
}

.unified-meta-left {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    overflow: hidden;
}

.unified-fav-pill {
    color: #e05c94;
    border-color: rgba(224, 92, 148, 0.28);
    background: rgba(224, 92, 148, 0.08);
    gap: 0.2rem;
    flex-shrink: 0;
}

/* === Colored dots === */
.unified-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    overflow: visible;
    position: relative;
    cursor: default;
    font-size: 0.72rem;
}

.unified-dots[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: rgba(12, 8, 23, 0.88);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
}

.unified-dots[data-tip]:hover::after {
    opacity: 1;
}

@media (hover: none) {
    .unified-dots[data-tip]::after {
        display: none;
    }
}

.unified-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.unified-dot-twitch {
    background: #7c5cff;
}

.unified-dot-youtube {
    background: #e53e3e;
}

.unified-dot-yt-chat {
    background: #fc8181;
}

.unified-dot-tags {
    background: #38a169;
}

/* === Remove button (favorites page) === */
.unified-card-remove {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    z-index: 4;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: rgba(12, 8, 23, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.unified-card-remove:hover {
    background: rgba(229, 62, 62, 0.75);
}

/* === Narrow context (up-next sidebar) === */
.up-next-unified {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* === Responsive === */
@media (max-width: 640px) {
    .unified-card-group-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}
