/* Plugin Visor Videos - Estilos Frontend */

.pv-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.pv-wrapper {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

/* Sección Izquierda */
.pv-left-section {
    flex: 1;
    min-width: 300px;
    order: 1;
}

.pv-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Layout para móvil */
.pv-mobile-layout {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pv-text-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pv-title-wrapper,
.pv-description-wrapper {
    overflow: hidden;
    white-space: nowrap;
}

/* Cuando la marquesina está desactivada en escritorio, permitir múltiples líneas */
.pv-title-wrapper.pv-marquee-disabled-desktop,
.pv-description-wrapper.pv-marquee-disabled-desktop {
    overflow: visible;
    white-space: normal;
}

.pv-title-wrapper.pv-marquee-disabled-desktop .pv-title,
.pv-title-wrapper.pv-marquee-disabled-desktop h2.pv-title {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.pv-description-wrapper.pv-marquee-disabled-desktop {
    flex-wrap: wrap;
}

.pv-description-wrapper.pv-marquee-disabled-desktop .pv-description,
.pv-description-wrapper.pv-marquee-disabled-desktop .pv-client {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.pv-title-wrapper .pv-title,
.pv-description-wrapper {
    display: inline-block;
    margin: 0;
}

.pv-title {
    font-size: 2.5em;
    font-weight: bold;
    margin: 0;
    color: #000;
    line-height: 1.2;
    display: inline-block;
}

.pv-description {
    font-size: 1em;
    color: #000;
    margin: 0;
    line-height: 1.5;
    display: inline-block;
}

.pv-client {
    font-size: 0.9em;
    font-style: italic;
    color: #000;
    margin: 0;
    display: inline-block;
}

.pv-description-wrapper .pv-client::before {
    content: ' - ';
    margin: 0 5px;
}

/* Animación marquee para texto que se desborda (disponible en todos los dispositivos) */
@keyframes pv-marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.pv-title-wrapper.pv-marquee-active,
.pv-description-wrapper.pv-marquee-active {
    position: relative;
}

.pv-marquee-content {
    display: inline-block;
    white-space: nowrap;
}

.pv-marquee-duplicate {
    margin-left: 30px;
    display: inline-block;
}

.pv-icon-link {
    display: inline-block;
    margin-top: 10px;
    line-height: 0;
}

.pv-icon {
    max-width: 50px;
    max-height: 50px;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    border: none;
    outline: none;
}

/* Contenedor para icono sin enlace */
.pv-icon-container {
    display: inline-block;
    margin-top: 10px;
    line-height: 0;
}

/* Cuando el icono no tiene enlace */
.pv-mobile-layout > .pv-icon-container {
    margin-top: 10px;
    line-height: 0;
}

.pv-mobile-layout > .pv-icon-container .pv-icon {
    display: block;
    max-width: 50px;
    max-height: 50px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Navegación en sección izquierda */
.pv-left-navigation {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    align-items: center;
}

.pv-nav-left-btn,
.pv-nav-right-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #333;
    background: transparent;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.pv-nav-left-btn:hover:not(:disabled),
.pv-nav-right-btn:hover:not(:disabled) {
    background: #333;
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.pv-nav-left-btn:active:not(:disabled),
.pv-nav-right-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.pv-nav-left-btn:disabled,
.pv-nav-right-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #ccc;
    color: #ccc;
}

.pv-nav-left-btn svg,
.pv-nav-right-btn svg {
    width: 20px;
    height: 20px;
}

/* Sección Derecha */
.pv-right-section {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    order: 2;
}

/* Marco de teléfono */
.pv-phone-frame {
    position: relative;
    width: 100%;
    max-width: 350px;
    background: #000;
    border-radius: 25px;
    padding: 15px;
    /* Espacio adicional del 10% para los controles */
    /* El video tiene aspect-ratio 9/16, así que si el ancho interno es ~320px, la altura es ~569px */
    /* 10% adicional ≈ 57px, más espacio para controles = 70px total */
    padding-bottom: 70px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pv-phone-frame::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    background: #333;
    border-radius: 3px;
    z-index: 1;
}

.pv-video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 15px;
    background: #000;
    aspect-ratio: 9/16;
    object-fit: cover;
    position: relative;
    margin-bottom: 0;
    flex: 0 0 auto;
    /* El video mantiene su proporción original, el espacio adicional está en el padding-bottom del marco */
    
    /* Prevenir selección y arrastrar para dificultar descarga */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    pointer-events: auto; /* Mantener interactividad con controles */
}

/* Controles personalizados de reproducción */
.pv-custom-controls {
    position: absolute;
    bottom: 10px;
    left: 15px;
    right: 15px;
    width: calc(100% - 30px);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    z-index: 10;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
    gap: 10px;
    /* Los controles están en el área adicional del 10% del marco */
    height: 50px;
    /* Asegurar que no interfiera con los controles nativos del video */
    pointer-events: none;
}

/* Los botones dentro de los controles personalizados deben ser clickeables */
.pv-custom-controls .pv-control-btn {
    pointer-events: auto;
}

.pv-video-counter {
    flex: 0 0 auto;
    color: #FF69B4;
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    min-width: 60px;
    text-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
    user-select: none;
}

.pv-control-btn {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    max-width: 50px;
    max-height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.9);
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
    flex-grow: 0;
    box-sizing: border-box;
    vertical-align: middle;
}

.pv-control-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.9);
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

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

.pv-control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pv-control-btn svg {
    width: 24px;
    height: 24px;
}

/* Botón de volumen */
.pv-volume-btn {
    position: relative;
}

.pv-volume-btn svg {
    width: 24px;
    height: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pv-volume-icon-on,
.pv-volume-icon-off {
    transition: opacity 0.2s ease;
}

/* Asegurar que los controles nativos del video sean visibles y funcionales */
.pv-video {
    /* Permitir que los controles nativos aparezcan correctamente */
    -webkit-tap-highlight-color: transparent;
}

/* Ocultar opción de descargar en los controles nativos (respaldo adicional) */
.pv-video::-webkit-media-controls-download-button {
    display: none !important;
}

.pv-video::-webkit-media-controls-enclosure {
    overflow: visible;
}

/* En móviles, asegurar que los controles nativos funcionen correctamente al tocar */
@media (hover: none) and (pointer: coarse) {
    .pv-video {
        /* Permitir que los controles nativos aparezcan al tocar la pantalla */
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Asegurar que los controles nativos tengan prioridad en móviles */
    .pv-video::-webkit-media-controls-panel {
        display: flex !important;
    }
    
    /* Ocultar opción de descargar en móviles */
    .pv-video::-webkit-media-controls-download-button {
        display: none !important;
    }
}

/* Controles de navegación sobre el video */
.pv-video-navigation {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    border-radius: 0 0 15px 15px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pv-video-navigation.show {
    opacity: 1;
}

.pv-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.pv-nav-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.pv-nav-btn:active {
    transform: translateY(0);
}

.pv-nav-btn svg {
    width: 20px;
    height: 20px;
}

.pv-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pv-nav-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Indicadores */
.pv-indicators {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.pv-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: inline-block;
    position: relative;
    z-index: 10;
}

.pv-indicator:hover {
    transform: scale(1.3);
}

.pv-indicator[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1000;
}

.pv-indicator[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 2px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid rgba(0, 0, 0, 0.9);
    pointer-events: none;
    z-index: 1001;
}

.pv-indicator.active {
    background: #4A90E2;
    border-color: #4A90E2;
    transform: scale(1.2);
}

.pv-indicator.paused {
    background: #4A90E2;
    border-color: #4A90E2;
}

.pv-indicator.paused::after {
    content: '||';
    color: white;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* Botón Agregar */
.pv-add-btn {
    background: #FF6B35;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(255, 107, 53, 0.3);
}

.pv-add-btn:hover {
    background: #E55A2B;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 107, 53, 0.4);
}

.pv-add-btn:active {
    transform: translateY(0);
}

/* Modal */
.pv-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.pv-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pv-modal-content {
    background-color: #fff;
    margin: auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.pv-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pv-modal-title {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0;
}

.pv-modal-close {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pv-modal-close:hover {
    color: #000;
}

.pv-form-group {
    margin-bottom: 20px;
}

.pv-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.pv-form-group input[type="text"],
.pv-form-group input[type="url"],
.pv-form-group textarea,
.pv-form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
}

.pv-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.pv-form-group select {
    cursor: pointer;
}

.pv-form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pv-form-group input[type="file"]:hover {
    border-color: #FF6B35;
    background-color: #fff5f2;
}

.pv-file-upload-progress {
    margin-top: 10px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 5px;
}

.pv-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.pv-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6B35, #FF8C5A);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
    animation: pv-progress-pulse 1.5s ease-in-out infinite;
}

@keyframes pv-progress-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pv-progress-text {
    display: block;
    font-size: 0.9em;
    color: #666;
    text-align: center;
}

.pv-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

.pv-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
}

.pv-btn-primary {
    background: #FF6B35;
    color: white;
}

.pv-btn-primary:hover {
    background: #E55A2B;
}

.pv-btn-secondary {
    background: #ccc;
    color: #333;
}

.pv-btn-secondary:hover {
    background: #bbb;
}

.pv-btn-cancel {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pv-btn-cancel:hover {
    background: #e0e0e0;
    border-color: #bbb;
    color: #000;
}

.pv-empty {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1.1em;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .pv-container {
        padding: 5px 10px;
    }
    
    .pv-wrapper {
        flex-direction: column;
        gap: 5px;
        align-items: stretch;
    }
    
    .pv-left-section {
        order: 1;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .pv-right-section {
        order: 2;
        width: 100%;
        margin: 0;
    }
    
    .pv-content {
        gap: 0;
        width: 100%;
        margin: 0;
    }
    
    /* Layout horizontal para móvil: icono a la izquierda, texto a la derecha */
    .pv-mobile-layout {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: 100%;
        max-width: 100%;
        padding: 0 15px;
        margin: 0;
        box-sizing: border-box;
    }
    
    .pv-icon-link,
    .pv-icon-container {
        margin-top: 0;
        margin-bottom: 0;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 50px;
        width: 50px;
    }
    
    .pv-icon-link .pv-icon,
    .pv-icon-container .pv-icon {
        max-width: 50px;
        max-height: 50px;
        width: auto;
        height: auto;
        display: block;
        margin: 0;
        padding: 0;
    }
    
    .pv-text-content {
        flex: 1;
        min-width: 0;
        gap: 5px;
        overflow: visible;
        display: flex;
        flex-direction: column;
    }
    
    .pv-title-wrapper {
        width: 100%;
        overflow: hidden;
        min-height: 1.3em;
        line-height: 1.3em;
        margin-bottom: 4px;
        position: relative;
    }
    
    .pv-title {
        font-size: 1em;
        line-height: 1.3em;
        white-space: nowrap;
        display: inline-block;
        margin: 0;
        padding: 0;
        vertical-align: top;
    }
    
    .pv-description-wrapper {
        width: 100%;
        overflow: hidden;
        min-height: 1.3em;
        line-height: 1.3em;
        font-size: 0.85em;
        position: relative;
        margin-top: 0;
        padding-top: 0;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 5px;
    }
    
    .pv-description,
    .pv-client {
        white-space: nowrap;
        display: inline-block;
        font-size: inherit;
        line-height: inherit;
        margin: 0;
        padding: 0;
        vertical-align: top;
    }
    
    .pv-description-wrapper .pv-client::before {
        content: ' - ';
        margin: 0;
    }
    
    .pv-title-wrapper h2 {
        margin: 0;
        padding: 0;
    }
    
    .pv-modal-content {
        width: 95%;
        padding: 20px;
    }
}

@media screen and (max-width: 480px) {
    .pv-container {
        padding: 10px;
    }
    
    .pv-title {
        font-size: 1.5em;
    }
    
    .pv-phone-frame {
        max-width: 100%;
    }
}

/* Mensaje de no autorizado */
.pv-unauthorized-message {
    padding: 40px 20px;
    text-align: center;
    background: #fff;
    border: 2px solid #dc3232;
    border-radius: 8px;
    color: #dc3232;
    font-size: 24px;
    font-weight: 600;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(220, 50, 50, 0.2);
}

/* Grid de iconos en modal frontend (pv_editor) */
.pv-icons-grid-frontend {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

.pv-icon-option-frontend {
    display: block;
    cursor: pointer;
    position: relative;
}

.pv-icon-radio-frontend {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pv-icon-preview-box-frontend {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s;
    text-align: center;
}

.pv-icon-option-frontend:hover .pv-icon-preview-box-frontend {
    border-color: #2271b1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pv-icon-radio-frontend:checked + .pv-icon-preview-box-frontend {
    border-color: #2271b1;
    background: #e7f3ff;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.pv-icon-preview-img-frontend {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 5px;
}

.pv-icon-name-frontend {
    font-size: 11px;
    color: #666;
    word-break: break-word;
    line-height: 1.2;
}

.pv-icon-radio-frontend:checked + .pv-icon-preview-box-frontend .pv-icon-name-frontend {
    color: #2271b1;
    font-weight: 600;
}

.pv-no-icons {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    margin: 0;
}

/* Responsive para grid de iconos en frontend */
@media (max-width: 768px) {
    .pv-icons-grid-frontend {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
        max-height: 250px;
    }
    
    .pv-icon-preview-img-frontend {
        width: 40px;
        height: 40px;
    }
    
    .pv-icon-name-frontend {
        font-size: 10px;
    }
}

