/* PH Video Player */
.ph-player-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin: 1em 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.ph-player-wrap:fullscreen,
.ph-player-wrap:-webkit-full-screen {
    border-radius: 0;
}

/* Loading spinner */
.ph-player-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.ph-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ph-spin 0.8s linear infinite;
}

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

/* Video element */
.ph-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    cursor: pointer;
}

/* Controls bar — single gradient backdrop, no individual black boxes */
.ph-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

.ph-player-wrap:hover .ph-controls,
.ph-player-wrap.ph-show-controls .ph-controls,
.ph-player-wrap:fullscreen .ph-controls,
.ph-player-wrap:-webkit-full-screen .ph-controls {
    opacity: 1;
}

/* All control buttons — reset everything, then restyle */
.ph-controls button,
.ph-controls button:hover,
.ph-controls button:focus,
.ph-controls button:active {
    all: unset !important;
    color: #fff !important;
    cursor: pointer !important;
    padding: 4px !important;
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}

.ph-controls button:hover {
    color: #aaa !important;
}

/* Progress bar */
.ph-progress-wrap {
    flex: 1;
    cursor: pointer;
    padding: 8px 0;
}

.ph-progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.ph-progress-wrap:hover .ph-progress-bar {
    height: 6px;
}

.ph-progress-filled {
    height: 100%;
    background: #aaa;
    border-radius: 2px;
    width: 0;
    transition: width 0.1s linear;
}

/* Time display */
.ph-time {
    color: #ccc;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}

/* Quality selector — reset everything, then restyle */
.ph-controls select,
.ph-controls select:hover,
.ph-controls select:focus,
.ph-controls select:active {
    all: unset !important;
    color: #fff !important;
    background: rgba(255,255,255,0.15) !important;
    border: 1px solid rgba(255,255,255,0.3) !important;
    border-radius: 4px !important;
    padding: 3px 6px !important;
    font-size: 12px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    line-height: 1.4 !important;
}

.ph-controls select:hover {
    background: rgba(255,255,255,0.25) !important;
}

.ph-controls select option {
    background: #222;
    color: #fff;
}

/* Scrollbar override — grey instead of yellow */
.ph-player-wrap ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.ph-player-wrap ::-webkit-scrollbar-track {
    background: #000;
}
.ph-player-wrap ::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 3px;
}
.ph-player-wrap ::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Error state */
.ph-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 16px;
    background: #000;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .ph-controls {
        padding: 8px 10px;
        gap: 8px;
    }

    .ph-time {
        display: none;
    }

    .ph-controls button {
        -webkit-tap-highlight-color: transparent !important;
    }
}
