/* أنماط المشغلات - الواجهة الأمامية */

/* تحميل مكتبات المشغلات */
@import url('https://cdn.jsdelivr.net/npm/clappr@latest/dist/clappr.min.css');
@import url('https://vjs.zencdn.net/8.6.1/video-js.css');

/* الحاوي الرئيسي للمشغل */
.kooralive-player-wrapper {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin: 20px 0;
    position: relative;
    max-width: 100%;
}

/* شريط التحكم العلوي */
.kooralive-player-controls {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: relative;
    z-index: 10;
}

.player-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin: 0;
    flex: 1;
}

.player-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.refresh-btn,
.share-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.refresh-btn:hover,
.share-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* محتوى المشغل */
.kooralive-player-content {
    position: relative;
    background: #000;
    min-height: 400px;
}

/* أنماط المشغلات المختلفة */
.kooralive-clappr-player,
.kooralive-videojs-player,
.kooralive-hls-player,
.kooralive-jwplayer,
.kooralive-iframe-player {
    width: 100%;
    height: 400px;
    border: none;
    display: block;
}

/* مشغل Clappr */
.kooralive-player-clappr .kooralive-clappr-player {
    background: #000;
}

/* مشغل VideoJS */
.kooralive-player-videojs .video-js {
    width: 100% !important;
    height: 400px !important;
    background: #000;
}

.kooralive-player-videojs .video-js .vjs-big-play-button {
    background: rgba(76, 175, 80, 0.8);
    border: none;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    line-height: 80px;
    font-size: 2rem;
    top: 50%;
    left: 50%;
    margin-top: -40px;
    margin-left: -40px;
}

.kooralive-player-videojs .video-js .vjs-big-play-button:hover {
    background: rgba(76, 175, 80, 1);
    transform: scale(1.1);
}

/* مشغل HLS */
.kooralive-player-hls .kooralive-hls-player {
    background: #000;
    object-fit: contain;
}

/* مشغل JWPlayer */
.kooralive-player-jwplayer .kooralive-jwplayer {
    background: #000;
}

/* مشغل iframe */
.kooralive-player-iframe .kooralive-iframe-player {
    background: #f0f0f0;
}

/* بطاقة الانضمام للمجموعة */
.kooralive-join-card {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    padding: 20px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.kooralive-join-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.join-card-content {
    position: relative;
    z-index: 2;
}

.join-card-content h4 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    font-weight: bold;
}

.join-card-content p {
    margin: 0 0 15px 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.join-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.join-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
}

.join-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: white;
    text-decoration: none;
}

.telegram-btn:hover {
    background: rgba(0, 136, 204, 0.8);
    border-color: #0088cc;
}

.whatsapp-btn:hover {
    background: rgba(37, 211, 102, 0.8);
    border-color: #25d366;
}

/* تحسينات للتجاوب */
@media (max-width: 768px) {
    .kooralive-player-controls {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .player-actions {
        justify-content: center;
        width: 100%;
    }
    
    .refresh-btn,
    .share-btn {
        flex: 1;
        max-width: 120px;
    }
    
    .kooralive-clappr-player,
    .kooralive-videojs-player,
    .kooralive-hls-player,
    .kooralive-jwplayer,
    .kooralive-iframe-player {
        height: 250px;
    }
    
    .kooralive-player-videojs .video-js {
        height: 250px !important;
    }
    
    .join-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .join-btn {
        width: 200px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .kooralive-player-wrapper {
        border-radius: 8px;
        margin: 15px 0;
    }
    
    .kooralive-player-controls {
        padding: 12px 15px;
    }
    
    .player-title {
        font-size: 1rem;
    }
    
    .refresh-btn,
    .share-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .kooralive-clappr-player,
    .kooralive-videojs-player,
    .kooralive-hls-player,
    .kooralive-jwplayer,
    .kooralive-iframe-player {
        height: 200px;
    }
    
    .kooralive-player-videojs .video-js {
        height: 200px !important;
    }
    
    .kooralive-join-card {
        padding: 15px;
    }
    
    .join-card-content h4 {
        font-size: 1.1rem;
    }
    
    .join-card-content p {
        font-size: 0.9rem;
    }
}

/* تحسينات للأداء */
.kooralive-player-wrapper {
    will-change: transform;
}

.kooralive-player-content {
    will-change: contents;
}

/* تحسينات للتحميل */
.kooralive-player-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 5;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 15px;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* تحسينات للأخطاء */
.kooralive-player-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 20px;
    z-index: 5;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.6;
}

.error-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.error-message {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 20px;
    line-height: 1.5;
}

.error-retry {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.error-retry:hover {
    background: #45a049;
    transform: translateY(-2px);
}

/* تحسينات للتركيز */
.kooralive-player-wrapper:focus-within {
    outline: 2px solid #4CAF50;
    outline-offset: 2px;
}

/* تحسينات للطباعة */
@media print {
    .kooralive-player-wrapper {
        display: none;
    }
}

/* تحسينات للوضع المظلم */
@media (prefers-color-scheme: dark) {
    .kooralive-player-wrapper {
        box-shadow: 0 8px 32px rgba(255, 255, 255, 0.1);
    }
}

/* تحسينات للحركة المخفضة */
@media (prefers-reduced-motion: reduce) {
    .kooralive-player-wrapper,
    .refresh-btn,
    .share-btn,
    .join-btn,
    .error-retry {
        transition: none;
    }
    
    .kooralive-join-card::before {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: #4CAF50;
    }
}

/* تحسينات للشاشات عالية الدقة */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .kooralive-player-wrapper {
        border-radius: 12px;
    }
}

/* تحسينات للوضع الأفقي على الأجهزة المحمولة */
@media (max-width: 768px) and (orientation: landscape) {
    .kooralive-clappr-player,
    .kooralive-videojs-player,
    .kooralive-hls-player,
    .kooralive-jwplayer,
    .kooralive-iframe-player {
        height: 300px;
    }
    
    .kooralive-player-videojs .video-js {
        height: 300px !important;
    }
}

/* تحسينات للشاشات الكبيرة */
@media (min-width: 1200px) {
    .kooralive-player-wrapper {
        max-width: 1000px;
        margin: 30px auto;
    }
    
    .kooralive-clappr-player,
    .kooralive-videojs-player,
    .kooralive-hls-player,
    .kooralive-jwplayer,
    .kooralive-iframe-player {
        height: 500px;
    }
    
    .kooralive-player-videojs .video-js {
        height: 500px !important;
    }
}

/* تحسينات للتباين العالي */
@media (prefers-contrast: high) {
    .kooralive-player-controls {
        background: #000;
        border-bottom: 2px solid #fff;
    }
    
    .refresh-btn,
    .share-btn {
        border: 2px solid #fff;
        background: transparent;
    }
    
    .kooralive-join-card {
        background: #000;
        border: 2px solid #4CAF50;
    }
}

/* تحسينات للشفافية المخفضة */
@media (prefers-reduced-transparency: reduce) {
    .refresh-btn,
    .share-btn,
    .join-btn {
        backdrop-filter: none;
        background: rgba(255, 255, 255, 0.9);
        color: #333;
    }
    
    .refresh-btn:hover,
    .share-btn:hover {
        background: #fff;
    }
}

/* أنماط إضافية للمشغلات */
.kooralive-player-wrapper[data-player-type="clappr"] {
    border-left: 4px solid #4CAF50;
}

.kooralive-player-wrapper[data-player-type="videojs"] {
    border-left: 4px solid #2196F3;
}

.kooralive-player-wrapper[data-player-type="hls"] {
    border-left: 4px solid #FF9800;
}

.kooralive-player-wrapper[data-player-type="jwplayer"] {
    border-left: 4px solid #9C27B0;
}

.kooralive-player-wrapper[data-player-type="iframe"] {
    border-left: 4px solid #607D8B;
}

/* تحسينات للتفاعل */
.kooralive-player-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* تحسينات للنص */
.kooralive-player-wrapper * {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* تحسينات للتمرير */
.kooralive-player-wrapper {
    scroll-margin-top: 20px;
}

/* تحسينات للتحديد */
.kooralive-player-wrapper *::selection {
    background: rgba(76, 175, 80, 0.3);
}

/* تحسينات للتحميل التدريجي */
.kooralive-player-wrapper {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تأخير التحميل للعناصر المختلفة */
.kooralive-player-controls {
    animation-delay: 0.1s;
}

.kooralive-player-content {
    animation-delay: 0.2s;
}

.kooralive-join-card {
    animation-delay: 0.3s;
}
