﻿:root {
    --gold: #FEC800;
    --grey-light: #333;
    --videos-primary-color: #FEC800;
    --videos-primary-dark: #E6B300;
    --videos-primary-light: #FFD700;
    --videos-secondary-color: #007ACC;
    --videos-accent-color: #17A2B8;
    --videos-dark-color: #1a1a1a;
    --videos-light-color: #ffffff;
    --videos-text-primary: #333333;
    --videos-text-secondary: #666666;
    --videos-text-light: #999999;
    --videos-bg-light: #f8f9fa;
    --videos-shadow-light: 0 4px 15px rgba(0, 0, 0, 0.1);
    --videos-shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.15);
    --videos-shadow-heavy: 0 15px 45px rgba(0, 0, 0, 0.2);
    --videos-gradient-primary: linear-gradient(135deg, var(--videos-primary-color) 0%, var(--videos-primary-light) 100%);
    --videos-border-radius: 15px;
    --videos-transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --section-padding: 60px;
}

/* ===== وصولية ===== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0
}

/* ===== الوضع الافتراضي: الدِسك توب ===== */
.video-filters-desktop {
    display: flex
}

.video-filters-dropdown {
    display: none
}

/* ===== ستايل الـ Dropdown (مربع + النص بالمنتصف) ===== */
.video-filter-select {
    direction: rtl;
    width: 100%;
    max-width: 420px;
    padding: 12px 16px;
    border: 2px solid var(--videos-primary-color);
    border-radius: 12px;
    background: #fff;
    color: var(--videos-text-secondary);
    font-size: 1.4rem;
    font-weight: 600;
    box-shadow: var(--videos-shadow-light);
    transition: var(--videos-transition);
    text-align: center;
    text-align-last: center;
    -moz-text-align-last: center;
    appearance: none;
    -webkit-appearance: none;
    /* سهم لليمين */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23FEC800' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) 50%;
    background-size: 22px;
}

.video-filter-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(254,200,0,.25)
}

/* ===== الموبايل: أخفِ الأزرار وأظهر dropdown ===== */
@media (max-width:768px) {
    .video-filters, .video-filters-desktop {
        display: none !important;
    }

    .video-filters-dropdown {
        display: flex !important;
        justify-content: center;
        margin-top: -8px;
        margin-bottom: 22px;
    }
}

/* ===== فلترة "قوية" تتغلب على أي !important قديم ===== */
.video-card.hidden-by-filter {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.hero {
    position: relative;
    background: url('https://images.unsplash.com/photo-1587620962725-abab7fe55159?ixlib=rb-4.0.3&auto=format&fit=crop&w=1600&q=80') no-repeat center center/cover;
    color: white;
    padding: 120px 0;
    overflow: hidden;
}

/* ضبابية للخلفية */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: inherit;
    filter: blur(6px);
    transform: scale(1.1);
}

/* طبقة غامقة */
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

/* الكونتينر */
.hero .container {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* الصندوق الشفاف للنص */
.hero-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    padding: 30px 40px;
    border-radius: 12px;
    max-width: 700px;
    text-align: center;
}

/* النصوص */
.hero-subtitle {
    font-size: 20px;
    margin-bottom: 10px;
    color: white !important;
}

.hero-title {
    font-size: 48px;
    margin: 20px 0;
    font-weight: bold;
    color: #fff;
}

.hero-text {
    font-size: 18px;
    line-height: 1.6;
    color: #eaeaea;
}

/* الخلفية تظهر بتدرج */
.hero::before,
.hero::after {
    animation: fadeIn 1.5s ease forwards;
}

/* الصندوق الشفاف للنص */
.hero-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 30px 40px;
    border-radius: 12px;
    max-width: 700px;
    text-align: center;
    opacity: 0;
    transform: translateY(50px);
    animation: slideUp 1.5s ease forwards;
    animation-delay: 0.5s;
}

/* النصوص داخل الصندوق */
.hero-subtitle,
.hero-title,
.hero-text {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 1s ease forwards;
}

.hero-subtitle {
    animation-delay: 0.8s;
}

.hero-title {
    animation-delay: 1.1s;
}

.hero-text {
    animation-delay: 1.4s;
}

/* Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section {
    padding: 80px 0;
    background: var(--videos-bg-light);
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    color: var(--videos-text-primary);
    margin-bottom: 20px;
    text-align: center;
    position: relative;
}


.dot {
    color: var(--videos-primary-color);
}

/* ===== فلاتر الفيديوهات - نفس تصميم المدونة ===== */
.video-filters {
    display: flex;
    justify-content: center;
    margin: 35px;
    flex-wrap: wrap;
    gap: 15px;
}

.video-filter-btn {
    background: white;
    color: var(--videos-text-secondary);
    border: 2px solid transparent;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--videos-transition);
    white-space: nowrap;
}

.video-filter-btn.active,
.video-filter-btn:hover {
    background: var(--videos-gradient-primary);
    color: var(--videos-dark-color);
    border-color: var(--videos-primary-color);
    transform: translateY(-2px);
    box-shadow: var(--videos-shadow-light);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* دائماً 3 أعمدة */
    gap: 30px;
    margin-top: 40px;
    /* تأكد من أن العناصر تبقى في حجمها الطبيعي حتى لو كان هناك عنصر واحد */
    justify-items: start; /* العناصر تبدأ من اليمين */
}

.video-card {
    background: white;
    border-radius: var(--videos-border-radius);
    overflow: hidden;
    box-shadow: var(--videos-shadow-light);
    transition: var(--videos-transition), opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    transform: translateY(0);
    opacity: 0;
    animation: videoCardFadeIn 0.6s ease forwards;
    width: 100%; /* العرض الكامل للعمود المخصص له */
    max-width: 400px; /* حد أقصى للعرض لضمان عدم التمدد المفرط */
}

.video-card:hover {
    transform: translateY(-15px);
    box-shadow: var(--videos-shadow-heavy);
}

@keyframes videoCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-thumbnail {
    position: relative;
    height: 250px;
    overflow: hidden;
    background: #000;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--videos-transition);
}

.video-card:hover .video-thumbnail img {
    transform: scale(1.1);
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: rgba(254, 200, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.4rem;
    transition: all 0.3s ease;
    pointer-events: none;
}

.video-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 1.2rem;
    pointer-events: none;
}

.language-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 1.2rem;
    pointer-events: none;
}

.video-content {
    padding: 25px;
}

.video-category {
    background: var(--videos-primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: inline-block;
}

.video-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--videos-text-primary);
    margin-bottom: 15px;
    line-height: 1.4;
    height: 70px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-description {
    color: var(--videos-text-secondary);
    font-size: 1.4rem;
    line-height: 1.6;
    margin-bottom: 20px;
    height: 65px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    font-size: 1.3rem;
    color: var(--videos-text-light);
}

.view-count {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn {
    display: inline-block;
    background: var(--videos-primary-color);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--videos-primary-color);
}

.btn:hover {
    background: transparent;
    color: var(--videos-primary-color);
}

.invert-btn {
    background: transparent;
    color: var(--videos-primary-color);
}

.invert-btn:hover {
    background: var(--videos-primary-color);
    color: white;
}

/* ===== الاستجابة للشاشات المختلفة ===== */
@media (max-width: 1024px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr); /* عمودين للشاشات المتوسطة */
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .hero {
        padding-block-start: 80px;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-text {
        font-size: 1.4rem;
    }

    .video-grid {
        grid-template-columns: 1fr; /* عمود واحد للشاشات الصغيرة */
        gap: 25px;
        justify-items: center; /* توسيط العناصر في الشاشات الصغيرة */
    }

    .video-card {
        margin-bottom: 20px;
        max-width: none; /* إلغاء الحد الأقصى للعرض في الشاشات الصغيرة */
    }

    .video-content {
        padding: 20px;
    }

    .video-title {
        font-size: 1.6rem;
        height: auto;
        -webkit-line-clamp: unset;
    }

    .video-description {
        height: auto;
        -webkit-line-clamp: unset;
    }

    .video-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .video-filters {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .video-filter-btn {
        padding: 10px 20px;
        font-size: 1.3rem;
    }

    .section-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 80px 0 50px;
    }

    .section {
        padding: 60px 0;
    }

    .video-thumbnail {
        height: 200px;
    }

    .video-title {
        font-size: 1.5rem;
    }

    .video-description {
        font-size: 1.3rem;
    }

    .container {
        padding: 0 15px;
    }
}

/* ===== تأثيرات إضافية ===== */
.video-card:nth-child(even) {
    animation-delay: 0.1s;
}

.video-card:nth-child(3n) {
    animation-delay: 0.2s;
}

/* حالة التحميل */
.video-loading {
    opacity: 0.6;
    pointer-events: none;
}

.video-loading .video-card {
    animation: videoPulse 1.5s ease-in-out infinite;
}

@keyframes videoPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* تحسينات إضافية للفلترة */
.video-card {
    transition: var(--videos-transition), opacity 0.3s ease, transform 0.3s ease;
}

.video-card[style*="display: none"] {
    opacity: 0;
    transform: scale(0.8);
}

.video-card[style*="display: block"] {
    opacity: 1;
    transform: scale(1);
}

/* ضمان أن العناصر المخفية لا تؤثر على layout */
.video-grid .video-card:not([style*="display: block"]):not([style*="display: inline"]):not([style=""]) {
    display: none !important;
}

/* وصولية */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0
}

/* الوضع الافتراضي: الدِسك توب */
.video-filters-desktop {
    display: flex
}

.video-filters-dropdown {
    display: none
}

/* ستايل الـ Dropdown (مربع + النص بالمنتصف) */
.video-filter-select {
    direction: rtl;
    width: 100%;
    max-width: 420px;
    padding: 12px 16px;
    border: 2px solid var(--primary-color, #FEC800);
    border-radius: 12px;
    background: #fff;
    color: var(--text-secondary, #666);
    font-size: 1.4rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-align: center;
    text-align-last: center;
    -moz-text-align-last: center;
    appearance: none;
    -webkit-appearance: none;
    /* سهم لليمين */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23FEC800' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) 50%;
    background-size: 22px;
}

    .video-filter-select:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(254,200,0,.25)
    }

/* الموبايل: أخفِ الأزرار وأظهر dropdown */
@media (max-width:768px) {
    .video-filters, .video-filters-desktop {
        display: none !important;
    }

    .video-filters-dropdown {
        display: flex !important;
        justify-content: center;
        margin-top: -8px;
        margin-bottom: 22px;
    }
}

/* فلترة "قوية" تتغلب على أي !important قديم */
.video-card.hidden-by-filter {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}