/* ===========================================================
   صفحه تک‌فیلم — تجربه سینمایی
   بر پایه توکن‌های cinema-theme.css
   =========================================================== */

.ctp-movie-page {
    --ctp-movie-accent: var(--ctp-accent); /* توسط JS از رنگ پوستر بازنویسی می‌شود */
    background: var(--ctp-bg);
    padding-bottom: 96px;
    position: relative;
    overflow-x: clip;
}

/* ---------- بک‌دراپ تمام‌عرض ---------- */
.ctp-movie-backdrop {
    position: relative;
    width: 100vw;
    margin-inline-start: calc(50% - 50vw);
    height: 480px;
    background-size: cover;
    background-position: center 20%;
    filter: blur(1.5px) saturate(1.1);
    animation: ctp-backdrop-in 1.2s ease both;
}

@keyframes ctp-backdrop-in {
    from { opacity: 0; transform: scale(1.06); }
    to   { opacity: 1; transform: scale(1); }
}

.ctp-movie-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(10, 12, 16, 0.30) 0%, rgba(10, 12, 16, 0.78) 62%, var(--ctp-bg) 100%),
        linear-gradient(90deg, rgba(10, 12, 16, 0.88) 0%, rgba(10, 12, 16, 0.05) 60%);
}

/* هاله رنگی گرفته‌شده از پوستر — هویت رنگی مخصوص هر فیلم */
.ctp-movie-glow {
    position: absolute;
    top: 40px;
    inset-inline-start: max(2vw, calc(50% - 560px));
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--ctp-movie-accent) 0%, transparent 70%);
    opacity: 0;
    filter: blur(40px);
    pointer-events: none;
    z-index: 1;
    transition: opacity 1s ease;
}

.ctp-movie-glow.is-visible { opacity: 0.22; }

.ctp-movie-page.no-backdrop { padding-top: 56px; }

/* ---------- بخش قهرمان ---------- */
.ctp-movie-hero {
    display: flex;
    gap: 44px;
    margin-top: -360px;
    position: relative;
    z-index: 2;
    align-items: flex-start;
    animation: ctp-hero-in 0.7s ease both;
}

@keyframes ctp-hero-in {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ctp-movie-page.no-backdrop .ctp-movie-hero {
    margin-top: 0;
    align-items: flex-start;
}

/* ---------- کارت پوستر ---------- */
.ctp-movie-poster-card {
    position: sticky;
    top: 25%;
    flex: 0 0 264px;
    width: 264px;
    aspect-ratio: 2 / 3;
    border-radius: var(--ctp-radius-md);
    overflow: hidden;
    box-shadow: var(--ctp-shadow);
    border: 1px solid var(--ctp-border-strong);
    background: var(--ctp-surface-alt);
}

.ctp-movie-poster-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ctp-movie-poster-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ctp-text-faint);
    font-size: 13px;
}

/* دکمه پخش روی پوستر */
.ctp-poster-play {
    position: absolute;
    inset: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(10, 12, 16, 0.15);
    border: none !important;
    cursor: pointer !important;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease !important;
}

.ctp-movie-poster-card:hover .ctp-poster-play { opacity: 1; background: rgba(10, 12, 16, 0.35); }

.ctp-poster-play-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #0a0c10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding-inline-start: 0px;
    padding-block-start: 4px;
    padding-inline-end: 2px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease;
}

.ctp-poster-play:hover .ctp-poster-play-icon { transform: scale(1.08); }

/* ---------- ستون اطلاعات ---------- */
.ctp-movie-info {
    flex: 1;
    min-width: 0;
    padding-bottom: 8px;
}

.ctp-movie-title {
    margin: 0 0 4px;
    font-size: 38px;
    font-weight: 800;
    color: var(--ctp-text);
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.ctp-movie-orig-title {
    margin: 0 0 16px;
    color: var(--ctp-text-faint);
    font-size: 15px;
    font-weight: 500;
}

/* ردیف متادیتا (امتیاز، سال، مدت، رده سنی) — یک خط تمیز با جداکننده نقطه‌ای */
.ctp-movie-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 0;
    margin-bottom: 18px;
    color: var(--ctp-text-dim);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
}

.ctp-movie-meta-row > * {
    display: inline-flex;
    align-items: center;
}

/* نقطه جداکننده بین آیتم‌ها */
.ctp-movie-meta-row > * + *::before {
    content: "";
    flex: 0 0 auto;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    margin-inline: 13px;
}

.ctp-meta-item { gap: 5px; }

/* امتیاز به شکل پیل طلایی متمایز */
.ctp-rating {
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--ctp-accent-soft);
    border: 1px solid rgba(240, 180, 41, 0.30);
    color: var(--ctp-accent);
    line-height: 1;
}

.ctp-rating-star { font-size: 12px; }
.ctp-rating-value { font-size: 14px; font-weight: 800; }
.ctp-rating-max { opacity: 0.65; font-size: 11px; font-weight: 600; }

.ctp-age-rating {
    padding: 3px 9px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ctp-text);
    line-height: 1;
}

/* چیپ‌های ژانر */
.ctp-genre-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.ctp-genre-chip {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--ctp-surface-alt);
    border: 1px solid var(--ctp-border);
    color: var(--ctp-text-dim);
    font-size: 12.5px;
    font-weight: 600;
}

/* خلاصه داستان با قابلیت بازشدن نرم */
.ctp-movie-synopsis {
    position: relative;
    color: var(--ctp-text-dim);
    line-height: 2;
    font-size: 15px;
    max-width: 720px;
    margin-bottom: 8px;
}

.ctp-movie-synopsis p:first-child { margin-top: 0; }
.ctp-movie-synopsis p:last-child { margin-bottom: 0; }

/* ارتفاع توسط JS انیمیت می‌شود؛ این‌ها فقط حالت اولیه‌اند */
.ctp-movie-synopsis.is-collapsible {
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* محو‌شدگی نرم لبه پایین وقتی جمع است */
.ctp-movie-synopsis.is-collapsible::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 56px;
    background: linear-gradient(to top, var(--ctp-bg) 8%, transparent);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.35s ease;
}

.ctp-movie-synopsis.is-expanded::after { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    .ctp-movie-synopsis.is-collapsible { transition: none; }
}

.ctp-synopsis-toggle {
    background: none !important;
    border: none !important;
    color: var(--ctp-accent) !important;
    font-family: var(--ctp-font) !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    padding: 0px !important;
    margin-bottom: 63px;
}

.ctp-synopsis-toggle:hover {
    text-decoration: underline;
    color: var(--ctp-accent-dark);
}

/* عوامل */
.ctp-crew {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 26px;
}

.ctp-crew-row { display: flex; gap: 10px; font-size: 14px; line-height: 1.7; }

.ctp-crew-label {
    flex: 0 0 76px;
    color: var(--ctp-text-faint);
    font-weight: 600;
}

.ctp-crew-value {
    color: var(--ctp-text); 
    text-align: right;
}

/* اکشن‌ها */
.ctp-movie-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

/* ---------- بخش جزئیات پایین ---------- */
.ctp-movie-details {
    margin-top: 52px;
    display: grid;
    gap: 20px;
}

/* کارت خرید/سانس */
.ctp-booking-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 26px;
}

.ctp-booking-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 40px;
}

.ctp-booking-cell { display: flex; flex-direction: column; gap: 4px; }

.ctp-booking-cell-label {
    color: var(--ctp-text-faint);
    font-size: 12.5px;
    font-weight: 600;
}

.ctp-booking-cell-value {
    color: var(--ctp-text);
    font-size: 16px;
    font-weight: 700;
}

.ctp-price { color: var(--ctp-accent); }
.ctp-price small { font-size: 12px; font-weight: 600; color: var(--ctp-text-dim); }

/* جدول مشخصات */
.ctp-facts { padding: 24px 26px; }

.ctp-facts-title {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 700;
    color: var(--ctp-text);
}

.ctp-facts-list {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px 40px;
}

.ctp-facts-item {
    display: flex;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--ctp-border);
    font-size: 14px;
}

.ctp-facts-item dt {
    flex: 0 0 96px;
    color: var(--ctp-text-faint);
    font-weight: 600;
}

.ctp-facts-item dd { margin: 0; color: var(--ctp-text); line-height: 1.7; }

/* ---------- نوار چسبان موبایل ---------- */
.ctp-sticky-bar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 60;
    background: rgba(18, 21, 27, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--ctp-border-strong);
    transform: translateY(110%);
    transition: transform 0.28s ease;
}

.ctp-sticky-bar.is-visible { transform: translateY(0); }

.ctp-sticky-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 12px;
    padding-bottom: 12px;
}

.ctp-sticky-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.ctp-sticky-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ctp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctp-sticky-price { font-size: 12.5px; color: var(--ctp-accent); font-weight: 600; }
.ctp-sticky-bar .ctp-cta-btn { flex: 0 0 auto; padding: 11px 22px; }

/* ---------- مودال تریلر ---------- */
.ctp-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ctp-modal[hidden] { display: none; }

.ctp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 6, 9, 0.82);
    backdrop-filter: blur(6px);
    animation: ctp-fade-in 0.2s ease;
}

@keyframes ctp-fade-in { from { opacity: 0; } to { opacity: 1; } }

.ctp-modal-body {
    position: relative;
    width: min(960px, 100%);
    z-index: 1;
    animation: ctp-hero-in 0.28s ease both;
}

.ctp-modal-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--ctp-radius-md);
    overflow: hidden;
    box-shadow: var(--ctp-shadow);
}

.ctp-modal-frame iframe,
.ctp-modal-frame video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.ctp-modal-close {
    position: absolute;
    top: -14px;
    inset-inline-end: -6px;
    width: 40px !important;
    height: 40px;
    border-radius: 50% !important;
    background: var(--ctp-surface);
    border: 1px solid var(--ctp-border-strong) !important;
    color: var(--ctp-text) !important;
    font-size: 16px !important;
    cursor: pointer !important;
    z-index: 2;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.ctp-modal-close:hover { background: var(--ctp-surface-alt) !important; }

/* ---------- واکنش‌گرا ---------- */
@media (max-width: 860px) {
    .ctp-movie-backdrop { height: 340px; }

    .ctp-movie-poster-card {
        position: relative;
    }
    .ctp-movie-hero {
        flex-direction: column;
        margin-top: -260px;
        align-items: center;
        text-align: center;
    }

    .ctp-movie-poster-card { flex: 0 0 auto; width: 200px; }

    .ctp-movie-meta-row,
    .ctp-genre-chips,
    .ctp-movie-actions { justify-content: center; }

    .ctp-movie-title { font-size: 28px; }
    .ctp-movie-synopsis { text-align: start; }

    .ctp-crew { align-items: start; }
    .ctp-crew-row { justify-content: center; }

    .ctp-facts-list { grid-template-columns: 1fr; }

    .ctp-booking-card { flex-direction: column; align-items: stretch; text-align: start; }
    .ctp-booking-card .ctp-cta-btn { width: 100%; }

    .ctp-booking-cell.ctp-booking-cell-price {order: 1;}
}

@media (min-width: 861px) {
    .ctp-sticky-bar { display: none; } /* روی دسکتاپ CTA همیشه در دید است */
}

@media (prefers-reduced-motion: reduce) {
    .ctp-movie-backdrop,
    .ctp-movie-hero,
    .ctp-modal-backdrop,
    .ctp-modal-body { animation: none; }
    .ctp-movie-glow,
    .ctp-sticky-bar { transition: none; }
}
