/**
 * VEA CAST - Live Step Styles (Step 4)
 * HLS Player and Live streaming interface
 */

/* HLS Player Container */
.hls-player-container {
    margin: 10px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: none; /* Hidden by default, shown in Step 4 */
    position: relative; /* Para posicionar el indicador LIVE */
}

/* Live Indicator para el Sender */
.sender-live-indicator {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(220, 38, 38, 0.85);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.8em;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
    opacity: 0.9;
    z-index: 10;
}

.sender-live-indicator.active {
    display: flex;
}

.sender-live-dot {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.hls-player-container h4 {
    margin: 0 0 15px 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

/* Video Element Styles */
#hlsVideo {
    width: 100%;
    height: auto;
    max-height: 400px;
    border-radius: 6px;
    background: #000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    outline: none;
    margin-bottom: 15px;
}

#hlsVideo:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Player Controls Override */
#hlsVideo::-webkit-media-controls-panel {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

#hlsVideo::-webkit-media-controls-play-button,
#hlsVideo::-webkit-media-controls-pause-button {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

/* Loading State */
.hls-player-container.loading {
    opacity: 0.7;
}

.hls-player-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Player Info */
.player-info {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.player-info h5 {
    margin: 0 0 10px 0;
    color: #007bff;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-item:last-child {
    border-bottom: none;
}

.player-info .info-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
}

.player-info .info-value {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

/* Error States */
.player-error {
    padding: 15px;
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: 8px;
    color: #f44336;
    text-align: center;
    margin-top: 15px;
}

.player-error::before {
    content: '⚠️';
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
}

/* Success States */
.player-success {
    padding: 15px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    color: #4caf50;
    text-align: center;
    margin-top: 15px;
}

.player-success::before {
    content: '✓';
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
}

/* Step 4 Specific Status Bar */
.status-bar.step-4 .progress-bar {
    display: none !important;
}

.status-bar.step-4 .status-text {
    margin-bottom: 8px;
}

.status-bar.step-4 .status-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

/* Action Buttons in Step 4 */
.action-buttons.step-4 .action-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.action-buttons.step-4 .action-btn:hover {
    background: linear-gradient(135deg, #218838, #1ca085);
}

.action-buttons.step-4 .action-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hls-player-container {
        margin: 15px 0;
        padding: 15px;
    }
    
    #hlsVideo {
        max-height: 250px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .player-info {
        padding: 12px;
    }
    
    /* Indicador LIVE responsive */
    .sender-live-indicator {
        top: 20px;
        right: 20px;
        padding: 5px 10px;
        font-size: 0.75em;
    }
    
    .sender-live-dot {
        width: 5px;
        height: 5px;
    }
}

@media (max-width: 480px) {
    .hls-player-container {
        margin: 10px 0;
        padding: 12px;
    }
    
    #hlsVideo {
        max-height: 200px;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .player-info .info-label,
    .player-info .info-value {
        font-size: 11px;
    }
    
    .live-streaming-info {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }
    
    .live-info-value {
        font-size: 14px;
    }
}

/* Animation Keyframes */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hls-player-container {
    animation: fadeIn 0.3s ease-out;
}

/* HLS Quality Selector (if needed in future) */
.quality-selector {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    padding: 5px;
    display: none;
}

.quality-selector select {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 12px;
    outline: none;
}

/* Custom Video Poster */
#hlsVideo[poster] {
    object-fit: cover;
}

/* Player Focus States */
.hls-player-container:focus-within {
    border-color: rgba(0, 123, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Live Streaming Info */
.live-streaming-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

.live-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.live-info-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.live-info-value {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.live-info-value.empty {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    font-family: inherit;
}

/* Live Status Indicator */
.live-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #28a745;
    margin-top: 4px;
}

.live-status-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    animation: pulse-live 2s infinite;
}

.live-status-indicator.offline {
    color: rgba(255, 255, 255, 0.5);
}

.live-status-indicator.offline .live-status-dot {
    background: rgba(255, 255, 255, 0.3);
    animation: none;
}

@keyframes pulse-live {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}