/* ============================================================
   MLF Custom Video Player - Premium UX
   ============================================================ */

.mlf-player {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-height: 180px;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    user-select: none;
    aspect-ratio: 16 / 9;
    display: block;
}

/* Ajuste específico para quando o player aparece dentro do chat */
.msg-bubble .mlf-player {
    aspect-ratio: auto;
    height: 220px;
}

.mlf-player video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important; /* Sobrescreve a trava do main.css */
    display: block;
    cursor: pointer;
    object-fit: contain;
    z-index: 1;
}

/* Forçado para Fullscreen */
.mlf-player:fullscreen {
    background: #000;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    display: block; /* Remove flex para evitar squash */
}

.mlf-player:fullscreen video {
    width: 100% !important;
    height: 100% !important;
}

.mlf-player:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
}

.mlf-player:-webkit-full-screen video {
    width: 100vw !important;
    height: 100vh !important;
}

/* Big Center Play Icon */
.mlf-player-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    pointer-events: none;
    transition: opacity 0.3s;
    opacity: 0;
    z-index: 5;
}

.mlf-player.paused .mlf-player-overlay {
    opacity: 1;
}

.mlf-big-play-btn {
    width: 70px;
    height: 70px;
    background: rgba(124, 58, 237, 0.85); /* Primary with Alpha */
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.4);
    transform: scale(0.9);
    transition: transform 0.2s;
}

.mlf-player.paused .mlf-big-play-btn {
    transform: scale(1);
}

.mlf-big-play-btn svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
    margin-left: 4px;
}

/* Custom Controls Bar */
.mlf-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.mlf-player:hover .mlf-controls,
.mlf-player.paused .mlf-controls {
    transform: translateY(0);
}

/* Progress Slider */
.mlf-progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: height 0.2s;
}

.mlf-progress-container:hover {
    height: 8px;
}

.mlf-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--info));
    border-radius: 10px;
    width: 0%;
    position: relative;
}

.mlf-progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

.mlf-progress-container:hover .mlf-progress-bar::after {
    transform: translateY(-50%) scale(1);
}

/* Controls Bottom Row */
.mlf-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
}

.mlf-controls-left, .mlf-controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mlf-btn {
    background: none;
    border: none;
    color: #fff;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.mlf-btn:hover {
    opacity: 0.8;
}

.mlf-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.mlf-time {
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: rgba(255,255,255,0.9);
}

/* Volume Slider */
.mlf-volume-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mlf-volume-slider {
    width: 0;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: width 0.3s;
}

.mlf-volume-wrap:hover .mlf-volume-slider {
    width: 60px;
}

.mlf-volume-level {
    height: 100%;
    background: #fff;
    width: 100%;
}

/* Buffer Progress */
.mlf-buffer {
    position: absolute;
    top: 0; left: 0; height: 100%;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    z-index: 1;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .mlf-controls {
        padding: 10px 15px;
        transform: translateY(0); /* Persistent only on mobile or click */
    }
    .mlf-big-play-btn {
        width: 50px;
        height: 50px;
    }
    .mlf-big-play-btn svg {
        width: 20px;
        height: 20px;
    }
}
