/* ====================================================
   TopCinma — Features CSS (Ratings, Player, Hero, Search, Person)
   ==================================================== */

/* ============================================
   1. نظام التقييم
   ============================================ */
.tc-rating-widget {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin: 25px 0;
    border-right: 4px solid var(--primary-color);
}
.tc-rating-header h3 {
    margin: 0 0 20px;
    font-size: 18px;
    color: var(--primary-color);
    display: flex; align-items: center; gap: 10px;
}
.tc-rating-body {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
    align-items: start;
}
@media (max-width: 768px) {
    .tc-rating-body { grid-template-columns: 1fr; }
}

.tc-rating-summary {
    text-align: center;
    padding: 20px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
}
.tc-avg-score {
    display: flex; align-items: baseline; justify-content: center; gap: 5px;
    margin-bottom: 10px;
}
.tc-avg-num {
    font-size: 56px;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}
.tc-avg-of { font-size: 20px; color: var(--text-muted); }

.tc-avg-stars {
    font-size: 20px;
    color: #444;
    margin-bottom: 8px;
    display: flex; justify-content: center; gap: 3px;
}
.tc-avg-stars .fas.filled { color: #f5c518; }
.tc-avg-stars .fas.half {
    color: #f5c518;
    background: linear-gradient(to left, #f5c518 50%, #444 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.tc-avg-count { color: var(--text-muted); font-size: 13px; }
.tc-avg-count strong { color: #fff; }

/* نجوم التقييم التفاعلية */
.tc-rating-action { padding: 20px; }
.tc-rate-label {
    color: var(--text-muted); font-size: 14px;
    margin-bottom: 15px; text-align: center;
}
.tc-stars-rate {
    display: flex; justify-content: center; gap: 10px;
    font-size: 36px;
}
.tc-stars-rate .tc-star-rate {
    color: #444;
    cursor: pointer;
    transition: 0.2s;
}
.tc-stars-rate .tc-star-rate:hover {
    transform: scale(1.2) rotate(5deg);
    color: #f5c518;
}
.tc-stars-rate.is-rating .tc-star-rate { pointer-events: none; opacity: 0.7; }
.tc-stars-rate .tc-star-rate.active,
.tc-stars-rate.is-hovering .tc-star-rate.fa-star.fas { color: #f5c518; }
.tc-stars-rate.is-hovering .tc-star-rate {
    transform: scale(1.1);
}

/* الرسم البياني */
.tc-rating-breakdown {
    grid-column: 1 / -1;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.tc-breakdown-row {
    display: grid;
    grid-template-columns: 60px 1fr 50px;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}
.tc-bd-label {
    color: #f5c518; font-size: 13px; font-weight: 600;
    display: flex; align-items: center; gap: 4px;
}
.tc-bd-bar {
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}
.tc-bd-fill {
    height: 100%;
    background: linear-gradient(90deg, #f5c518, var(--primary-color));
    border-radius: 4px;
    transition: width 0.6s ease;
}
.tc-bd-count { color: var(--text-muted); font-size: 12px; text-align: left; }

.tc-rating-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 600;
    display: none;
}
.tc-rating-message.show { display: block; }
.tc-rating-message.success { background: rgba(76, 175, 80, 0.15); color: #4caf50; }
.tc-rating-message.error { background: rgba(244, 67, 54, 0.15); color: #f44336; }

/* ============================================
   2. المشغل المتقدم Plyr
   ============================================ */
.tc-player-container {
    margin-top: 30px;
    position: relative;
}
.tc-player-wrap {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
    box-shadow: 0 15px 50px rgba(0,0,0,0.6);
    position: relative;
}
.tc-player-wrap iframe,
.tc-player-wrap video { width: 100%; height: 100%; border: 0; display: block; }

/* Plyr customizations */
.plyr {
    --plyr-color-main: var(--primary-color);
    --plyr-video-control-color-hover: #000;
    border-radius: 12px;
    overflow: hidden;
}
.plyr--video .plyr__controls { background: linear-gradient(transparent, rgba(0,0,0,0.85)); }

/* Skip Intro Button */
.tc-player-overlay-controls {
    position: absolute;
    bottom: 80px;
    left: 30px;
    z-index: 10;
}
.tc-skip-intro {
    background: rgba(0,0,0,0.85);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    font-family: "Cairo", sans-serif;
    display: flex; align-items: center; gap: 8px;
    transition: 0.25s;
    animation: tc-skip-pulse 2s infinite;
    backdrop-filter: blur(8px);
}
.tc-skip-intro:hover {
    background: var(--primary-color);
    color: #000;
    transform: scale(1.05);
}
@keyframes tc-skip-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,168,54,0.4); }
    50% { box-shadow: 0 0 0 12px rgba(255,168,54,0); }
}

/* Resume Notice */
.tc-resume-notice {
    position: absolute;
    top: 20px; right: 20px;
    background: rgba(0,0,0,0.92);
    color: #fff;
    padding: 14px 18px;
    border-radius: 10px;
    display: flex; align-items: center; gap: 12px;
    font-size: 14px;
    z-index: 20;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,168,54,0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: tc-slide-in 0.4s ease;
}
@keyframes tc-slide-in {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.tc-resume-notice i { color: var(--primary-color); font-size: 18px; }
.tc-resume-notice button {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: "Cairo", sans-serif;
    transition: 0.2s;
}
.tc-resume-notice .tc-resume-yes { background: var(--primary-color); color: #000; border-color: var(--primary-color); font-weight: 700; }
.tc-resume-notice button:hover { background: rgba(255,255,255,0.1); }
.tc-resume-notice .tc-resume-yes:hover { background: #fff; }

/* ============================================
   3. سلايدر هيرو احترافي
   ============================================ */
.tc-hero-slider-wrap {
    margin-top: 70px;
    margin-bottom: 40px;
}
.tc-hero-swiper {
    width: 100%;
    height: 600px;
    border-radius: 0;
    overflow: hidden;
    position: relative;
}
.tc-hero-slide {
    position: relative;
    overflow: hidden;
    color: #fff;
}
.tc-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 8s ease;
}
.swiper-slide-active .tc-hero-bg {
    transform: scale(1.1);
}
.tc-hero-video {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.tc-hero-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
    transform: scale(1.5);
    opacity: 0;
    transition: opacity 1s 1s;
}
.swiper-slide-active .tc-hero-video iframe.is-playing { opacity: 1; }

.tc-hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(14,17,22,0.92) 0%, rgba(14,17,22,0.6) 50%, rgba(14,17,22,0.3) 100%),
        linear-gradient(180deg, rgba(14,17,22,0.3) 0%, rgba(14,17,22,0.95) 100%);
    z-index: 2;
}

.tc-hero-content {
    position: relative;
    z-index: 3;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 280px;
    align-items: center;
    gap: 40px;
    padding-top: 60px;
    padding-bottom: 40px;
}
.tc-hero-info {
    animation: tc-hero-fade-in 0.8s ease;
}
@keyframes tc-hero-fade-in {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.tc-hero-type {
    display: inline-block;
    background: rgba(255,168,54,0.2);
    color: var(--primary-color);
    border: 1px solid rgba(255,168,54,0.3);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
}

.tc-hero-genres {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 15px;
}
.tc-hero-genre {
    background: rgba(255,255,255,0.1);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    backdrop-filter: blur(4px);
}

.tc-hero-title {
    font-size: 48px;
    font-weight: 900;
    margin: 0 0 15px;
    line-height: 1.2;
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
    max-width: 700px;
}

.tc-hero-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    font-size: 14px;
}
.tc-hero-meta span {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(6px);
    padding: 6px 12px;
    border-radius: 6px;
}
.tc-hero-rating {
    background: #f5c518 !important;
    color: #000 !important;
    font-weight: 700;
}
.tc-hero-quality {
    background: var(--primary-color) !important;
    color: #000 !important;
    font-weight: 700;
}

.tc-hero-desc {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 30px;
    max-width: 700px;
    color: rgba(255,255,255,0.9);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.tc-hero-buttons {
    display: flex; gap: 12px; flex-wrap: wrap;
}
.tc-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    transition: 0.3s;
    cursor: pointer;
    border: none;
    font-family: "Cairo", sans-serif;
}
.tc-hero-btn-play {
    background: var(--primary-color);
    color: #000;
    box-shadow: 0 8px 25px rgba(255,168,54,0.4);
}
.tc-hero-btn-play:hover {
    background: #fff; color: #000;
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(255,168,54,0.6);
}
.tc-hero-btn-trailer {
    background: rgba(229,9,20,0.85);
    color: #fff;
    backdrop-filter: blur(8px);
}
.tc-hero-btn-trailer:hover { background: #e50914; color: #fff; transform: translateY(-3px); }
.tc-hero-btn-info {
    background: rgba(255,255,255,0.1);
    color: #fff;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
}
.tc-hero-btn-info:hover { background: rgba(255,255,255,0.2); color: #fff; transform: translateY(-3px); }
.tc-hero-btn-fav {
    background: rgba(255,255,255,0.1);
    color: #fff;
    backdrop-filter: blur(8px);
    padding: 14px 16px;
    border: 1px solid rgba(255,255,255,0.15);
}
.tc-hero-btn-fav:hover {
    background: rgba(229,9,20,0.8); color: #fff; transform: translateY(-3px) scale(1.05);
}
.tc-hero-btn-fav.is-favorite { background: #e50914; color: #fff; border-color: #e50914; }
.tc-hero-btn-fav.is-favorite i::before { content: "\f004"; font-weight: 900; }

.tc-hero-poster {
    width: 280px;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    transform: translateY(0);
    transition: 0.6s 0.3s;
}
.swiper-slide-active .tc-hero-poster { transform: translateY(-10px); }
.tc-hero-poster img { width: 100%; height: 100%; object-fit: cover; }

/* Swiper navigation */
.tc-hero-pagination {
    position: absolute;
    bottom: 20px !important;
    z-index: 10;
}
.tc-hero-pagination .swiper-pagination-bullet {
    width: 30px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.4);
    opacity: 1;
    transition: 0.3s;
}
.tc-hero-pagination .swiper-pagination-bullet-active {
    background: var(--primary-color);
    width: 50px;
}
.tc-hero-prev, .tc-hero-next {
    color: #fff !important;
    background: rgba(0,0,0,0.4);
    width: 50px !important; height: 50px !important;
    border-radius: 50%;
    backdrop-filter: blur(8px);
    transition: 0.3s;
}
.tc-hero-prev:hover, .tc-hero-next:hover {
    background: var(--primary-color);
    color: #000 !important;
}
.tc-hero-prev::after, .tc-hero-next::after {
    font-size: 18px !important;
    font-weight: 900;
}

@media (max-width: 968px) {
    .tc-hero-swiper { height: 500px; }
    .tc-hero-content { grid-template-columns: 1fr; gap: 20px; }
    .tc-hero-poster { display: none; }
    .tc-hero-title { font-size: 32px; }
}
@media (max-width: 480px) {
    .tc-hero-swiper { height: 450px; }
    .tc-hero-title { font-size: 24px; }
    .tc-hero-desc { font-size: 13px; -webkit-line-clamp: 2; }
    .tc-hero-btn { padding: 10px 18px; font-size: 12px; }
    .tc-hero-btn span { display: none; }
    .tc-hero-btn i { font-size: 16px; }
    .tc-hero-btn-play span { display: inline; }
}

/* ============================================
   4. البحث المباشر AJAX
   ============================================ */
.popSearch { padding-top: 100px; }
.SearchPopForm {
    max-width: 800px !important;
    width: 100% !important;
}
.SearchPopForm input {
    background: rgba(255,255,255,0.08) !important;
    font-size: 18px !important;
    padding: 18px 60px 18px 25px !important;
    border-radius: 12px !important;
    text-align: right !important;
}
.SearchPopForm input:focus {
    background: rgba(255,255,255,0.12) !important;
    outline: 2px solid var(--primary-color) !important;
}

.tc-live-results {
    margin-top: 20px;
    max-height: 70vh;
    overflow-y: auto;
    background: rgba(0,0,0,0.5);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid rgba(255,255,255,0.05);
}
.tc-live-results:empty { display: none; }

.tc-live-loading,
.tc-live-no-results {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}
.tc-live-loading i {
    font-size: 30px;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: block;
}

.tc-live-result {
    display: flex;
    gap: 15px;
    padding: 12px;
    border-radius: 10px;
    transition: 0.25s;
    text-decoration: none;
    color: #fff !important;
    margin-bottom: 6px;
    border: 1px solid transparent;
}
.tc-live-result:hover {
    background: rgba(255,168,54,0.1);
    border-color: rgba(255,168,54,0.3);
    transform: translateX(-3px);
}

.tc-live-poster {
    flex: 0 0 60px;
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    background: #1a1f2e;
    position: relative;
}
.tc-live-poster img { width: 100%; height: 100%; object-fit: cover; }
.tc-live-type-badge {
    position: absolute;
    bottom: 4px; right: 4px;
    background: var(--type-color, var(--primary-color));
    color: #fff;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
}

.tc-live-info {
    flex: 1;
    text-align: right;
    min-width: 0;
}
.tc-live-info h4 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
}
.tc-live-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.tc-live-meta span {
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 4px;
}
.tc-live-meta .tc-live-rating {
    background: #f5c518; color: #000; font-weight: 700;
}
.tc-live-genres {
    font-size: 11px;
    color: var(--primary-color);
}

.tc-live-footer {
    text-align: center;
    padding: 12px;
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.tc-live-footer a {
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
}

/* ============================================
   5. صفحة الشخصية (Person)
   ============================================ */
.tc-person-hero {
    position: relative;
    padding: 100px 0 50px;
    background: linear-gradient(135deg, #1a1f3a, #2d3561, #0e1116);
}
.tc-person-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
}
@media (max-width: 768px) {
    .tc-person-grid { grid-template-columns: 1fr; text-align: center; }
}

.tc-person-photo {
    width: 280px;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
    background: #1a1f2e;
    margin: 0 auto;
}
.tc-person-photo img { width: 100%; height: 100%; object-fit: cover; }

.tc-person-info h1 {
    font-size: 36px;
    margin: 0 0 8px;
    font-weight: 900;
}
.tc-person-orig {
    color: var(--text-muted);
    font-size: 16px;
    margin-bottom: 20px;
    display: block;
}

.tc-person-profession {
    display: inline-block;
    background: var(--primary-color);
    color: #000;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 20px;
}

.tc-person-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
    background: rgba(255,255,255,0.03);
    padding: 20px;
    border-radius: 12px;
}
.tc-person-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tc-person-detail-item .label {
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tc-person-detail-item .value {
    color: #fff;
    font-size: 14px;
}

.tc-person-bio {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    line-height: 2;
    color: #ddd;
    border-right: 4px solid var(--primary-color);
}
.tc-person-bio h3 {
    margin: 0 0 15px;
    color: var(--primary-color);
    font-size: 18px;
}

.tc-person-links {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}
.tc-person-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    font-size: 13px;
    transition: 0.3s;
}
.tc-person-links a:hover {
    background: var(--primary-color); color: #000;
}
.tc-person-links a.imdb { background: #f5c518; color: #000; }
.tc-person-links a.tmdb { background: #01b4e4; color: #fff; }

/* ============================================
   🎭 طاقم العمل (Cast & Crew) - تصميم احترافي
   ============================================ */
.tc-cast-section {
    margin: 35px 0;
}
.tc-cast-section .TitleBox h2 small {
    margin-right: 8px;
}

.tc-cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px;
    margin-top: 15px;
}

.tc-cast-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    transition: 0.3s ease;
    border: 1px solid rgba(255,255,255,0.04);
}
.tc-cast-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 12px 30px rgba(0,0,0,0.4),
                0 0 20px rgba(255,168,54,0.15);
}
.tc-cast-card.tc-cast-hidden {
    display: none;
}

.tc-cast-photo-wrap {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: #0a0d12;
}
.tc-cast-photo-wrap.is-link {
    cursor: pointer;
}

.tc-cast-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease, filter 0.3s ease;
}
.tc-cast-card:hover .tc-cast-photo {
    transform: scale(1.08);
    filter: brightness(1.1);
}

.tc-cast-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(255,168,54,0.85) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
    color: #000;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.tc-cast-card:hover .tc-cast-overlay {
    opacity: 1;
}

.tc-cast-info {
    padding: 12px 10px;
    text-align: center;
}
.tc-cast-name {
    margin: 0 0 5px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 34px;
}
.tc-cast-role {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* رابط الـ a يكون block */
a.tc-cast-photo-wrap {
    text-decoration: none;
}

/* للجوال */
@media (max-width: 768px) {
    .tc-cast-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 12px;
    }
    .tc-cast-name { font-size: 12px; min-height: 30px; }
    .tc-cast-role { font-size: 10px; }
    .tc-cast-info { padding: 10px 6px; }
}
@media (max-width: 480px) {
    .tc-cast-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}
