/**
 * Dark Video Player — player.css
 * Responsive, theme-agnostic styles for inline HLS player
 * Designed to work across any WordPress theme
 */

/* === Container: dimensions set via inline style from admin settings === */
.darkvp-container {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    background: #000;
    border-radius: 4px;
    box-sizing: border-box;
    margin: 0 auto;
    isolation: isolate;
    clear: both;
}

/* Reset: ป้องกัน theme override */
.darkvp-container,
.darkvp-container *,
.darkvp-container *::before,
.darkvp-container *::after {
    box-sizing: border-box;
}

/* Video.js fills container absolutely */
.darkvp-container .video-js {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* === Skip Ad Button === */
.darkvp-skip-btn {
    position: absolute;
    bottom: 20%;
    right: 10px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    display: none;
    z-index: 20;
    border: none;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.2;
}

.darkvp-skip-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.darkvp-skip-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Register Button === */
.darkvp-regis-btn {
    position: absolute;
    top: 60px;
    right: 10px;
    background: #ffeb3b;
    color: #000;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    z-index: 20;
    animation: darkvp-glow 1s infinite alternate;
}

.darkvp-regis-btn a {
    display: block;
    padding: 10px 20px;
    color: #000;
    text-decoration: none;
}

@keyframes darkvp-glow {
    from {
        box-shadow: 0 0 5px #ffeb3b, 0 0 10px #ffeb3b, 0 0 20px #ffeb3b;
    }

    to {
        box-shadow: 0 0 20px #ffff00, 0 0 30px #ffff00, 0 0 40px #ffff00;
    }
}

/* === Custom Play Button === */
.darkvp-play-btn {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(43, 51, 63, 0.7);
    border-radius: 50%;
    cursor: pointer;
    z-index: 15;
    transition: all 0.2s ease;
    border: 2px solid white;
}

.darkvp-play-btn:hover {
    background: rgba(255, 0, 0, 0.8);
}

.darkvp-play-btn svg {
    fill: #ffffff;
    width: 50%;
    height: 50%;
    margin: 25%;
}

/* === Click Overlay === */
.darkvp-click-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 50px);
    z-index: 10;
    cursor: pointer;
    display: none;
}

/* === Loading === */
.darkvp-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #aaa;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    z-index: 10;
    text-align: center;
}

.darkvp-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #aaa;
    border-radius: 50%;
    animation: darkvp-spin 0.8s linear infinite;
    margin-bottom: 10px;
}

@keyframes darkvp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* === Video.js poster fix === */
.darkvp-container .video-js .vjs-poster,
.darkvp-container .video-js .vjs-poster picture,
.darkvp-container .video-js .vjs-poster img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    object-fit: cover !important;
}

/* === Responsive: Mobile === */
@media (max-width: 768px) {
    .darkvp-play-btn {
        width: 60px;
        height: 60px;
    }

    .darkvp-skip-btn {
        font-size: 14px;
        padding: 8px 15px;
        bottom: 15%;
    }

    .darkvp-regis-btn {
        font-size: 14px;
        top: 40px;
    }

    .darkvp-regis-btn a {
        padding: 8px 14px;
    }
}

/* === Legacy Fallback UI === */
.darkvp-legacy-fallback {
    animation: darkvp-fadeIn 0.6s ease-out;
}

@keyframes darkvp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .darkvp-legacy-fallback {
        min-height: 250px !important;
    }
    .darkvp-legacy-fallback h3 {
        font-size: 17px !important;
    }
}