/* Estilos para el Sistema de Video Avanzado */

/* Modal de conversión de video */
.xioleni-video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.xioleni-video-modal-content {
    background: linear-gradient(135deg, #009bb631 0%, #009bb657 100%);
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
}

.xioleni-video-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #444;
    background: linear-gradient(135deg, #009CB6 0%, #009CB6 100%);
    border-radius: 15px 15px 0 0;
}

.xioleni-video-modal-header h3 {
    margin: 0;
    color: white;
    font-size: 1.4em;
    font-weight: 600;
}

.xioleni-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.xioleni-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.xioleni-video-modal-body {
    padding: 25px;
    color: #e0e0e0;
}

.xioleni-video-info {
    background: #02adfc23;
    border: 1px solid hwb(199 0% 0% / 0.151);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.xioleni-video-info p {
    margin: 8px 0;
    font-size: 0.95em;
}

.xioleni-video-info strong {
    color: #ff5c00;
}

.xioleni-video-preview {
    text-align: center;
    margin: 20px 0;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.xioleni-video-preview video {
    border-radius: 10px;
    width: 100%;
    max-height: 550px;
    height: auto;
    display: block;
    cursor: crosshair;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.xioleni-video-preview video:hover {
    cursor: crosshair;
}

.xioleni-video-preview video:active {
    cursor: crosshair;
}

@media (max-width: 768px) {
    .xioleni-video-preview video {
        max-height: 300px;
    }
}

/* Barra de video independiente - ancho completo */
.xioleni-video-preview-bar {
    width: 100%;
    max-width: 100%;
    background: #000;
    margin: 0 0 30px 0;
    overflow-x: visible;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Scroll horizontal para videos anchos */
    scrollbar-width: thin;
    scrollbar-color: #007bff #333;
}

.xioleni-video-preview-bar::-webkit-scrollbar {
    height: 8px;
}

.xioleni-video-preview-bar::-webkit-scrollbar-track {
    background: #333;
}

.xioleni-video-preview-bar::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 4px;
}

.xioleni-video-preview-bar::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Contenedor principal del video - solo para timelines */
.xioleni-video-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    /* Solo contiene los timelines, no el video */
}

/* Video principal - dentro de la barra */
#xioleni-preview-video {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 550px !important;
    object-fit: contain;
    background: #000;
    border-radius: 0;
    margin: 0;
    display: block;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    #xioleni-preview-video {
        max-height: 300px !important;
    }
}

.xioleni-video-overlay-timeline {
    position: relative;
    width: 100%;
    margin: 10px 0;
    background: rgba(0, 0, 0, 0);
    border-radius: 8px;
    padding: 15px;
    z-index: 10;
    /* Asegurar que aparezca debajo del video */
    order: 2;
    /* Centrar el contenido */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

/* Contenedor con scroll para el timeline */
.xioleni-timeline-scroll-container {
    position: relative;
    width: 100%;
    overflow: visible;
    scrollbar-width: thin;
    scrollbar-color: #007bff #f1f1f1;
    z-index: 15;
    /* Centrar el timeline */
    display: flex;
    justify-content: center;
    align-items: center;
}

.xioleni-timeline-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.xioleni-timeline-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.xioleni-timeline-scroll-container::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 4px;
}

.xioleni-timeline-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

.xioleni-timeline-header {
    margin-bottom: 15px;
    text-align: center;
}

.xioleni-timeline-header h4 {
    color: #fff;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}



.xioleni-timeline-controls {
    text-align: center;
    margin: 15px 0;
}

.xioleni-timeline-controls button {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 5px;
    font-size: 14px;
    transition: background-color 0.3s;
}

.xioleni-timeline-controls button:hover {
    background: #0056b3;
}

#xioleni-undo-timeline-btn {
    background: #6c757d;
}

#xioleni-undo-timeline-btn:hover {
    background: #545b62;
}

.xioleni-timeline-container {
    position: relative;
    width: 100%;
    margin: 10px 0;
    overflow-x: visible;
    overflow-y: hidden;
    /* Sin scroll horizontal */
    scrollbar-width: thin;
    scrollbar-color: #007bff #f1f1f1;
}

.xioleni-timeline-container::-webkit-scrollbar {
    height: 8px;
}

.xioleni-timeline-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.xioleni-timeline-container::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 4px;
}

.xioleni-timeline-container::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

.xioleni-timeline-track {
    position: relative;
    height: 50px;
    /* Ancho fijo para evitar scroll horizontal */
    min-width: 100%;
    width: 100%;
    pointer-events: all;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    backdrop-filter: blur(2px);
    cursor: pointer;
    padding: 5px 0;
    /* Área de clic más grande para mejor usabilidad */
    box-sizing: content-box;
    /* Mejorar interacción táctil */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    transform: translateX(-10px);
    z-index: 50;
    /* Asegurar que aparezca por encima del overlay-timeline y scroll-container */
}

/* Mejorar timeline en móviles */
@media (max-width: 768px) {
    .xioleni-timeline-track {
        height: 60px;
        padding: 8px 0;
        border-width: 3px;
        width: 100% !important;
        min-width: 100% !important;
    }
    
    .xioleni-timeline-scroll-container {
        width: 100%;
        overflow-x: visible;
    }
    
    .xioleni-video-overlay-timeline {
        width: 100%;
    }
}

.xioleni-timeline-track:hover {
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border-color: rgba(255, 255, 255, 1);
}



/* Líneas de tiempo verticales - OCULTAS */
.xioleni-timeline-lines {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 0% !important;
    height: 0% !important;
    min-width: 0% !important;
    min-height: 0px !important;
    z-index: -1 !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    background: transparent !important;
    overflow: hidden !important;
}

.xioleni-timeline-line {
    position: absolute !important;
    top: 0 !important;
    width: 2px !important;
    height: 100% !important;
    background: rgba(255,255,255,0.3) !important;
    transform: translateX(-50%) !important;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3) !important;
    z-index: 100 !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.xioleni-timeline-line.disabled {
    background: rgba(128, 128, 128, 0.4);
    opacity: 0.5;
}

/* Barra de rango seleccionado */
.xioleni-timeline-range {
    position: absolute;
    top: 20px;
    height: 10px;
    background: linear-gradient(90deg, #ffffff, #ffffff);
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    z-index: 18;
    /* Asegurar que aparezca por encima del overlay-timeline */
}

/* Controles de arrastre */
.xioleni-timeline-handle {
    position: absolute;
    top: 5px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
    z-index: 110;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    min-width: 40px;
    min-height: 40px;
    /* Mejorar área táctil para móviles */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Área táctil más grande en móviles */
@media (max-width: 768px) {
    .xioleni-timeline-handle {
        width: 50px;
        height: 50px;
        min-width: 50px;
        min-height: 50px;
    }
    
    .xioleni-timeline-handle:hover {
        transform: translateX(-50%) scale(1.1);
    }
    
    .xioleni-timeline-handle:active {
        transform: translateX(-50%) scale(1.2);
    }
}

.xioleni-timeline-handle:hover {
    transform: translateX(-50%) scale(1.15);
    box-shadow: 0 6px 20px rgba(0,0,0,0.7);
}

.xioleni-timeline-handle:active {
    cursor: grabbing;
    transform: translateX(-50%) scale(1.25);
}

.xioleni-timeline-handle:focus {
    outline: 3px solid #ffd700;
    outline-offset: 3px;
}

.xioleni-timeline-start {
    background: linear-gradient(135deg, #05b8ff, #05b8ff);
    border: 3px solid #fff;
}

.xioleni-timeline-end {
    background: linear-gradient(135deg, #ff5c00, #ff5c00);
    border: 3px solid #fff;
}

/* Etiquetas de los controles */
.xioleni-handle-label {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    background: rgba(0,0,0,0.7);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
}

.xioleni-time-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 10px;
    background: #00242757;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.xioleni-time-display span {
    font-weight: 500;
    color: #495057;
}

.xioleni-time-display span span {
    color: #007bff;
    font-weight: bold;
    margin-left: 5px;
}

#xioleni-start-time-display {
    display: inline-block;
    margin-left: 10px;
    color: #ff5c00;
    font-weight: 600;
    font-size: 1.1em;
}

.xioleni-conversion-info {
    background: rgba(6, 222, 236, 0.1);
    border: 1px solid rgba(6, 222, 236, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 15px;
}

.xioleni-conversion-info p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #06deec;
}

.xioleni-video-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.xioleni-video-actions button {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#xioleni-convert-btn {
    background: linear-gradient(135deg, #ff5c00 0%, #ff5c00 100%);
    color: white;
}

#xioleni-convert-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff5c00 0%, #ff9900 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 156, 182, 0.4);
}

#xioleni-convert-btn:active:not(:disabled) {
    background: linear-gradient(135deg, #ff5c00 0%, #ff9900 100%);
    color: white;
    transform: translateY(0px);
    box-shadow: 0 2px 8px rgba(0, 156, 182, 0.6);
}

#xioleni-convert-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.xioleni-video-actions button:first-child {
    background: rgba(48, 48, 48, 0.5);
    color: #e0e0e0;
}

.xioleni-video-actions button:first-child:hover {
    background: rgba(85, 85, 85, 0.5);
    transform: translateY(-2px);
}

.xioleni-video-actions button:first-child:active {
    background: rgba(68, 68, 68, 0.5);
    transform: translateY(0px);
}

/* Barra de progreso */
#xioleni-conversion-progress {
    margin-top: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid #444;
}

.xioleni-progress-bar {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.xioleni-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #009cb61c 0%, #ff5c00 50%, #06deec 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

#xioleni-progress-text {
    text-align: center;
    color: #e0e0e0;
    font-weight: 500;
    margin: 0;
}

/* Estilos responsivos para video */
.xioleni-preview-video {
    width: 100%;
    max-width: 100%;
    max-height: 550px;
    height: auto;
    border-radius: 10px;
    margin: 10px auto;
    object-fit: contain;
    display: block;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    pointer-events: auto !important;
}

/* Altura máxima según dispositivo */
@media (max-width: 768px) {
    .xioleni-preview-video {
        max-height: 300px;
    }
    
    .xioleni-video-modal-content {
        width: 95%;
        height: 90%;
        margin: 5% auto;
    }
    
    .xioleni-video-modal-body {
        padding: 20px;
    }
    
    .xioleni-video-actions {
        flex-direction: column;
    }
    
    .xioleni-video-actions button {
        min-width: auto;
    }
    
    /* Posicionamiento específico para móviles del time-display */
    .xioleni-time-display {
        margin-top: 0px;
        margin-bottom: 5px;
        order: 10;
        z-index: 1;
        transform: translateY(-15px);
    }
    
    /* Ajustar botones de conversión para móviles */
    .xioleni-conversion-info {
        order: 15;
        margin-top: 5px;
    }
    
    .xioleni-convert-btn {
        order: 20;
        margin-top: 5px;
    }
    
    .xioleni-video-modal .xioleni-close-btn {
        order: 25;
        margin-top: 5px;
    }
    
    .xioleni-video-actions {
        margin-top: 10px;
    }
    
    /* Ocultar líneas completamente en móviles */
    .xioleni-video-modal .xioleni-timeline-lines,
    .xioleni-video-container .xioleni-timeline-lines {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        z-index: -1 !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 0% !important;
        height: 0% !important;
        min-height: 0px !important;
        pointer-events: none !important;
        background: transparent !important;
        overflow: hidden !important;
    }
    
    .xioleni-video-modal .xioleni-timeline-line,
    .xioleni-video-container .xioleni-timeline-line {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        position: absolute !important;
        top: 0 !important;
        width: 0px !important;
        height: 0% !important;
        min-height: 0px !important;
        background: transparent !important;
        border: none !important;
        transform: translateX(-50%) !important;
        box-shadow: none !important;
        z-index: -1 !important;
        pointer-events: none !important;
        border-radius: 0px !important;
    }
    
    .xioleni-timeline-controls {
        order: 5;
        margin-bottom: 15px;
    }
    
    .xioleni-video-overlay-timeline {
        display: flex;
        flex-direction: column;
    }
}

@media (min-width: 769px) {
    .xioleni-preview-video {
        max-height: 550px;
    }
}

/* Animaciones */
@keyframes xioleniModalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.xioleni-video-modal-content {
    animation: xioleniModalFadeIn 0.3s ease-out;
}

/* Indicador de nivel de usuario */
.xioleni-user-level-indicator {
    display: inline-block;
    background: linear-gradient(135deg, #009cb61c 0%, #ff5c00 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    margin-left: 10px;
}

/* Mejoras para el contenedor de medios */
.xioleni-media-container {
    position: relative;
    margin: 15px 0;
    border-radius: 0;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
}

.xioleni-media-container:hover {
    transform: none;
    box-shadow: none;
}

/* Botón de eliminación mejorado */
.xioleni-media-remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.xioleni-media-remove-btn:hover {
    background: #ff4757;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
}

/* Información de video en el editor */
.xioleni-video-info-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 500;
}

/* Efectos de carga */
.xioleni-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #444;
    border-radius: 50%;
    border-top-color: #ff5c00;
    animation: xioleniSpin 1s ease-in-out infinite;
    margin-right: 10px;
}

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