/* ====================================
   🎬 IMGFLOW VINE-STYLE VIDEO PLAYER
   Inspirado en diseño moderno tipo Vine
   ==================================== */

:root {
    --imgflow-primary: #00B488;
    --imgflow-primary-hover: #009670;
    --imgflow-primary-light: #33c49f;
    --player-bg: rgba(0, 0, 0, 0.75);
    --player-text: #ffffff;
    --player-border: rgba(255, 255, 255, 0.15);
}

/* Video Container */
.video-player-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
}

.video-player-wrapper video {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Custom Controls Overlay */
.custom-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
    padding: 60px 16px 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.video-player-wrapper:hover .custom-video-controls,
.video-player-wrapper.is-playing .custom-video-controls {
    opacity: 1;
    pointer-events: all;
}

/* Always show on mobile */
@media (max-width: 768px) {
    .custom-video-controls {
        opacity: 1;
        pointer-events: all;
    }
}

/* Progress Bar Container */
.video-progress-container {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: height 0.2s ease;
}

.video-progress-container:hover {
    height: 6px;
}

/* Progress Bar - Buffered */
.video-progress-buffered {
    position: absolute;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    pointer-events: none;
}

/* Progress Bar - Played (Verde ImgFlow) */
.video-progress-bar {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, var(--imgflow-primary) 0%, var(--imgflow-primary-light) 100%);
    border-radius: 2px;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* Progress Bar Handle */
.video-progress-handle {
    position: absolute;
    top: 50%;
    right: -6px;
    width: 12px;
    height: 12px;
    background: var(--player-text);
    border: 2px solid var(--imgflow-primary);
    border-radius: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.video-progress-container:hover .video-progress-handle,
.video-progress-container.is-seeking .video-progress-handle {
    opacity: 1;
}

/* Controls Bottom Row */
.video-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* Control Buttons */
.video-control-btn {
    background: transparent;
    border: none;
    color: var(--player-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.video-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

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

.video-control-btn i {
    font-size: 20px;
    transition: color 0.2s ease;
}

/* Play/Pause Button - Con acento verde */
.video-control-btn.play-pause-btn {
    background: var(--imgflow-primary);
    width: 40px;
    height: 40px;
}

.video-control-btn.play-pause-btn:hover {
    background: var(--imgflow-primary-hover);
    transform: scale(1.15);
}

.video-control-btn.play-pause-btn i {
    font-size: 22px;
}

/* Mute Button */
.video-control-btn.mute-btn.is-muted i {
    color: #ff6b6b;
}

/* Time Display */
.video-time-display {
    color: var(--player-text);
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Volume Slider */
.video-volume-slider {
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
}

.video-control-btn.mute-btn:hover + .video-volume-slider,
.video-volume-slider:hover {
    width: 80px;
}

.video-volume-slider input[type="range"] {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.video-volume-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--imgflow-primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.video-volume-slider input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--imgflow-primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.video-volume-slider input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(to right, var(--imgflow-primary) var(--volume-percentage, 50%), rgba(255, 255, 255, 0.2) var(--volume-percentage, 50%));
    height: 4px;
    border-radius: 2px;
}

/* Fullscreen Button */
.video-control-btn.fullscreen-btn i {
    font-size: 18px;
}

/* Loading Spinner */
.video-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--imgflow-primary);
    border-radius: 50%;
    animation: video-spinner-rotate 0.8s linear infinite;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-player-wrapper.is-loading .video-loading-spinner {
    opacity: 1;
}

@keyframes video-spinner-rotate {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Center Play Button (Big) */
.video-center-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--imgflow-primary) 0%, var(--imgflow-primary-light) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 180, 136, 0.4);
    opacity: 0;
    pointer-events: none;
}

.video-player-wrapper:not(.is-playing) .video-center-play {
    opacity: 1;
    pointer-events: all;
}

.video-center-play:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 12px 32px rgba(0, 180, 136, 0.5);
}

.video-center-play i {
    font-size: 36px;
    color: white;
    margin-left: 4px;
}

/* Pause Overlay (Opcional) */
.video-pause-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-player-wrapper.is-paused:hover .video-pause-overlay {
    opacity: 1;
}

/* Settings Button (Opcional para futuras features) */
.video-control-btn.settings-btn {
    position: relative;
}

.video-settings-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--player-border);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.video-control-btn.settings-btn:hover .video-settings-menu {
    opacity: 1;
    pointer-events: all;
}

/* Replay Count Badge */
.video-replay-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: linear-gradient(135deg, rgba(0, 180, 136, 0.9) 0%, rgba(51, 196, 159, 0.9) 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.video-replay-badge i {
    font-size: 14px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .video-center-play {
        width: 64px;
        height: 64px;
    }

    .video-center-play i {
        font-size: 28px;
    }

    .video-control-btn {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .video-control-btn i {
        font-size: 18px;
    }

    .video-control-btn.play-pause-btn {
        width: 36px;
        height: 36px;
    }

    .video-volume-slider {
        display: none; /* Ocultar slider de volumen en móvil */
    }
}

/* Hide native controls */
.video-player-wrapper video::-webkit-media-controls {
    display: none !important;
}

.video-player-wrapper video::-webkit-media-controls-enclosure {
    display: none !important;
}

/* Animation for controls appear */
@keyframes fadeInControls {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-video-controls.is-visible {
    animation: fadeInControls 0.3s ease;
}
