/* Custom Video Player Styling */
:root {
    --player-primary: #CC0000;
    --player-overlay: rgba(0, 0, 0, 0.7);
    --player-glass: rgba(20, 20, 20, 0.85);
    --player-text: #ffffff;
    --player-accent: #ff4d4d;
}

.custom-video-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 60px auto;
    background: #000;
    border-radius: 16px;
    /* overflow: visible to allow glow */
    font-family: 'Outfit', sans-serif;
    aspect-ratio: 16 / 9;
}

/* Ambient Light Effect */
.ambient-light {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background: transparent;
    filter: blur(80px) opacity(0.5);
    z-index: -1;
    pointer-events: none;
    transition: opacity 1s ease;
    border-radius: 20px;
}

.player-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 16px;
    z-index: 5;
}

.custom-video-container video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    position: relative;
    z-index: 1;
}



/* Controls Overlay */
.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.95));
    padding: 25px 20px 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 15;
}

.custom-video-container:hover .video-controls,
.custom-video-container.show-controls .video-controls {
    opacity: 1;
    transform: translateY(0);
}

.custom-video-container.hide-cursor {
    cursor: none;
}


/* Progress Bar */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: height 0.2s ease;
}

.progress-container:hover {
    height: 8px;
}

.progress-bar {
    height: 100%;
    background: var(--player-primary);
    width: 0%;
    border-radius: 3px;
    position: relative;
    z-index: 3;
}

.buffer-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    width: 0%;
    border-radius: 3px;
    z-index: 2;
}


.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.progress-container:hover .progress-bar::after {
    opacity: 1;
}

/* Control Buttons */
.controls-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.control-btn:hover {
    color: var(--player-accent);
    transform: scale(1.1);
}

/* Volume Control */
.volume-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    width: 0;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.3);

    border-radius: 2px;
    transition: width 0.3s ease;
    overflow: hidden;
}

.volume-container:hover .volume-slider {
    width: 80px;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    box-shadow: -80px 0 0 80px var(--player-primary);
}


/* Time Display */
.time-display {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Playlist Panel */
.playlist-panel {
    position: absolute;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: var(--player-glass);
    backdrop-filter: blur(15px);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.playlist-panel.active {
    right: 0;
}

.playlist-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
}

.playlist-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.playlist-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-bottom: 8px;
}

.playlist-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.playlist-item.active {
    background: rgba(204, 0, 0, 0.2);
    border-left: 3px solid var(--player-primary);
}

.item-thumb {
    width: 80px;
    aspect-ratio: 16 / 9;
    background: #333;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.item-thumb i {
    color: var(--player-primary);
    font-size: 1.2rem;
}

.item-info {
    flex: 1;
}

.item-title {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}


.item-duration {
    color: #aaa;
    font-size: 0.75rem;
}

/* Up Next Overlay */
.up-next-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.up-next-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.up-next-content {
    text-align: center;
    color: #fff;
    max-width: 400px;
}

.up-next-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--player-primary);
    margin-bottom: 10px;
}

.up-next-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.timer-circle {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
}

.timer-svg {
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 4;
}

.timer-progress {
    fill: none;
    stroke: var(--player-primary);
    stroke-width: 4;
    stroke-dasharray: 251.2;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s linear;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    font-weight: 700;
}

.up-next-btns {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-play-now {
    background: var(--player-primary);
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-play-now:hover {
    background: #e60000;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Scrollbar styling for playlist */
.playlist-items::-webkit-scrollbar {
    width: 6px;
}

.playlist-items::-webkit-scrollbar-track {
    background: transparent;
}

.playlist-items::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Center Overlay (Loading & State) */
.center-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 12;
    pointer-events: auto;
    /* Enable interaction */
}


.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top: 5px solid var(--player-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.center-icon {
    font-size: 50px;
    color: #fff;
    background: rgba(204, 0, 0, 0.85);
    /* Premium red brand color */
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.center-icon i {
    margin-left: 5px;
    /* Adjust for play icon visual centering */
}

/* Persistent center button when paused */
.custom-video-container.paused .center-icon {
    opacity: 1;
    transform: scale(1);
}

/* Interactive hover effects */
.center-icon:hover {
    transform: scale(1.1);
    background: var(--player-primary);
    box-shadow: 0 0 40px rgba(204, 0, 0, 0.4);
}

.center-icon.active {
    opacity: 1;
    transform: scale(1.2);
}


/* Settings Dropdown */
.settings-menu {
    position: absolute;
    bottom: 70px;
    right: 20px;
    background: var(--player-glass);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 10px;
    display: none;
    flex-direction: column;
    width: 180px;
    z-index: 25;
}

.settings-menu.active {
    display: flex;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
}

.settings-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-item i {
    font-size: 0.8rem;
}


/* Toast Notifications */
.player-toast {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 40;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-toast.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Theater Mode - Improved Layout */
.custom-video-container.theater-mode {
    max-width: 1100px;
    width: 120%;
    margin-left: -10%;
    z-index: 100;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.8), 0 0 20px rgba(204, 0, 0, 0.2);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-video-container.theater-mode .player-wrapper {
    border-radius: 12px;
}

/* Custom Theater Icon placeholder */
.theater-icon-svg {
    width: 18px;
    height: 14px;
    border: 1.5px solid currentColor;
    border-radius: 1px;
    position: relative;
    display: inline-block;
}

.theater-icon-svg::after {
    content: '';
    position: absolute;
    top: 1px;
    bottom: 1px;
    right: 1px;
    width: 3px;
    background: currentColor;
    opacity: 0.5;
}

@media (max-width: 1200px) {
    .custom-video-container.theater-mode {
        width: 100%;
        margin-left: 0;
    }
}

/* Custom Context Menu */
.player-context-menu {
    position: fixed;
    background: var(--player-glass);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    min-width: 200px;
    z-index: 200;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: menuFade 0.2s ease-out;
}

@keyframes menuFade {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

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

.context-menu-item {
    padding: 10px 15px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

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

.context-menu-item i {
    font-size: 0.85rem;
    width: 16px;
    text-align: center;
    color: var(--player-primary);
}

.context-menu-header {
    padding: 8px 15px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 5px;
}

@media (max-width: 768px) {

    .ambient-light {
        display: none;
    }

    .custom-video-container {
        border-radius: 0;
        margin: 20px 0;
    }

    .custom-video-container.theater-mode {
        width: 100%;
        margin: 10px 0;
    }

    .playlist-panel {
        width: 100%;
        right: -100%;
    }

    .controls-main {
        gap: 10px;
    }

    .volume-container {
        display: none;
    }
}