/* Video Player Components */
.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(128, 128, 128, 0.35);
    border: 5px solid color-mix(in srgb, var(--glass-bg) 50%, transparent);
    border-top-color: var(--accent-color);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-2xl);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 10;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.btn-icon:active {
    transform: scale(0.95);
}

.slider-track {
    position: relative;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-full);
    cursor: pointer;
    overflow: visible;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    /* Prevent page scrolling during drag */
    -webkit-touch-callout: none;
    /* Prevent iOS callout */
}

/* Increase touch target area for mobile */
.slider-track::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    bottom: -5px;
    /* Reduced from -16px to avoid covering buttons below */
    z-index: 1;
}

.slider-track.h-1 {
    height: 4px;
}

.slider-range {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: var(--accent-color);
    border-radius: var(--radius-full);
    pointer-events: none;
}

.slider-buffer {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-full);
    pointer-events: none;
}

.slider-thumb {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    background-color: white;
    border-radius: var(--radius-full);
    transform: translate(-50%, -50%);
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.slider-track.h-1 .slider-thumb {
    width: 12px;
    height: 12px;
}

.slider-track:hover .slider-thumb {
    transform: translate(-50%, -50%) scale(1.2);
}

.slider-thumb:active,
.slider-track:active .slider-thumb {
    transform: translate(-50%, -50%) scale(1.3);
    cursor: grabbing;
}

/* ============================================
   LIQUID GLASS VIDEO PLAYER STYLES
   ============================================ */

/* Glass Controls Bar */
.player-controls-glass {
    background: rgba(28, 28, 30, 0.75);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    z-index: 25;
    /* Above loading overlay */
}

.player-controls-glass:hover {
    background: rgba(28, 28, 30, 0.85);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* Glass Button Style */
.btn-glass {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-2xl);
    color: white;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-glass:active {
    transform: translateY(0) scale(0.95);
    background: rgba(255, 255, 255, 0.15);
}

/* Loading Overlay with Glass Effect */
.loading-overlay-glass {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 20;
    transition: opacity 0.3s ease;
    pointer-events: none;
    /* Allow interaction with controls during loading */
}

/* Spinner with Glass Background */
.spinner-glass {
    width: clamp(40px, 8vw, 56px);
    height: clamp(40px, 8vw, 56px);
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent-color);
    border-radius: var(--radius-full);
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.3);
}

/* Next Episode Loading Indicator */
.next-episode-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.next-episode-loading .spinner-glass {
    width: clamp(36px, 6vw, 48px);
    height: clamp(36px, 6vw, 48px);
}

.next-episode-text {
    color: white;
    font-size: clamp(1rem, 3vw, 1.25rem);
    /* Increased size */
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.05em;
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {

    0%,
    100% {
        opacity: 0.9;
    }

    50% {
        opacity: 0.6;
    }
}

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

/* Mode Badge Styles */
.badge-proxy {
    background: rgba(255, 149, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.3);
}

.badge-direct {
    background: rgba(52, 199, 89, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

/* Toast Notification */
.player-toast {
    background: rgba(28, 28, 30, 0.9);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 0.75rem 1.25rem;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    animation: toast-slide-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Error Container */
.player-error-glass {
    background: rgba(28, 28, 30, 0.85);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 2rem;
    max-width: 400px;
    text-align: center;
}

.player-error-glass .error-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: #ff3b30;
    filter: drop-shadow(0 0 10px rgba(255, 59, 48, 0.4));
}

.player-error-glass h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
}

.player-error-glass p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Menu Dropdown/Popover */
.player-menu-glass {
    background: rgba(28, 28, 30, 0.9);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 0.5rem;
    min-width: 180px;
    animation: menu-appear 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes menu-appear {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.player-menu-glass .menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: white;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.player-menu-glass .menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.player-menu-glass .menu-item.active {
    background: rgba(0, 122, 255, 0.2);
    color: var(--accent-color);
}

.player-menu-glass .menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 0;
}

/* Skip Indicator */
.skip-indicator-glass {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-2xl);
    padding: 1rem 1.5rem;
    color: white;
    font-weight: 600;
    animation: skip-pulse 0.3s ease-out;
}

@keyframes skip-pulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Focus States for Accessibility */
.btn-glass:focus-visible,
.btn-icon:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.5);
}

/* Progress Bar Enhanced */
.progress-bar-glass {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    overflow: hidden;
    cursor: pointer;
    transition: height 0.2s ease;
}

.progress-bar-glass:hover {
    height: 8px;
}

.progress-bar-glass .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #5ac8fa);
    border-radius: var(--radius-full);
    transition: width 0.1s linear;
}

/* Ensure control buttons are clickable above slider touch area */
.btn-icon {
    position: relative;
    z-index: 50;
    cursor: pointer;
    touch-action: manipulation;
}
