/* SPA navigation — progress bar & skeleton placeholders */

/* ---- Top progress bar ---- */
.tdtv-spa-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.tdtv-spa-progress.is-active,
.tdtv-spa-progress.is-complete {
    opacity: 1;
}

.tdtv-spa-progress__bar {
    height: 100%;
    width: 0;
    background: var(--tdtv-accent, #ffdd95);
    box-shadow: 0 0 8px rgba(255, 221, 149, 0.5);
    transition: width 0.2s ease;
}

.tdtv-spa-progress.is-active .tdtv-spa-progress__bar {
    width: 30%;
    animation: tdtv-spa-progress-indeterminate 1.2s ease-in-out infinite;
}

.tdtv-spa-progress.is-complete .tdtv-spa-progress__bar {
    width: 100% !important;
    animation: none;
    transition: width 0.15s ease;
}

@keyframes tdtv-spa-progress-indeterminate {
    0% {
        transform: translateX(-100%);
        width: 30%;
    }
    50% {
        width: 50%;
    }
    100% {
        transform: translateX(350%);
        width: 30%;
    }
}

/* ---- Navigating state ---- */
html.tdtv-spa-navigating {
    cursor: progress;
}

html.tdtv-spa-navigating a {
    pointer-events: none;
}

/* ---- Content enter fade ---- */
#main.tdtv-spa-content-enter {
    animation: tdtv-spa-content-enter 0.2s ease;
}

@keyframes tdtv-spa-content-enter {
    from {
        opacity: 0.4;
    }
    to {
        opacity: 1;
    }
}

/* ---- Skeleton primitives ---- */
.tdtv-skeleton {
    background: var(--tdtv-surface, #16171c);
    border-radius: var(--tdtv-radius-sm, 8px);
    position: relative;
    overflow: hidden;
}

.tdtv-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.06) 50%,
        transparent 100%
    );
    transform: translateX(-100%);
    animation: tdtv-skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes tdtv-skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tdtv-spa-progress.is-active .tdtv-spa-progress__bar {
        animation: none;
        width: 60%;
    }

    .tdtv-skeleton::after {
        animation: none;
        display: none;
    }

    #main.tdtv-spa-content-enter {
        animation: none;
    }
}

/* ---- Skeleton layout shell ---- */
.tdtv-spa-skeleton {
    padding: 0;
}

.tdtv-spa-skeleton__header {
    margin-bottom: 24px;
}

.tdtv-spa-skeleton__breadcrumb {
    height: 14px;
    width: 200px;
    margin-bottom: 16px;
}

.tdtv-spa-skeleton__title {
    height: 28px;
    width: 60%;
    max-width: 400px;
    margin-bottom: 10px;
}

.tdtv-spa-skeleton__subtitle {
    height: 16px;
    width: 40%;
    max-width: 280px;
}

/* ---- Grid skeleton (home, archive, search) ---- */
.tdtv-spa-skeleton__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.tdtv-spa-skeleton-card__poster {
    aspect-ratio: 2 / 3;
    border-radius: var(--tdtv-radius, 14px);
    margin-bottom: 12px;
}

.tdtv-spa-skeleton-card__title {
    height: 16px;
    width: 90%;
    margin-bottom: 8px;
}

.tdtv-spa-skeleton-card__meta {
    height: 12px;
    width: 55%;
}

@media (max-width: 768px) {
    .tdtv-spa-skeleton__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

/* ---- Single video skeleton ---- */
.tdtv-spa-skeleton--single .tdtv-spa-skeleton__player {
    aspect-ratio: 16 / 9;
    border-radius: var(--tdtv-radius, 14px);
    margin-bottom: 20px;
    max-width: 100%;
}

.tdtv-spa-skeleton--single .tdtv-spa-skeleton__video-title {
    height: 24px;
    width: 75%;
    max-width: 600px;
    margin-bottom: 12px;
}

.tdtv-spa-skeleton--single .tdtv-spa-skeleton__video-meta {
    height: 14px;
    width: 45%;
    max-width: 320px;
    margin-bottom: 28px;
}

.tdtv-spa-skeleton__related-heading {
    height: 20px;
    width: 180px;
    margin-bottom: 16px;
}

.tdtv-spa-skeleton__related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.tdtv-spa-skeleton__related-grid .tdtv-spa-skeleton-card__poster {
    aspect-ratio: 2 / 3;
}

/* ---- Generic page skeleton ---- */
.tdtv-spa-skeleton--generic .tdtv-spa-skeleton__line {
    height: 16px;
    margin-bottom: 12px;
}

.tdtv-spa-skeleton--generic .tdtv-spa-skeleton__line:nth-child(1) {
    width: 70%;
}

.tdtv-spa-skeleton--generic .tdtv-spa-skeleton__line:nth-child(2) {
    width: 95%;
}

.tdtv-spa-skeleton--generic .tdtv-spa-skeleton__line:nth-child(3) {
    width: 85%;
}

.tdtv-spa-skeleton--generic .tdtv-spa-skeleton__line:nth-child(4) {
    width: 60%;
}
