/* WPDM TMDB Frontend Styles */
:root {
    --tmdb-primary: #01b4e4;
    --tmdb-primary-hover: #0099c8;
    --tmdb-secondary: #0d253f;
    --tmdb-accent: #90cea1;
    --tmdb-success: #10b981;
    --tmdb-warning: #f59e0b;
    --tmdb-danger: #ef4444;
    --tmdb-bg: #f8fafc;
    --tmdb-bg-card: #ffffff;
    --tmdb-border: #e2e8f0;
    --tmdb-text: #1e293b;
    --tmdb-text-muted: #94a3b8;
    --tmdb-radius: 8px;
    --tmdb-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

/* --- Hero Section --- */
.tmdb-hero {
    position: relative;
    background-size: cover;
    background-position: center top;
    background-color: var(--tmdb-secondary);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.tmdb-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(13,37,63,0.92) 0%, rgba(13,37,63,0.7) 50%, rgba(13,37,63,0.5) 100%);
}

.tmdb-hero__content {
    position: relative;
    display: flex;
    gap: 24px;
    padding: 32px;
    z-index: 1;
}

.tmdb-hero__poster {
    width: 200px;
    height: 300px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    flex-shrink: 0;
}

.tmdb-hero__poster--round {
    width: 180px;
    height: 180px;
    border-radius: 50%;
}

.tmdb-hero__info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
}

.tmdb-hero__label {
    margin-bottom: 8px;
}

.tmdb-hero__title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #fff;
    line-height: 1.2;
}

.tmdb-hero__year {
    font-weight: 400;
    opacity: 0.7;
}

.tmdb-hero__tagline {
    font-style: italic;
    opacity: 0.8;
    margin: 0 0 12px 0;
    font-size: 15px;
}

.tmdb-hero__bio {
    opacity: 0.85;
    margin: 8px 0 0 0;
    font-size: 14px;
    line-height: 1.6;
}

.tmdb-hero__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    opacity: 0.9;
}

.tmdb-hero__rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fbbf24;
    font-weight: 700;
}
.tmdb-hero__rating-star {
    width: 16px;
    height: 16px;
    fill: #fbbf24;
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, .5));
}

.tmdb-hero--person {
    background: linear-gradient(135deg, var(--tmdb-secondary) 0%, #1a3a5c 100%);
}

.tmdb-hero--person .tmdb-hero__overlay {
    display: none;
}

/* --- Rating Badge --- */
.tmdb-rating {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.tmdb-rating__score {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1;
}

.tmdb-rating__stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.tmdb-star {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ── Color tiers ── */
.tmdb-rating--high .tmdb-rating__score { color: #d97706; }
.tmdb-rating--high .tmdb-star--full { fill: #f59e0b; filter: drop-shadow(0 0 2px rgba(245, 158, 11, .35)); }
.tmdb-rating--high .tmdb-star--partial .tmdb-star__fill { fill: #f59e0b; }
.tmdb-rating--high .tmdb-star--partial .tmdb-star__empty { fill: #e2e8f0; }
.tmdb-rating--high .tmdb-star--empty { fill: #e2e8f0; }

.tmdb-rating--mid .tmdb-rating__score { color: #d97706; }
.tmdb-rating--mid .tmdb-star--full { fill: #fbbf24; filter: drop-shadow(0 0 2px rgba(251, 191, 36, .3)); }
.tmdb-rating--mid .tmdb-star--partial .tmdb-star__fill { fill: #fbbf24; }
.tmdb-rating--mid .tmdb-star--partial .tmdb-star__empty { fill: #e2e8f0; }
.tmdb-rating--mid .tmdb-star--empty { fill: #e2e8f0; }

.tmdb-rating--low .tmdb-rating__score { color: #dc2626; }
.tmdb-rating--low .tmdb-star--full { fill: #ef4444; filter: drop-shadow(0 0 2px rgba(239, 68, 68, .3)); }
.tmdb-rating--low .tmdb-star--partial .tmdb-star__fill { fill: #ef4444; }
.tmdb-rating--low .tmdb-star--partial .tmdb-star__empty { fill: #e2e8f0; }
.tmdb-rating--low .tmdb-star--empty { fill: #e2e8f0; }

/* ── Subtle shimmer on full stars ── */
@keyframes tmdb-star-shimmer {
    0%, 100% { filter: drop-shadow(0 0 2px rgba(245, 158, 11, .3)); }
    50%      { filter: drop-shadow(0 0 5px rgba(245, 158, 11, .55)); }
}
.tmdb-rating--high .tmdb-star--full:first-of-type {
    animation: tmdb-star-shimmer 3s ease-in-out infinite;
}

/* --- Trailer --- */
.tmdb-trailer__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.tmdb-trailer__btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
}

/* Trailer Modal */
.tmdb-trailer-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 99998;
}

.tmdb-trailer-modal__content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 900px;
    z-index: 99999;
}

.tmdb-trailer-modal__close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
}

.tmdb-trailer-modal__embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
}

.tmdb-trailer-modal__embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* --- Genre Badges --- */
.tmdb-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.tmdb-genre-badge {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(1, 180, 228, 0.15);
    color: var(--tmdb-primary);
    border: 1px solid rgba(1, 180, 228, 0.3);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.tmdb-hero .tmdb-genre-badge {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
}

/* --- Type Badge --- */
.tmdb-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tmdb-type-badge--movie  { background: #eef2ff; color: #4f46e5; }
.tmdb-type-badge--tv     { background: #ecfdf5; color: #059669; }
.tmdb-type-badge--person { background: #fef3c7; color: #d97706; }

/* --- Cast Grid --- */
.tmdb-cast {
    margin: 24px 0;
}

.tmdb-cast__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--tmdb-text);
    margin: 0 0 14px 0;
}

.tmdb-cast__scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.tmdb-cast__scroll::-webkit-scrollbar {
    height: 6px;
}

.tmdb-cast__scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.tmdb-cast__scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.tmdb-cast__card {
    flex: 0 0 120px;
    text-align: center;
    scroll-snap-align: start;
}

.tmdb-cast__photo {
    width: 100px !important;
    height: 100px !important;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 8px;
    display: block;
    background: #f1f5f9;
}

.tmdb-cast__photo--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tmdb-text-muted);
}

.tmdb-cast__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--tmdb-text);
    margin-bottom: 2px;
}

.tmdb-cast__character {
    font-size: 11px;
    color: var(--tmdb-text-muted);
}

/* --- Seasons --- */
.tmdb-seasons {
    margin: 24px 0;
}

.tmdb-seasons__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--tmdb-text);
    margin: 0 0 14px 0;
}

.tmdb-season {
    border: 1px solid var(--tmdb-border);
    border-radius: var(--tmdb-radius);
    margin-bottom: 8px;
    overflow: hidden;
}

.tmdb-season__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: var(--tmdb-bg);
    border: none;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.tmdb-season__header:hover {
    background: #edf2f7;
}

.tmdb-season__info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tmdb-season__name {
    font-weight: 600;
    font-size: 14px;
    color: var(--tmdb-text);
}

.tmdb-season__date,
.tmdb-season__count {
    font-size: 12px;
    color: var(--tmdb-text-muted);
}

.tmdb-season__chevron {
    transition: transform 0.2s;
    color: var(--tmdb-text-muted);
}

.tmdb-season.open .tmdb-season__chevron {
    transform: rotate(180deg);
}

.tmdb-season__episodes {
    padding: 0 16px 12px;
}

.tmdb-season__overview {
    font-size: 13px;
    color: var(--tmdb-text-muted);
    margin: 8px 0 12px;
    line-height: 1.5;
}

.tmdb-episode {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--tmdb-border);
}

.tmdb-episode:last-child {
    border-bottom: none;
}

.tmdb-episode__number {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tmdb-bg);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--tmdb-text-muted);
}

.tmdb-episode__info {
    flex: 1;
}

.tmdb-episode__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--tmdb-text);
}

.tmdb-episode__date,
.tmdb-episode__runtime {
    font-size: 11px;
    color: var(--tmdb-text-muted);
    margin-left: 8px;
}

.tmdb-episode__rating {
    font-size: 12px;
    color: var(--tmdb-warning);
    font-weight: 600;
}

/* --- Shortcode Grid --- */
.tmdb-grid {
    display: grid;
    gap: 16px;
    margin: 24px 0;
}

.tmdb-grid--5 { grid-template-columns: repeat(5, 1fr); }
.tmdb-grid--4 { grid-template-columns: repeat(4, 1fr); }
.tmdb-grid--3 { grid-template-columns: repeat(3, 1fr); }
.tmdb-grid--2 { grid-template-columns: repeat(2, 1fr); }

.tmdb-grid__card {
    position: relative;
    border-radius: var(--tmdb-radius);
    overflow: hidden;
    background: var(--tmdb-bg-card);
    border: 1px solid var(--tmdb-border);
    box-shadow: var(--tmdb-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.tmdb-grid__card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.tmdb-grid__poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}

.tmdb-grid__info {
    padding: 10px 12px;
}

.tmdb-grid__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--tmdb-text);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tmdb-grid__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--tmdb-text-muted);
}

.tmdb-grid__rating {
    color: var(--tmdb-warning);
    font-weight: 600;
}

/* --- Carousel --- */
.tmdb-carousel {
    position: relative;
    overflow: hidden;
    margin: 24px 0;
}

.tmdb-carousel__track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}

.tmdb-carousel__track::-webkit-scrollbar {
    display: none;
}

.tmdb-carousel__item {
    flex: 0 0 200px;
    scroll-snap-align: start;
}

.tmdb-carousel__item .tmdb-grid__card {
    height: 100%;
}

/* --- Shortcode Section --- */
.tmdb-section {
    margin: 32px 0;
}

.tmdb-section__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--tmdb-text);
    margin: 0 0 16px 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .tmdb-hero__content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px 16px;
    }

    .tmdb-hero__poster {
        width: 140px;
        height: 210px;
    }

    .tmdb-hero__poster--round {
        width: 120px;
        height: 120px;
    }

    .tmdb-hero__title {
        font-size: 22px;
    }

    .tmdb-hero__meta {
        justify-content: center;
    }

    .tmdb-grid--5,
    .tmdb-grid--4 {
        grid-template-columns: repeat(3, 1fr);
    }

    .tmdb-grid--3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .tmdb-grid--5,
    .tmdb-grid--4,
    .tmdb-grid--3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .tmdb-grid--2 {
        grid-template-columns: 1fr;
    }
}

/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
    .w3eden:not(.light-mode) .tmdb-cast__name,
    .w3eden:not(.light-mode) .tmdb-seasons__title,
    .w3eden:not(.light-mode) .tmdb-cast__title,
    .w3eden:not(.light-mode) .tmdb-section__title,
    .w3eden:not(.light-mode) .tmdb-grid__title,
    .w3eden:not(.light-mode) .tmdb-season__name,
    .w3eden:not(.light-mode) .tmdb-episode__name {
        color: #f1f5f9;
    }

    .w3eden:not(.light-mode) .tmdb-season__header {
        background: #1e293b;
    }

    .w3eden:not(.light-mode) .tmdb-season {
        border-color: rgba(255,255,255,0.1);
    }

    .w3eden:not(.light-mode) .tmdb-grid__card {
        background: #1e293b;
        border-color: rgba(255,255,255,0.1);
    }

    .w3eden:not(.light-mode) .tmdb-episode {
        border-color: rgba(255,255,255,0.1);
    }

    .w3eden:not(.light-mode) .tmdb-episode__number {
        background: #334155;
    }
}

.w3eden.dark-mode .tmdb-cast__name,
.w3eden.dark-mode .tmdb-seasons__title,
.w3eden.dark-mode .tmdb-cast__title,
.w3eden.dark-mode .tmdb-section__title,
.w3eden.dark-mode .tmdb-grid__title,
.w3eden.dark-mode .tmdb-season__name,
.w3eden.dark-mode .tmdb-episode__name {
    color: #f1f5f9;
}

.w3eden.dark-mode .tmdb-season__header {
    background: #1e293b;
}

.w3eden.dark-mode .tmdb-season {
    border-color: rgba(255,255,255,0.1);
}

.w3eden.dark-mode .tmdb-grid__card {
    background: #1e293b;
    border-color: rgba(255,255,255,0.1);
}

.w3eden.dark-mode .tmdb-episode {
    border-color: rgba(255,255,255,0.1);
}

.w3eden.dark-mode .tmdb-episode__number {
    background: #334155;
}

.w3eden.dark-mode .tmdb-star--empty,
.w3eden.dark-mode .tmdb-star--partial .tmdb-star__empty {
    fill: #334155;
}

@media (prefers-color-scheme: dark) {
    .w3eden:not(.light-mode) .tmdb-star--empty,
    .w3eden:not(.light-mode) .tmdb-star--partial .tmdb-star__empty {
        fill: #334155;
    }
}
