/*
Theme Name: Aflamicose Cinema Arabic V4
Theme URI: https://aflamicose.com
Author: Aflamicose Studio
Version: 4.0.0
Description: قالب أفلاميكوز العربي المتكامل - النسخة الرابعة، بتصميم TMDb الأصلي، دعم كامل لـ RTL، خط Cairo، وأزرار المشاركة الذكية وسيرفرات المشاهدة وبوابة التحميل المباشر.
*/

:root {
    --bg-main: #07090e;
    --bg-surface: #0e121b;
    --bg-card: #131926;
    --bg-elevated: #1a2234;
    --accent: #e50914;
    --accent-glow: rgba(229, 9, 20, 0.4);
    --gold: #f5c518;
    --cyan: #00d2ff;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #1e293b;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --font-arabic: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg-main); color: var(--text-primary); font-family: var(--font-arabic); line-height: 1.7; direction: rtl; text-align: right; overflow-x: hidden; }
a { color: inherit; text-decoration: none; transition: all 0.2s ease; }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1440px; margin: 0 auto; padding: 0 24px; }

/* Header RTL */
.site-header { background: rgba(7, 9, 14, 0.96); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; z-index: 1000; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 80px; gap: 20px; }
.site-logo a { font-size: 26px; font-weight: 900; color: #fff; letter-spacing: -0.5px; }
.site-logo a span { color: var(--accent); }
.main-nav ul { display: flex; list-style: none; gap: 20px; align-items: center; }
.main-nav a { font-size: 14.5px; font-weight: 700; color: #cbd5e1; }
.main-nav a:hover { color: var(--accent); }
.main-nav a.badge-adult { color: #ff4d4d; border: 1px solid rgba(255,77,77,0.4); padding: 3px 12px; border-radius: 20px; font-size: 12.5px; }

.search-bar-wrap { position: relative; flex: 1; max-width: 420px; }
.search-bar-wrap input { width: 100%; background: var(--bg-surface); border: 1px solid var(--border-color); padding: 11px 45px 11px 18px; border-radius: 30px; color: #fff; font-family: var(--font-arabic); font-size: 13.5px; outline: none; transition: border-color 0.2s; }
.search-bar-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-bar-wrap button { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 15px; }

/* Hero Billboard (Index Page) */
.hero-slider-box { position: relative; min-height: 500px; background-size: cover; background-position: center top; border-radius: var(--radius-lg); margin: 30px 0 40px; overflow: hidden; border: 1px solid var(--border-subtle); display: flex; align-items: flex-end; }
.hero-billboard-overlay { position: absolute; inset: 0; background: linear-gradient(0deg, #07090e 10%, rgba(7,9,14,0.7) 60%, rgba(7,9,14,0.2) 100%), linear-gradient(270deg, #07090e 25%, transparent 80%); }
.hero-content-inner { position: relative; z-index: 2; padding: 45px; max-width: 750px; }
.hero-tag { background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 4px; display: inline-block; margin-bottom: 12px; }
.hero-heading { font-size: 38px; font-weight: 900; line-height: 1.25; margin-bottom: 12px; }
.hero-meta-row { display: flex; gap: 14px; align-items: center; color: var(--text-secondary); font-size: 14px; font-weight: 700; margin-bottom: 16px; }
.meta-chip { background: rgba(255, 255, 255, 0.1); padding: 3px 10px; border-radius: 4px; color: #fff; font-size: 12px; }
.hero-synopsis { color: #cbd5e1; font-size: 14.5px; line-height: 1.8; margin-bottom: 22px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.btn-hero-play { background: var(--accent); color: #fff; padding: 12px 30px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 800; display: inline-flex; align-items: center; gap: 10px; box-shadow: 0 6px 20px var(--accent-glow); }
.btn-hero-play:hover { background: #b80710; transform: translateY(-2px); }

/* Quick Category Cards */
.categories-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 45px; }
.category-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 20px; display: flex; align-items: center; gap: 16px; transition: all 0.25s ease; }
.category-card:hover { border-color: var(--accent); transform: translateY(-4px); background: var(--bg-elevated); }
.category-card-icon { width: 48px; height: 48px; background: rgba(229, 9, 20, 0.1); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--accent); }
.category-card-info h4 { font-size: 15px; font-weight: 800; color: #fff; margin-bottom: 2px; }
.category-card-info p { font-size: 12px; color: var(--text-secondary); }

/* Movies Grid */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; border-right: 4px solid var(--accent); padding-right: 14px; }
.section-header h2 { font-size: 22px; font-weight: 900; }
.movie-grid-layout { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; margin-bottom: 50px; }
.movie-item-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; }
.movie-item-card:hover { transform: translateY(-6px); border-color: rgba(229, 9, 20, 0.5); box-shadow: 0 12px 30px rgba(0,0,0,0.5); }
.card-thumb-wrap { position: relative; aspect-ratio: 2/3; overflow: hidden; background: #0e121b; }
.card-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.movie-item-card:hover .card-thumb-wrap img { transform: scale(1.05); }
.card-badge-quality { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.85); font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 4px; color: #fff; border: 1px solid rgba(255,255,255,0.15); }
.card-badge-rating { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.85); font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 4px; color: var(--gold); display: flex; align-items: center; gap: 4px; }
.card-info-wrap { padding: 12px 14px; }
.card-title-text { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; color: #fff; }
.card-meta-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); font-weight: 600; }

/* TMDb Single Movie Page RTL */
.tmdb-fixed-scope { direction: rtl !important; text-align: right !important; width: 100%; }
.tmdb-hero-wrapper { position: relative; background-size: cover; background-position: center top; width: 100%; min-height: 480px; display: flex; align-items: center; }
.tmdb-hero-custom-overlay { background: linear-gradient(to left, rgba(14, 18, 27, 1) calc((50vw - 170px) - 340px), rgba(14, 18, 27, 0.88) 50%, rgba(14, 18, 27, 0.88) 100%); width: 100%; padding: 40px 0; }
.tmdb-hero-flex-grid { display: grid; grid-template-columns: 280px 1fr; gap: 40px; align-items: center; }
.tmdb-poster-box { width: 280px; height: 420px; border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.8); border: 1px solid rgba(255,255,255,0.1); background: #0e121b; }
.tmdb-poster-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tmdb-details-content { max-width: 100%; overflow: hidden; }
.tmdb-title { font-size: 32px; font-weight: 900; color: #fff; margin-bottom: 6px; line-height: 1.3; }
.tmdb-year { font-weight: 400; color: #94a3b8; }
.tmdb-submeta-line { font-size: 13.5px; color: #cbd5e1; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.tmdb-pg-badge { border: 1px solid rgba(255,255,255,0.4); padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: 700; }

.tmdb-actions-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.tmdb-circle-score-wrap { display: flex; align-items: center; gap: 10px; }
.tmdb-circle-score { width: 52px; height: 52px; background: #081c22; border: 3px solid #21d07a; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 900; color: #fff; }
.tmdb-circle-score sup { font-size: 8px; }
.score-label { font-size: 12px; font-weight: 700; line-height: 1.3; color: #fff; }
.tmdb-vibe-pill { background: #032541; padding: 7px 16px; border-radius: 20px; font-size: 13px; color: #fff; display: flex; align-items: center; gap: 8px; }
.tmdb-icon-btn-group { display: flex; align-items: center; gap: 10px; }
.tmdb-btn-circle { width: 40px; height: 40px; border-radius: 50%; background: #032541; border: none; color: #fff; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.tmdb-btn-trailer { background: transparent; border: none; color: #fff; font-family: var(--font-arabic); font-weight: 800; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; }

.tmdb-tagline { color: #94a3b8; font-size: 13.5px; margin-bottom: 12px; }
.tmdb-overview-block h3 { font-size: 17px; color: #fff; margin-bottom: 6px; font-weight: 800; }
.tmdb-overview-block p { font-size: 14px; line-height: 1.7; color: #cbd5e1; }

/* Awards Bar */
.tmdb-awards-bar { background: #0d253f; padding: 12px 0; width: 100%; border-bottom: 1px solid rgba(255,255,255,0.06); }
.awards-inner { display: flex; align-items: center; gap: 15px; }
.award-title { font-weight: 900; color: #01b4e4; font-size: 13.5px; }
.award-desc { font-size: 13px; color: #cbd5e1; font-weight: 600; }

/* Two-Column Grid */
.tmdb-main-layout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px !important; gap: 35px; width: 100%; }
.tmdb-content-col { min-width: 0; width: 100%; }
.tmdb-sidebar-col { width: 280px; min-width: 280px; }
.tmdb-section-heading { font-size: 18px; font-weight: 900; margin-bottom: 14px; color: #fff; }

/* Article Content Box */
.article-content-box { background: #131926; border: 1px solid #1e293b; border-radius: 12px; padding: 26px; margin-bottom: 30px; }
.movie-full-article { color: #cbd5e1; font-size: 14.5px; line-height: 1.8; }
.movie-full-article h2, .movie-full-article h3, .movie-full-article h4 { color: #ffffff; margin: 20px 0 10px; font-weight: 800; }
.movie-full-article p { margin-bottom: 15px; }
.movie-full-article ul { margin-right: 20px; margin-bottom: 16px; }
.movie-full-article li { margin-bottom: 6px; }
.movie-full-article strong { color: #ffffff; }

/* Cast Cards */
.tmdb-cast-cards-track { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.tmdb-cast-card { min-width: 130px; max-width: 130px; background: #131926; border: 1px solid #1e293b; border-radius: 8px; overflow: hidden; }
.cast-card-img img { width: 100%; height: 160px; object-fit: cover; background: #1e293b; }
.cast-card-meta { padding: 8px; }
.cast-card-meta h4 { font-size: 12.5px; font-weight: 800; color: #fff; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cast-card-meta p { font-size: 11px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Media Tabs RTL */
.tmdb-media-wrapper-box { background: #131926; border: 1px solid #1e293b; border-radius: 10px; padding: 20px; }
.tmdb-media-header-tabs { display: flex; align-items: center; gap: 25px; margin-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 10px; }
.tmdb-media-main-title { font-size: 18px; font-weight: 900; color: #fff; }
.tmdb-media-tab-nav { display: flex; gap: 16px; }
.media-nav-btn { background: none; border: none; color: #94a3b8; font-family: var(--font-arabic); font-size: 14px; font-weight: 700; cursor: pointer; position: relative; padding-bottom: 4px; }
.media-nav-btn.active { color: #fff; }
.media-nav-btn.active::after { content: ''; position: absolute; bottom: -11px; right: 0; width: 100%; height: 3px; background: #01b4e4; }
.media-tab-panel { display: none; }
.media-tab-panel.active { display: block; }
.media-popular-player-frame { position: relative; padding-bottom: 56.25%; height: 0; border-radius: 8px; overflow: hidden; background: #000; }
.media-popular-player-frame iframe { position: absolute; top: 0; right: 0; width: 100%; height: 100%; border: none; }
.media-horizontal-scroll-track { display: flex; gap: 12px; overflow-x: auto; padding: 6px 0; }
.media-backdrop-item { min-width: 260px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; }
.media-backdrop-item img, .media-poster-item img { width: 100%; height: 100%; object-fit: cover; }
.media-poster-item { min-width: 130px; aspect-ratio: 2/3; border-radius: 6px; overflow: hidden; }

/* Stream Player & Downloads */
.tmdb-server-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tmdb-srv-btn { background: #131926; color: #fff; border: 1px solid #1e293b; padding: 9px 18px; border-radius: 6px; font-family: var(--font-arabic); font-weight: 800; font-size: 13px; cursor: pointer; }
.tmdb-srv-btn.active { background: #e50914; border-color: #e50914; box-shadow: 0 4px 14px var(--accent-glow); }
.tmdb-player-screen { position: relative; padding-bottom: 56.25%; height: 0; border-radius: 8px; overflow: hidden; background: #000; }
.tmdb-player-screen iframe { position: absolute; top: 0; right: 0; width: 100%; height: 100%; border: none; }
.tmdb-downloads-flex { display: flex; gap: 12px; flex-wrap: wrap; }
.tmdb-dl-btn { background: #131926; border: 1px solid #1e293b; padding: 12px 24px; border-radius: 6px; color: #fff; font-family: var(--font-arabic); font-weight: 800; font-size: 13.5px; }
.tmdb-dl-btn:hover { background: #e50914; border-color: #e50914; transform: translateY(-2px); }

/* Similar Movies */
.tmdb-recommendations-scroll { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.tmdb-rec-card { min-width: 240px; max-width: 240px; background: #131926; border: 1px solid #1e293b; border-radius: 8px; overflow: hidden; }
.rec-thumb-wrap { position: relative; aspect-ratio: 16/9; background: #0b0e14; }
.rec-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.rec-score { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.85); color: #f5c518; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 4px; }
.rec-meta-wrap { padding: 10px; }
.rec-title { font-size: 13px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Extended Keywords */
.tmdb-extended-keywords-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.ext-kw-pill { background: #131926; border: 1px solid #1e293b; color: #cbd5e1; font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 20px; }
.ext-kw-pill:hover { background: #e50914; border-color: #e50914; color: #fff; }

/* Sidebar RTL */
.tmdb-sidebar-share-wrapper { margin-bottom: 24px; position: relative; }
.tmdb-sidebar-share-wrapper h4 { font-size: 13.5px; font-weight: 800; color: #fff; margin-bottom: 10px; }
.tmdb-sidebar-social-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-btn { width: 38px; height: 38px; border-radius: 8px; background: #131926; border: 1px solid #1e293b; color: #cbd5e1; display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; transition: all 0.2s ease; }
.share-btn:hover { transform: translateY(-2px); color: #ffffff; }
.share-btn.fb:hover { background: #1877f2; border-color: #1877f2; }
.share-btn.tw:hover { background: #000000; border-color: #334155; }
.share-btn.wa:hover { background: #25d366; border-color: #25d366; }
.share-btn.tg:hover { background: #229ed9; border-color: #229ed9; }
.share-btn.copy:hover { background: #e50914; border-color: #e50914; }

.copy-alert { display: none; position: absolute; top: -24px; left: 0; background: #00c853; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 4px; }
.copy-alert.show { display: block; }

.tmdb-meta-data-group { margin-bottom: 16px; }
.tmdb-meta-data-group h4 { font-size: 13.5px; font-weight: 800; color: #fff; margin-bottom: 2px; }
.tmdb-meta-data-group p { font-size: 13px; color: #94a3b8; }
.tmdb-keywords-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kw-tag { background: rgba(255,255,255,0.08); padding: 3px 8px; border-radius: 4px; font-size: 11.5px; color: #cbd5e1; }
.kw-tag:hover { background: #e50914; color: #fff; }
.tmdb-content-score-box { background: #131926; border: 1px solid #1e293b; padding: 14px; border-radius: 8px; margin-top: 20px; }
.tmdb-content-score-box h4 { font-size: 13px; margin-bottom: 6px; font-weight: 800; }
.score-bar-wrap { height: 6px; background: #081c22; border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.score-bar-fill { height: 100%; background: #21d07a; }
.tmdb-content-score-box span { font-size: 11px; color: #21d07a; font-weight: 700; }

/* Responsive Rules */
@media (max-width: 992px) {
    .tmdb-hero-flex-grid { grid-template-columns: 1fr; }
    .tmdb-poster-box { margin: 0 auto; }
    .tmdb-main-layout-grid { grid-template-columns: 1fr !important; }
    .tmdb-sidebar-col { width: 100%; min-width: 100%; }
    .categories-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .main-nav { display: none; }
    .categories-grid { grid-template-columns: 1fr; }
    .movie-grid-layout { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
.aflam-community-box {
    background: linear-gradient(135deg, #161b22, #0d1117);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 4px solid #e50914;
    border-radius: 12px;
    padding: 20px 24px;
    margin: 25px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.community-info h4 {
    color: #fff;
    margin: 5px 0;
    font-size: 17px;
    font-weight: 700;
}

.community-info p {
    color: #94a3b8;
    margin: 0;
    font-size: 13px;
}

.community-badge {
    background: rgba(229, 9, 20, 0.15);
    color: #e50914;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}

.community-buttons {
    display: flex;
    gap: 12px;
}

.btn-join {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    color: #fff;
}

.tg-btn {
    background: #229ED9;
}
.tg-btn:hover {
    background: #1c88bd;
    transform: translateY(-2px);
}

.x-btn {
    background: #000;
    border: 1px solid rgba(255,255,255,0.2);
}
.x-btn:hover {
    background: #111;
    border-color: #fff;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .aflam-community-box {
        flex-direction: column;
        align-items: flex-start;
    }
    .community-buttons {
        width: 100%;
    }
    .btn-join {
        flex: 1;
        justify-content: center;
    }
}