/* le-player.css - Standalone Media Player Styles */

.le-player {
    position: relative;
    width: 100%;
    margin: 0 auto;
    background: #000;
    overflow: hidden;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.le-player__media-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 */
    background: #000;
    overflow: hidden;
}

.le-player__media-target {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1;
}

.le-player__media-container iframe,
.le-player__media-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    z-index: 2;
}

/* Poster Overlay & Instant Loader (Khử hoàn toàn chớp giật khi nạp video) */
.le-player__poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #000000;
    z-index: 5;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity;
}

.le-player__loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.le-player__spinner {
    width: 44px;
    height: 44px;
    border: 3.5px solid rgba(255, 255, 255, 0.22);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: le-player-spin 0.8s linear infinite;
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.5);
}

@keyframes le-player-spin {
    to { transform: rotate(360deg); }
}

/* Unmute Badge (Fallback autoplay khi trình duyệt chặn tiếng) */
.le-player__unmute-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 25;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    animation: le-pulse-badge 2s infinite ease-in-out;
}

.le-player__unmute-badge:hover {
    background: rgba(15, 23, 42, 0.98);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.45);
}

@keyframes le-pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); }
    50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}

/* Center Replay Button (Hiển thị giữa màn hình khi kết thúc video) */
.le-player__center-replay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 22;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    animation: le-replay-appear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes le-replay-appear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.75);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.le-player__btn-replay-center {
    width: 68px;
    height: 68px;
    min-width: 68px;
    min-height: 68px;
    max-width: 68px;
    max-height: 68px;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    line-height: 0 !important;
    font-size: 0 !important;
}

.le-player__btn-replay-center:hover {
    background: rgba(200, 159, 93, 0.95) !important;
    border-color: #ffffff !important;
    transform: scale(1.1) rotate(-15deg);
    box-shadow: 0 12px 30px rgba(200, 159, 93, 0.45);
}

.le-player__btn-replay-center svg {
    width: 32px;
    height: 32px;
    display: block !important;
    margin: 0 auto !important;
    pointer-events: none;
    fill: currentColor;
}

.le-player__replay-label {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 12px;
    border-radius: 12px;
    letter-spacing: 0.02em;
    backdrop-filter: blur(6px);
}

/* Center Play Button (Nút Play lớn giữa màn hình khi dừng / chờ phát) */
.le-player__center-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 22;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    animation: le-replay-appear 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.le-player__btn-play-center {
    width: 68px;
    height: 68px;
    min-width: 68px;
    min-height: 68px;
    max-width: 68px;
    max-height: 68px;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    background: rgba(15, 23, 42, 0.88) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.45) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    line-height: 0 !important;
    font-size: 0 !important;
}

.le-player__btn-play-center:hover {
    background: #2563eb !important;
    border-color: #ffffff !important;
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.55);
}

.le-player__btn-play-center svg {
    width: 32px;
    height: 32px;
    display: block !important;
    margin: 0 auto !important;
    pointer-events: none;
    fill: currentColor;
}

.le-player__controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 15px 20px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    z-index: 20;
    transition: opacity 0.3s ease;
}

.le-player__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: pointer;
    pointer-events: auto;
    background: transparent;
}

.le-player:hover .le-player__controls,
.le-player--is-paused .le-player__controls {
    opacity: 1;
}

/* Auto Hide Controls */
.le-player.le-player--hide-controls {
    cursor: none;
}

.le-player.le-player--hide-controls .le-player__controls {
    opacity: 0 !important;
    pointer-events: none;
}

/* Pseudo Fullscreen Fallback (iOS Safari) */
.le-player.is-pseudo-fullscreen {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    z-index: 9999999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.le-player.is-pseudo-fullscreen .le-player__media-container {
    height: 100% !important;
    padding-top: 0 !important;
}

.le-player__btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.le-player__btn:hover {
    transform: scale(1.1);
}

.le-player__btn svg {
    width: 20px;
    height: 20px;
}

.le-player__seek-wrap {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.le-player__seek-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #e74c3c;
    border-radius: 2px;
    width: 0%;
}

.le-player__seek-thumb {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.le-player__seek-wrap:hover .le-player__seek-thumb {
    opacity: 1;
}

.le-player__time {
    font-size: 13px;
    min-width: 80px;
    text-align: center;
}

/* Lightbox Styles */
.le-player-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.le-player-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.le-player-lightbox__content {
    width: 90%;
    max-width: 1000px;
    position: relative;
}

.le-player-lightbox__close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
}

.le-player-lightbox__close:hover {
    color: #e74c3c;
}

/* Speed Control Styles */
.le-player__speed-control {
    position: relative;
    display: inline-block;
}

.le-player__btn-speed {
    font-size: 14px;
    font-weight: 600;
    min-width: 40px;
}

.le-player__speed-menu {
    position: absolute;
    bottom: 100%;
    right: 50%;
    transform: translateX(50%);
    background: rgba(0, 0, 0, 0.9);
    border-radius: 6px;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    min-width: 80px;
    margin-bottom: 15px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.le-player__speed-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

.le-player__speed-menu.show {
    opacity: 1;
    visibility: visible;
    margin-bottom: 10px;
}

.le-player__speed-menu button {
    background: none;
    border: none;
    color: #fff;
    padding: 6px 15px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    text-align: center;
}

.le-player__speed-menu button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.le-player__speed-menu button.active {
    color: #e74c3c;
    font-weight: bold;
}

/* =========================================
   MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 800px) {
    .le-player-lightbox__content {
        width: 100%;
        max-width: 100%;
    }

    .le-player {
        border-radius: 0;
    }

    .le-player-lightbox__close {
        position: fixed;
        top: 15px;
        right: 20px;
        font-size: 32px;
        z-index: 9999999;
        text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    }

    .le-player__controls {
        padding: 10px 12px;
        gap: 10px;
    }

    .le-player__btn {
        padding: 4px;
    }

    .le-player__btn svg {
        width: 18px;
        height: 18px;
    }

    .le-player__time {
        font-size: 11px;
        min-width: 65px;
    }

    /* Nút Play và Replay ở giữa cân đối trên mobile */
    .le-player__btn-play-center,
    .le-player__btn-replay-center {
        width: 58px !important;
        height: 58px !important;
        min-width: 58px !important;
        min-height: 58px !important;
        max-width: 58px !important;
        max-height: 58px !important;
    }

    .le-player__btn-play-center svg,
    .le-player__btn-replay-center svg {
        width: 28px !important;
        height: 28px !important;
    }

    /* Prevent speed menu from right-screen cutoff */
    .le-player__speed-menu {
        right: 0;
        transform: none;
    }

    .le-player__speed-menu::after {
        left: auto;
        right: 15px;
        transform: none;
    }
}

/* Extra safety for landscape mobile */
@media (orientation: landscape) and (max-height: 500px) {
    .le-player-lightbox__content {
        width: 100%;
        height: 100vh;
        height: 100dvh;
    }

    .le-player {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
    }

    .le-player__media-container {
        padding-top: 0;
        height: 100%;
    }

    .le-player-lightbox__close {
        top: 10px;
        right: 15px;
        font-size: 28px;
    }
}