/**
 * تنسيقات مشغل البث المباشر
 */

.stream-player {
    width: 100%;
    max-width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
}

.player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    overflow: hidden;
}

.video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

/* شعار الموقع */
.player-logo {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.9;
    transition: opacity 0.3s ease;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 100%);
    padding: 8px 12px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.player-logo:hover {
    opacity: 1;
}

.player-logo img {
    height: 35px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

/* شاشة التحميل */
.player-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.player-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.player-loading p {
    color: #fff;
    margin-top: 20px;
    font-size: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* رسالة الخطأ */
.player-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    color: #fff;
}

.player-error i {
    font-size: 60px;
    color: #dc3545;
    margin-bottom: 20px;
}

.player-error p {
    font-size: 18px;
    margin-bottom: 20px;
}

.player-error .btn-retry {
    padding: 12px 30px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.player-error .btn-retry:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

/* أدوات التحكم */
.player-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7));
    color: #fff;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.time-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #fff;
    font-weight: 500;
    background: rgba(220, 53, 69, 0.8);
    padding: 4px 12px;
    border-radius: 4px;
}

/* مؤشر الصوت */
.volume-slider {
    position: absolute;
    bottom: 60px;
    left: 60px;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px 10px;
    border-radius: 8px;
    z-index: 30;
}

.volume-range {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
}

.volume-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

.volume-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* قائمة الجودة */
.btn-quality {
    position: relative;
}

.quality-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.quality-menu {
    position: absolute;
    bottom: 60px;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    border-radius: 8px;
    overflow: hidden;
    min-width: 180px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 30;
}

.quality-option {
    padding: 12px 20px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.quality-option:last-child {
    border-bottom: none;
}

.quality-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.quality-option.active {
    background: rgba(0, 123, 255, 0.8);
    font-weight: 600;
}

.quality-option.active::after {
    content: '✓';
    float: right;
    margin-left: 10px;
}

/* وضع ملء الشاشة */
.stream-player:fullscreen {
    border-radius: 0;
}

.stream-player:fullscreen .player-wrapper {
    padding-top: 0;
    height: 100vh;
}

.stream-player:fullscreen .player-logo {
    top: 25px;
    right: 25px;
    padding: 10px 15px;
}

.stream-player:fullscreen .player-logo img {
    height: 45px;
    max-width: 150px;
}

/* تنسيقات responsive */
@media (max-width: 768px) {
    .player-logo {
        top: 10px;
        right: 10px;
        padding: 6px 10px;
        border-radius: 6px;
    }
    
    .player-logo img {
        height: 28px;
        max-width: 90px;
    }
    
    .player-controls {
        padding: 10px 15px;
    }
    
    .controls-left,
    .controls-right {
        gap: 10px;
    }
    
    .control-btn {
        font-size: 16px;
        padding: 6px;
    }
    
    .quality-label {
        display: none;
    }
    
    .quality-menu {
        right: auto;
        left: 0;
        min-width: 150px;
    }
    
    .volume-slider {
        bottom: 50px;
        left: 50px;
    }
    
    .time-display {
        font-size: 12px;
        padding: 3px 8px;
    }
}

@media (max-width: 480px) {
    .player-loading .spinner {
        width: 40px;
        height: 40px;
    }
    
    .player-loading p {
        font-size: 14px;
    }
    
    .player-error i {
        font-size: 40px;
    }
    
    .player-error p {
        font-size: 16px;
    }
}

/* منع التحديد والنسخ */
.stream-player,
.stream-player * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.video-player {
    pointer-events: auto;
}

/* إخفاء أدوات التحكم الافتراضية في بعض المتصفحات */
.video-player::-webkit-media-controls {
    display: none !important;
}

.video-player::-webkit-media-controls-enclosure {
    display: none !important;
}

/* تنسيقات iframe المباشر */
.iframe-player-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* نسبة 16:9 */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.iframe-player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 12px;
}

/* حماية من العناصر المنبثقة */
.iframe-player-container {
    isolation: isolate;
    position: relative;
}

/* طبقة شفافة فوق iframe لحظر الإعلانات التفاعلية */
.iframe-player-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
    background: transparent;
}

/* السماح للمستخدم بالتفاعل مع المشغل فقط */
.iframe-player-container iframe {
    z-index: 0;
}

/* حظر النقرات على الزوايا (مكان الإعلانات عادة) */
.iframe-player-container .ad-blocker-overlay {
    position: absolute;
    pointer-events: auto;
    background: transparent;
    z-index: 2;
}

/* إخفاء الزوايا العلوية (مكان الإعلانات) */
.iframe-player-container .ad-blocker-overlay.top-right {
    top: 0;
    right: 0;
    width: 120px;
    height: 80px;
}

.iframe-player-container .ad-blocker-overlay.top-left {
    top: 0;
    left: 0;
    width: 120px;
    height: 80px;
}

.iframe-player-container .ad-blocker-overlay.bottom-right {
    bottom: 60px;
    right: 0;
    width: 150px;
    height: 80px;
}

.iframe-player-container .ad-blocker-overlay.bottom-left {
    bottom: 60px;
    left: 0;
    width: 150px;
    height: 80px;
}

