/* Enhanced Live Players Styles */
/* أنماط مشغلات البث المباشر المحسنة */

.ads-content-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    height: calc(100vh - 120px);
    padding: 20px;
}

.videos-sidebar {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.videos-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.video-item {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-item:hover {
    background: #e9ecef;
    border-color: #007bff;
    transform: translateY(-1px);
}

.video-item.selected {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

.main-content-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: hidden;
}

.playlists-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 20px;
    max-height: 300px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e5e9;
}

.section-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
}

.playlists-table-container {
    flex: 1;
    overflow-y: auto;
}

.compact-table {
    font-size: 0.9rem;
}

.compact-table th,
.compact-table td {
    padding: 8px 12px;
}

.bottom-section {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    overflow: hidden;
}

.live-players-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.live-players-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    overflow-y: auto;
    padding: 10px 0;
}

.live-player-item {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: fit-content;
}

.live-player-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-color: #007bff;
}

.player-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.player-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.control-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

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

.player-container {
    position: relative;
    padding: 15px;
}

.live-video-player {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    border: 2px solid #e1e5e9;
    background: #000;
    object-fit: cover;
}

.player-status {
    position: absolute;
    top: 25px;
    right: 25px;
    z-index: 10;
}

.status-indicator {
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: rgba(40, 167, 69, 0.9);
    animation: none;
}

.status-indicator.connecting {
    background: rgba(255, 193, 7, 0.9);
}

.status-indicator.disconnected {
    background: rgba(220, 53, 69, 0.9);
    animation: none;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.player-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e1e5e9;
}

.player-info small {
    color: #6c757d;
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.playlist-url {
    margin-bottom: 8px;
}

.playlist-url a {
    color: #007bff;
    text-decoration: none;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.8rem;
}

.playlist-url a:hover {
    text-decoration: underline;
    color: #0056b3;
}

.video-count {
    color: #28a745;
    font-weight: 500;
}

.test-player {
    border: 2px dashed #007bff;
    background: rgba(0, 123, 255, 0.05);
}

.test-player .player-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.video-preview-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 20px;
    overflow: hidden;
}

.video-preview-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.video-preview-container video {
    flex: 2;
    border-radius: 8px;
}

.video-info {
    flex: 1;
    padding: 10px;
}

.video-info h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.1rem;
}

.video-info p {
    margin: 0;
    color: #6c757d;
    line-height: 1.5;
}

/* HLS Error Styles */
.hls-error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(220, 53, 69, 0.95);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    z-index: 20;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 80%;
}

.hls-error-message i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.hls-status-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 15;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .live-players-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .ads-content-layout {
        grid-template-columns: 1fr;
        height: auto;
        padding: 10px;
    }
    
    .videos-sidebar {
        order: 2;
        max-height: 300px;
    }
    
    .main-content-area {
        order: 1;
    }
    
    .live-players-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .player-header {
        padding: 12px;
    }
    
    .player-title {
        font-size: 1rem;
    }
    
    .control-btn {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .live-video-player {
        height: 180px;
    }
    
    .video-preview-container {
        flex-direction: column;
    }
    
    .playlists-section {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .live-video-player {
        height: 160px;
    }
    
    .player-container {
        padding: 10px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .section-header h3 {
        text-align: center;
    }
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Success/Error Messages */
.success-message {
    background: rgba(40, 167, 69, 0.1);
    color: #155724;
    border: 1px solid rgba(40, 167, 69, 0.3);
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px 0;
}

.error-message {
    background: rgba(220, 53, 69, 0.1);
    color: #721c24;
    border: 1px solid rgba(220, 53, 69, 0.3);
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px 0;
}

/* Smooth Transitions */
* {
    transition: all 0.3s ease;
}

button, .control-btn, .live-player-item {
    transition: all 0.2s ease;
}

/* Focus States for Accessibility */
.control-btn:focus,
button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .live-players-section,
    .video-preview-section {
        break-inside: avoid;
    }
    
    .control-btn {
        display: none;
    }
}

