/**
 * Enhanced Media Styles - تنسيقات محسنة للفيديوهات والسلايدرز
 * يدعم جميع المتصفحات ويوفر تجربة مستخدم محسنة
 */

/* ===== تحسينات الفيديو العامة ===== */
video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000;
    border-radius: inherit;
}

/* دعم Safari و iOS */
video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-enclosure {
    display: none !important;
}

/* دعم Firefox */
video::-moz-media-controls {
    display: none !important;
}

/* ===== حاوي الفيديو المحسن ===== */
.video-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: 12px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    opacity: 0.1;
    z-index: 1;
}

.video-wrapper video {
    position: relative;
    z-index: 2;
}

/* ===== مؤشر التحميل ===== */
.video-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    color: #2c5aa0;
    font-size: 2.5rem;
    text-align: center;
}

.video-loader::after {
    content: 'جاري التحميل...';
    display: block;
    font-size: 0.8rem;
    margin-top: 10px;
    font-family: 'Cairo', sans-serif;
}

/* ===== رسالة الخطأ ===== */
.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 15;
    max-width: 300px;
}

.video-error i {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 15px;
    display: block;
}

.video-error p {
    color: #666;
    margin-bottom: 15px;
    font-family: 'Cairo', sans-serif;
}

.retry-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

/* ===== أزرار التحكم المخصصة ===== */
.custom-video-controls {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.video-wrapper:hover .custom-video-controls {
    opacity: 1;
}

.custom-video-controls button {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.custom-video-controls button:hover {
    background: rgba(44, 90, 160, 0.9);
    transform: scale(1.1);
}

.custom-video-controls button:active {
    transform: scale(0.95);
}

/* ===== تحسينات السلايدر ===== */
.reviews-slider {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.review-card {
    display: none;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.review-card.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

/* تأثير الانتقال السلس */
.reviews-slider::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    transition: left 0.6s ease;
    z-index: 5;
    pointer-events: none;
}

.reviews-slider.transitioning::before {
    left: 100%;
}

/* ===== تحسينات أزرار التنقل ===== */
.reviews-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.nav-btn {
    background: linear-gradient(135deg, #2c5aa0, #1e3a8a);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(44, 90, 160, 0.3);
}

.nav-btn:hover {
    background: linear-gradient(135deg, #1e3a8a, #1e40af);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(44, 90, 160, 0.4);
}

.nav-btn:active {
    transform: translateY(-1px);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== نقاط التنقل المحسنة ===== */
.reviews-dots {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d1d5db;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    background: #2c5aa0;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.dot.active {
    background: #2c5aa0;
    transform: scale(1.2);
}

.dot.active::before {
    width: 20px;
    height: 20px;
    background: rgba(44, 90, 160, 0.2);
}

.dot:hover {
    background: #9ca3af;
    transform: scale(1.1);
}

/* ===== سلايدر الصور المخصص ===== */
.custom-slider-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #f8f9fa;
}

.custom-slider-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-slider-prev,
.custom-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(44, 90, 160, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.custom-slider-prev {
    right: 15px;
}

.custom-slider-next {
    left: 15px;
}

.custom-slider-prev:hover,
.custom-slider-next:hover {
    background: rgba(44, 90, 160, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* ===== تحسينات Slick Slider ===== */
.slick-dots {
    bottom: -50px !important;
}

.slick-dots li button:before {
    color: #2c5aa0 !important;
    font-size: 12px !important;
    opacity: 0.5 !important;
}

.slick-dots li.slick-active button:before {
    opacity: 1 !important;
    color: #2c5aa0 !important;
}

.slick-prev,
.slick-next {
    width: 50px !important;
    height: 50px !important;
    z-index: 10 !important;
}

.slick-prev:before,
.slick-next:before {
    font-size: 20px !important;
    color: #2c5aa0 !important;
}

.slick-prev {
    right: 60px !important;
    left: auto !important;
}

.slick-next {
    left: 10px !important;
    right: auto !important;
}

/* ===== تأثيرات التحميل ===== */
@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.video-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* ===== تحسينات الاستجابة ===== */
@media (max-width: 768px) {
    .video-wrapper {
        height: 250px;
    }
    
    .custom-video-controls {
        bottom: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .custom-video-controls button {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .custom-slider-prev,
    .custom-slider-next {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .custom-slider-prev {
        right: 10px;
    }
    
    .custom-slider-next {
        left: 10px;
    }
    
    .reviews-navigation {
        gap: 15px;
        margin-top: 20px;
    }
    
    .video-error {
        padding: 20px;
        max-width: 250px;
    }
    
    .video-error i {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .video-wrapper {
        height: 200px;
    }
    
    .custom-video-controls button {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .custom-slider-prev,
    .custom-slider-next {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .reviews-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .dot {
        width: 10px;
        height: 10px;
    }
    
    .dot.active::before {
        width: 16px;
        height: 16px;
    }
}

/* ===== تحسينات الأداء ===== */
.video-wrapper,
.custom-slider-wrapper,
.reviews-slider {
    will-change: transform;
    transform: translateZ(0);
}

/* تحسين الخطوط */
.video-error,
.retry-btn,
.video-loader::after {
    font-display: swap;
}

/* تحسين التباين للوصولية */
@media (prefers-contrast: high) {
    .custom-video-controls button {
        background: rgba(0, 0, 0, 0.95);
        border: 2px solid white;
    }
    
    .nav-btn {
        border: 2px solid white;
    }
    
    .dot {
        border: 2px solid #333;
    }
}

/* تحسين الحركة للمستخدمين الذين يفضلون تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
    .review-card,
    .custom-slider-track,
    .nav-btn,
    .dot,
    .custom-video-controls button {
        transition: none;
    }
    
    .video-wrapper::before {
        animation: none;
    }
}

/* ===== تحسينات الطباعة ===== */
@media print {
    .custom-video-controls,
    .reviews-navigation,
    .custom-slider-prev,
    .custom-slider-next {
        display: none !important;
    }
    
    .video-wrapper {
        background: #f0f0f0;
        border: 1px solid #ccc;
    }
    
    .video-wrapper::after {
        content: 'فيديو - غير متاح في الطباعة';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-family: 'Cairo', sans-serif;
        color: #666;
    }
}