/* TRENDING YOUTUBE - CORE STYLESHEET v25.0 
    إصلاح شامل لمشاكل التفاعل، دعم السيمات، وتنسيق الواجهة العصري
*/

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&family=Inter:wght@400;700;800;900&display=swap');

:root { 
    --bg: #000; 
    --text: #fff; 
    --accent: #ff0000; 
    --card: #0a0a0a; 
    --border: #151515; 
    --search-bg: #111;
    --gray-text: #666;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* الوضع الفاتح */
[data-theme="light"] {
    --bg: #fdfdfd;
    --text: #111;
    --card: #ffffff;
    --border: #eeeeee;
    --search-bg: #f5f5f5;
    --gray-text: #888;
}

/* التنسيقات العامة */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }
body, html { 
    background: var(--bg); 
    color: var(--text); 
    font-family: 'Cairo', sans-serif; 
    overflow-x: hidden; 
    width: 100%; 
    transition: background 0.3s, color 0.3s;
}

.container { padding: 0 15px; max-width: 850px; margin: 0 auto; width: 100%; }

/* الهيدر واللوجو */
header { 
    background: var(--bg); 
    padding: 15px 0; 
    border-bottom: 1px solid var(--border); 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    width: 100%; 
}

.logo { 
    font-weight: 900; 
    font-size: 1.3rem; 
    cursor: pointer; 
    text-transform: uppercase; 
    font-family: 'Inter', sans-serif; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
    letter-spacing: -0.5px;
}

.logo span { 
    background: var(--accent); 
    color: #fff; 
    padding: 2px 10px; 
    border-radius: 8px; 
    font-style: italic; 
    font-weight: 900; 
}

/* نظام الأزرار (Pills) */
.pill { 
    background: var(--card); 
    color: var(--text); 
    padding: 10px 20px; 
    border-radius: 14px; 
    font-size: 0.85rem; 
    font-weight: 800; 
    text-decoration: none; 
    border: 1px solid var(--border); 
    white-space: nowrap; 
    transition: var(--transition); 
    display: inline-flex; 
    align-items: center; 
    gap: 8px;
}

.pill:hover { border-color: var(--gray-text); transform: translateY(-2px); }
.pill.active { 
    background: var(--text); 
    color: var(--bg); 
    border-color: var(--text); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* البحث */
.header-search { position: relative; margin-bottom: 20px; width: 100%; }
.h-search-input { 
    width: 100%; 
    background: var(--search-bg); 
    border: 1px solid var(--border); 
    border-radius: 16px; 
    padding: 14px 45px; 
    color: var(--text); 
    font-size: 0.95rem; 
    font-weight: 700; 
    transition: var(--transition); 
}

.h-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255,0,0,0.1); }
.h-search-icon { position: absolute; top: 50%; transform: translateY(-50%); opacity: 0.4; color: var(--text); }
html[dir="rtl"] .h-search-icon { right: 15px; }
html[dir="ltr"] .h-search-icon { left: 15px; }

/* كروت الفيديوهات */
.v-card { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    padding: 12px; 
    background: var(--card); 
    border: 1px solid var(--border); 
    border-radius: 20px; 
    margin-bottom: 12px; 
    cursor: pointer; 
    transition: var(--transition); 
    text-decoration: none;
}

.v-card:hover { border-color: var(--gray-text); background: var(--search-bg); }
.v-card:active { transform: scale(0.98); }

.v-rank { 
    min-width: 40px; 
    text-align: center; 
    font-size: 1.5rem; 
    font-weight: 900; 
    color: var(--gray-text); 
    font-family: 'Inter', sans-serif; 
    font-style: italic; 
    opacity: 0.5;
}

.v-thumb { 
    width: 140px; 
    height: 78px; 
    border-radius: 14px; 
    object-fit: cover; 
    background: #111; 
}

.v-info-box { flex: 1; min-width: 0; overflow: hidden; }
.v-title { 
    font-weight: 800; 
    font-size: 1rem; 
    color: var(--text); 
    margin-bottom: 6px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.v-meta-row { display: flex; align-items: center; gap: 8px; font-weight: 700; flex-wrap: nowrap; overflow: hidden; }
.tag-red { color: var(--accent); font-size: 0.85rem; font-weight: 900; white-space: nowrap; }
.v-views { color: var(--gray-text); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* العناوين الجانبية */
.head-title { 
    font-size: 1.2rem; 
    font-weight: 900; 
    margin-bottom: 25px; 
    border-inline-start: 5px solid var(--accent); 
    padding: 0 15px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

/* ==============================================
   إصلاح المشغل (Slide-up Player Fix)
=============================================== */
#full-player { 
    position: fixed; 
    top: 100%; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: var(--bg); 
    z-index: 9999; 
    transition: top 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column;
    /* حل مشكلة اعتراض النقرات عندما يكون مغلقاً */
    pointer-events: none; 
    visibility: hidden;
}

#full-player.active { 
    top: 0; 
    pointer-events: auto; 
    visibility: visible;
}

.video-box { 
    width: 100%; 
    aspect-ratio: 16/9; 
    background: #000; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
}

.p-content { padding: 25px; flex: 1; }

.btn-action { 
    padding: 14px; 
    border-radius: 15px; 
    border: 1px solid var(--border); 
    background: var(--card); 
    color: var(--text); 
    font-weight: 900; 
    font-size: 0.9rem; 
    cursor: pointer; 
    transition: 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px; 
}

/* ==============================================
   قالب البوستر (Poster Wrap)
=============================================== */
#poster-wrap { 
    position: fixed; 
    left: -9999px; 
    width: 1080px; 
    height: 1350px; 
    background: #000; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 60px; 
    box-sizing: border-box; 
}

.post-header-logo { font-size: 50px; font-weight: 900; color: #fff; margin-bottom: 50px; font-family: 'Inter', sans-serif; font-style: italic; }
.post-header-logo span { background: #ff0000; padding: 5px 20px; border-radius: 15px; }
.post-rank-box { color: #ff0000; font-size: 60px; font-weight: 900; margin-bottom: 50px; font-style: italic; }
.post-title-text { color: #fff; font-size: 58px; font-weight: 800; text-align: center; margin-bottom: 70px; line-height: 1.3; }
.post-main-img { width: 940px; height: 528px; border-radius: 40px; border: 10px solid #fff; object-fit: cover; }
.post-footer-url { margin-top: auto; color: #444; font-size: 35px; font-weight: 900; letter-spacing: 6px; font-family: 'Inter', sans-serif; }

/* Utilities */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

@media (max-width: 600px) {
    .v-thumb { width: 120px; height: 68px; }
    .v-title { font-size: 0.9rem; }
    .logo { font-size: 1.1rem; }
}