/**
 * thx-mp-video.css - v5.0.0
 * Responsive video player with mobile support and professional controls
 */

/* Player Container */
.thx-mp__player {
    position: relative;
    background: #000;
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin: 20px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.thx-mp__yt-target {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.thx-mp__player-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    pointer-events: none;
    transition: background-color 0.3s ease;
}

/* Black overlay on pause */
.thx-mp__player.is-paused .thx-mp__player-overlay {
    background-color: #000;
}

/* Allow clicks on interactive elements */
.thx-mp__player-overlay>* {
    pointer-events: auto;
}

/* Center Play Button */
.thx-mp__center-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(60px, 15vw, 80px);
    height: clamp(60px, 15vw, 80px);
    background: rgba(0, 0, 0, 0.75);
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    z-index: 15;
}

.thx-mp__center-play.is-visible {
    opacity: 1;
}

.thx-mp__center-play:hover {
    background: rgba(255, 0, 0, 0.9);
    border-color: #fff;
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 8px 30px rgba(255, 0, 0, 0.4);
}

.thx-mp__center-play:active {
    transform: translate(-50%, -50%) scale(1.05);
}

.thx-mp__center-play-icon {
    width: 0;
    height: 0;
    border-style: solid;
    border-width: clamp(12px, 3vw, 16px) 0 clamp(12px, 3vw, 16px) clamp(20px, 5vw, 28px);
    border-color: transparent transparent transparent #fff;
    margin-left: clamp(4px, 1vw, 6px);
}

/* Controls Bar */
.thx-mp__controls-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(6px, 1.5vw, 8px) clamp(8px, 2vw, 12px);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.4s ease;
    gap: clamp(6px, 1.5vw, 8px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    /* overflow: hidden; Removed to allow speed menu popup */
}

.thx-mp:hover .thx-mp__controls-bar,
.thx-mp.is-mouse-active .thx-mp__controls-bar {
    opacity: 1;
}

/* Buttons */
.thx-mp__btn-play,
.thx-mp__btn-fs {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    padding: clamp(5px, 1.2vw, 6px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background 0.2s;
    flex-shrink: 0;
    min-width: 32px;
    min-height: 32px;
}

.thx-mp__btn-play:hover,
.thx-mp__btn-fs:hover {
    background: rgba(255, 255, 255, 0.2);
}

.thx-mp__icon {
    width: clamp(18px, 4vw, 20px);
    height: clamp(18px, 4vw, 20px);
    background-size: contain;
    background-repeat: no-repeat;
}

.thx-mp__icon-play {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
}

.thx-mp__icon-pause {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z'/%3E%3C/svg%3E");
}

.thx-mp__icon-fs-enter {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z'/%3E%3C/svg%3E");
}

/* Seek Bar */
.thx-mp__seek-wrap {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 70%;
    height: clamp(5px, 1.2vw, 6px);
    background: rgba(255, 255, 255, 0.25);
    position: relative;
    cursor: pointer;
    border-radius: 3px;
    overflow: hidden;
}

.thx-mp__seek-wrap:hover {
    height: clamp(6px, 1.5vw, 8px);
}

.thx-mp__seek-played {
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ff4444);
    width: 0;
    border-radius: 3px;
    transition: width 0.1s linear;
}

.thx-mp__seek-thumb {
    position: absolute;
    top: 50%;
    width: clamp(12px, 3vw, 14px);
    height: clamp(12px, 3vw, 14px);
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s;
}

.thx-mp__seek-wrap:hover .thx-mp__seek-thumb {
    opacity: 1;
}

/* Time Display */
.thx-mp__time-display {
    color: #fff;
    font-size: clamp(10px, 2vw, 11px);
    font-weight: 500;
    min-width: clamp(60px, 15vw, 70px);
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Speed Control */
.thx-mp__speed-control {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    z-index: 20;
}

.thx-mp__btn-speed {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    border-radius: 3px;
    font-size: clamp(10px, 2vw, 11px);
    font-weight: 600;
    padding: clamp(3px, 0.8vw, 4px) clamp(6px, 1.5vw, 8px);
    cursor: pointer;
    transition: all 0.2s;
    min-width: clamp(32px, 8vw, 36px);
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thx-mp__btn-speed:hover {
    background: rgba(255, 255, 255, 0.25);
}

.thx-mp__speed-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 6px;
    padding: 6px;
    display: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 80px;
    z-index: 25;
    pointer-events: auto;
}

.thx-mp__speed-menu.is-open {
    display: block;
}

/* Fix hover gap */
.thx-mp__speed-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 10px;
    /* Bridge the 8px margin gap */
    background: transparent;
}

/* Show menu on hover */
.thx-mp__speed-control:hover .thx-mp__speed-menu {
    display: block;
}

.thx-mp__speed-opt {
    padding: clamp(6px, 1.5vw, 8px) clamp(10px, 2.5vw, 12px);
    cursor: pointer;
    color: #fff;
    font-size: clamp(11px, 2.2vw, 12px);
    border-radius: 3px;
    transition: all 0.2s;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thx-mp__speed-opt:hover {
    background: rgba(255, 255, 255, 0.1);
}

.thx-mp__speed-opt.is-active {
    background: rgba(255, 0, 0, 0.8);
    color: #fff;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .thx-mp__player {
        margin: 10px;
        border-radius: 6px;
    }

    .thx-mp__controls-bar {
        padding: 10px 12px;
        gap: 8px;
    }

    .thx-mp__btn-play,
    .thx-mp__btn-fs,
    .thx-mp__btn-speed {
        min-width: 44px;
        min-height: 44px;
    }

    .thx-mp__icon {
        width: 24px;
        height: 24px;
    }

    .thx-mp__center-play {
        width: 70px;
        height: 70px;
    }

    .thx-mp__center-play-icon {
        border-width: 14px 0 14px 24px;
        margin-left: 5px;
    }

    .thx-mp__seek-wrap {
        max-width: 50%;
        height: 8px;
    }

    .thx-mp__seek-wrap:hover {
        height: 10px;
    }

    .thx-mp__seek-thumb {
        width: 16px;
        height: 16px;
        opacity: 1;
    }

    .thx-mp__time-display {
        font-size: 12px;
        min-width: 75px;
    }

    .thx-mp__speed-opt {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 44px;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .thx-mp__player {
        margin: 15px;
    }

    .thx-mp__seek-wrap {
        max-width: 65%;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    .thx-mp__btn-play,
    .thx-mp__btn-fs,
    .thx-mp__btn-speed {
        min-width: 44px;
        min-height: 44px;
    }

    .thx-mp__seek-thumb {
        opacity: 1;
    }
}