/* ========== BASE STYLES ========== */
        * { box-sizing: border-box; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
        body { 
            background: linear-gradient(145deg, #1e2b3a 0%, #0f172a 100%); 
            min-height: 100vh; 
            margin: 0; 
            display: flex; 
            justify-content: center; 
            align-items: center; 
            padding: 20px; 
        }
		
		ytm-custom-control .player-controls-middle.prevent-controls-collision {
		visibility: hidden;
		left: 200% !important;
		}
		
		ytm-custom-control .player-controls-middle .player-control-play-pause-icon.icon-button {
    height: 56px;
    width: 400px;
    padding: 3px;
    border-radius: 10%;
}
		
		
        .player-container { 
            max-width: 1200px; 
            width: 100%; 
            display: flex; 
            gap: 20px; 
            flex-wrap: wrap; 
            justify-content: center; 
        }
        .player { 
            flex: 2; 
            min-width: 600px; 
            background: #000; 
            border-radius: 24px; 
            overflow: hidden; 
            box-shadow: 0 25px 40px rgba(0,0,0,0.6); 
            border: 1px solid #334155; 
        }
        .playlist-panel { 
            flex: 1; 
            min-width: 280px; 
            background: #0f172a; 
            border-radius: 24px; 
            border: 1px solid #334155; 
            overflow: hidden; 
            display: flex; 
            flex-direction: column; 
            box-shadow: 0 25px 40px rgba(0,0,0,0.4); 
            height: fit-content; 
        }
        .playlist-header { 
            padding: 16px; 
            background: #1e293b; 
            border-bottom: 1px solid #334155; 
            display: flex; 
            justify-content: space-between; 
            align-items: center; 
        }
        .playlist-header h3 { 
            margin: 0; 
            color: #f1f5f9; 
            font-size: 0.8rem; 
        }
        .playlist-toggle { 
            background: #2d3b4f; 
            border: 1px solid #475569; 
            color: white; 
            padding: 4px 10px; 
            border-radius: 20px; 
            cursor: pointer; 
            font-size: 0.9rem; 
        }
        .playlist-items { 
            list-style: none; 
            margin: 0; 
            padding: 8px; 
            max-height: 400px; 
            overflow-y: auto; 
        }
        .playlist-items li { 
            padding: 10px 12px; 
            margin: 4px 0; 
            background: #1e293b; 
            border-radius: 12px; 
            color: #e2e8f0; 
            cursor: pointer; 
            border: 1px solid #334155; 
            transition: all 0.1s; 
            font-size: 0.9rem; 
            white-space: nowrap; 
            overflow: hidden; 
            text-overflow: ellipsis; 
        }
        .playlist-items li:hover { 
            background: #2d3b4f; 
            border-color: #5f6b7a; 
        }
        .playlist-items li.active { 
            background: #2e7d32; 
            border-color: #6aab6a; 
        }
        .add-video { 
            padding: 16px; 
            border-top: 1px solid #334155; 
            display: flex; 
            gap: 8px; 
            background: #1e293b; 
        }
        .add-video input { 
            flex: 1; 
            background: #0f172a; 
            border: 1px solid #475569; 
            color: white; 
            padding: 8px 12px; 
            border-radius: 40px; 
            font-size: 0.9rem; 
        }
        .add-video input:focus { 
            outline: none; 
            border-color: #3b82f6; 
        }
        .add-video button { 
            background: #2e7d32; 
            border: none; 
            color: white; 
            padding: 8px 16px; 
            border-radius: 40px; 
            cursor: pointer; 
            font-weight: bold; 
        }
        .add-video button:hover { 
            background: #3e9142; 
        }
        .video-wrapper { 
            position: relative; 
            width: 100%; 
            aspect-ratio: 16 / 9; 
            background: #0b0f17; 
            cursor: pointer;
        }
        .error-message { 
            position: absolute; 
            top: 0; 
            left: 0; 
            width: 100%; 
            height: 100%; 
            background: rgba(0,0,0,0.9); 
            color: #ffaa00; 
            display: flex; 
            flex-direction: column; 
            justify-content: center; 
            align-items: center; 
            z-index: 20; 
            padding: 20px; 
            text-align: center; 
            font-size: 1.2rem; 
        }
        .error-message a { 
            color: #3b82f6; 
            text-decoration: underline; 
            margin-top: 10px; 
        }
        .subtitle-overlay { 
            position: absolute; 
            bottom: 0; 
            left: 0; 
            width: 100%; 
            height: 20%; 
            background: #000000; 
            display: block;
            z-index: 33;  
            transition: height 0.1s ease; 
        }


		
        .controls { 
            background: #0f172a; 
            padding: 14px 20px; 
            display: flex; 
            flex-wrap: wrap; 
            align-items: center; 
            gap: 12px 16px; 
            color: #f1f5f9; 
            border-top: 1px solid #334155; 
        }
        .controls button { 
            background: #1e293b; 
            border: none; 
            color: #f1f5f9; 
            font-size: 1rem; 
            font-weight: 500; 
            padding: 8px 14px; 
            border-radius: 40px; 
            cursor: pointer; 
            display: inline-flex; 
            align-items: center; 
            gap: 6px; 
            transition: all 0.15s ease; 
            border: 1px solid #475569; 
            box-shadow: 0 2px 5px rgba(0,0,0,0.3); 
            white-space: nowrap; 
        }
        .controls button:hover { 
            background: #2d3b4f; 
            border-color: #64748b; 
            transform: scale(1.02); 
        }
        .time { 
            font-family: 'Courier New', monospace; 
            font-size: 1rem; 
            background: #020617; 
            padding: 6px 12px; 
            border-radius: 40px; 
            border: 1px solid #334155; 
        }
        .progress-container { 
            flex: 1; 
            min-width: 200px; 
            display: flex; 
            align-items: center; 
            gap: 10px; 
        }
        .progress-bar { 
            flex: 1; 
            height: 8px; 
            background: #334155; 
            border-radius: 10px; 
            cursor: pointer; 
        }
        .progress-fill { 
            height: 100%; 
            width: 0%; 
            background: linear-gradient(90deg, #3b82f6, #a855f7); 
            border-radius: 10px; 
            transition: width 0.1s linear; 
            pointer-events: none; 
        }
        .volume-control { 
            display: flex; 
            align-items: center; 
            gap: 8px; 
        }
        .volume-control input { 
            width: 90px; 
            accent-color: #3b82f6; 
        }
        .rewind-config { 
            display: flex; 
            align-items: center; 
            gap: 6px; 
            background: #1e293b; 
            padding: 4px 10px; 
            border-radius: 40px; 
            border: 1px solid #475569; 
        }
        .rewind-config label { 
            font-size: 0.85rem; 
            color: #94a3b8; 
        }
        .rewind-config input { 
            width: 60px; 
            background: #0f172a; 
            border: 1px solid #334155; 
            color: white; 
            padding: 4px 8px; 
            border-radius: 20px; 
            text-align: center; 
            font-weight: bold; 
        }
        .height-control { 
            display: flex; 
            align-items: center; 
            gap: 2px; 
            background: #1e293b; 
            padding: 2px 2px; 
            border-radius: 40px; 
            border: 1px solid #475569; 
        }
        .height-control button { 
            padding: 4px 10px; 
            font-size: 1.2rem; 
            min-width: 30px; 
        }
        .height-control span { 
            min-width: 45px; 
            text-align: center; 
            font-size: 0.85rem; 
            color: #94a3b8; 
        }
        .subtitle-btn.active { 
            background: #2e7d32; 
            border-color: #6aab6a; 
        }

     
        /* Add Google Font for better typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Base Styles with improved visuals */
:root {
    --primary-gradient: linear-gradient(145deg, #1e2b3a 0%, #0f172a 100%);
    --accent-gradient: linear-gradient(90deg, #3b82f6, #a855f7);
    --button-gradient: linear-gradient(145deg, #1e293b, #0f172a);
    --button-hover-gradient: linear-gradient(145deg, #2d3b4f, #1e293b);
    --glow-effect: 0 0 20px rgba(59, 130, 246, 0.3);
    --border-glow: 0 0 10px rgba(59, 130, 246, 0.2);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background: var(--primary-gradient);
    min-height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Player Container with animation */
.player-container {
    max-width: 1400px;
    width: 100%;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Player with enhanced visuals */
.player {
    flex: 2;
    min-width: 600px;
    background: #000;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 50px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: var(--transition-smooth);
}

.player:hover {
    box-shadow: 0 30px 60px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}

/* Playlist Panel with glass morphism effect */
.playlist-panel {
    flex: 1;
    min-width: 300px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 28px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 50px rgba(0, 0, 0, 0.5);
    height: fit-content;
    transition: var(--transition-smooth);
}

.playlist-panel:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

/* Enhanced Header */
.playlist-header {
    padding: 20px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist-header h3 {
    margin: 0;
    color: #f1f5f9;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.playlist-toggle {
    background: var(--button-gradient);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: white;
    padding: 6px 14px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.playlist-toggle:hover {
    background: var(--button-hover-gradient);
    border-color: #3b82f6;
    box-shadow: var(--border-glow);
    transform: translateY(-2px);
}

/* Playlist Items with animations */
.playlist-items {
    list-style: none;
    margin: 0;
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 #1e293b;
	direction: rtl;
}

.playlist-items::-webkit-scrollbar {
    width: 6px;
}

.playlist-items::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 10px;
}

.playlist-items::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 10px;
}

.playlist-items li {
    padding: 12px 16px;
    margin: 6px 0;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(5px);
    border-radius: 16px;
    color: #e2e8f0;
    cursor: pointer;
    border: 1px solid rgba(59, 130, 246, 0.1);
    transition: var(--transition-smooth);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    z-index: 1;
}

.playlist-items li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-gradient);
    border-radius: 16px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.playlist-items li:hover {
    transform: translateX(5px);
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: var(--border-glow);
}

.playlist-items li:hover::before {
    opacity: 0.1;
}

.playlist-items li.active {
    background: rgba(46, 125, 50, 0.3);
    border-color: #4caf50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

/* Enhanced Add Video Section */
.add-video {
    padding: 20px;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    display: flex;
    gap: 10px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(5px);
}

.add-video input {
    flex: 1;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: white;
    padding: 10px 16px;
    border-radius: 30px;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.add-video input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.add-video button {
    background: linear-gradient(145deg, #2e7d32, #1e5f22);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}

.add-video button:hover {
    background: linear-gradient(145deg, #3e9142, #2e7d32);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

/* Video Wrapper */
.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0b0f17;
    cursor: pointer;
    transition: var(--transition-smooth);
}

/* Enhanced Controls */
.controls {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    color: #f1f5f9;
    border-top: 1px solid rgba(59, 130, 246, 0.2);
}

.controls button {
    background: var(--button-gradient);
    border: none;
    color: #f1f5f9;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.controls button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.controls button:hover::before {
    width: 300px;
    height: 300px;
}

.controls button:hover {
    background: var(--button-hover-gradient);
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
}

/* ===== RESPONSIVE STYLES ===== */

/* Large Tablets */
@media screen and (max-width: 1024px) {
    .player {
        min-width: 500px;
    }
    
    .controls {
        padding: 14px 20px;
        gap: 10px 16px;
    }
    
    .controls button {
        padding: 7px 14px;
        font-size: 0.9rem;
    }
    
    .time {
        font-size: 0.9rem;
        padding: 5px 10px;
    }
    
    .volume-control input {
        width: 80px;
    }
}

/* Tablets */
@media screen and (max-width: 768px) {
    body {
        padding: 15px;
        align-items: flex-start;
    }
    
    .player-container {
        gap: 18px;
    }
    
    .player {
        min-width: 100%;
        border-radius: 24px;
    }
    
    .playlist-panel {
        min-width: 100%;
        border-radius: 24px;
    }
    
    .controls {
        padding: 12px 18px;
        gap: 8px 14px;
    }
    
    .controls button {
        padding: 6px 12px;
        font-size: 0.85rem;
        gap: 6px;
    }
    
    .progress-container {
        min-width: 150px;
    }
    
    .volume-control input {
        width: 70px;
    }
    
    .rewind-config input {
        width: 50px;
    }
}

/* Mobile Landscape */
@media screen and (max-width: 640px) and (orientation: landscape) {
    .playlist-items {
        max-height: 150px;
    }
    
    .player-container {
        gap: 12px;
    }
    
    .controls {
        padding: 8px 12px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* Mobile Portrait - Primary responsive breakpoint */
@media screen and (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .player-container {
        gap: 12px;
    }
    
    .player {
        border-radius: 20px;
        min-width: 100%;
    }
    
    .playlist-panel {
        border-radius: 20px;
    }
    
    .playlist-header {
        padding: 14px;
    }
    
    .playlist-header h3 {
        font-size: 1.1rem;
    }
    
    .playlist-toggle {
        padding: 4px 10px;
        font-size: 0.8rem;
    }
    
    .playlist-items {
        padding: 8px;
        max-height: 250px;
    }
    
    .playlist-items li {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .add-video {
        padding: 14px;
    }
    
    .add-video input {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .add-video button {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    /* Make buttons smaller on mobile */
    .controls {
        padding: 10px 12px;
        gap: 8px;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(70px, auto));
        justify-content: center;
    }
    
    .controls button {
        padding: 6px 8px;
        font-size: 0.75rem;
        gap: 4px;
        min-width: 65px;
        justify-content: center;
        border-radius: 25px;
    }
    
    /* Hide text on some buttons, show only icons */
    .controls button .icon {
        font-size: 1rem;
        margin-right: 0;
    }
    
    /* Keep full text on essential buttons */
    #playPauseBtn {
        min-width: 75px;
        padding: 6px 12px;
    }
    
    #toggleSubtitleBtn {
        min-width: 85px;
        font-size: 0.7rem;
    }
    
    /* Time display compact */
    .time {
        font-size: 0.75rem;
        padding: 4px 8px;
        min-width: 75px;
        text-align: center;
        background: #020617;
    }
    
    /* Progress bar container */
    .progress-container {
        min-width: 100%;
        order: -1;
        margin-bottom: 5px;
    }
    
    .progress-bar {
        height: 6px;
    }
    
    /* Compact volume control */
    .volume-control {
        gap: 4px;
    }
    
    .volume-control input {
        width: 60px;
    }
    
    /* Compact rewind config */
    .rewind-config {
        padding: 2px 6px;
    }
    
    .rewind-config label {
        font-size: 0.65rem;
    }
    
    .rewind-config input {
        width: 40px;
        padding: 2px 4px;
        font-size: 0.7rem;
    }
    
    /* Compact height control */
    .height-control {
        padding: 2px 4px;
    }
    
    .height-control button {
        padding: 2px 6px;
        font-size: 1rem;
        min-width: 24px;
    }
    
    .height-control span {
        min-width: 35px;
        font-size: 0.7rem;
    }
    
    /* Improve touch targets */
    .controls button,
    .playlist-toggle,
    .add-video button,
    .playlist-items li {
        min-height: 40px;
    }
}

/* Small Mobile */
@media screen and (max-width: 360px) {
    .controls {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .controls button {
        padding: 5px 6px;
        font-size: 0.7rem;
        min-width: 55px;
    }
    
    #playPauseBtn {
        min-width: 65px;
    }
    
    #toggleSubtitleBtn {
        min-width: 75px;
        font-size: 0.65rem;
    }
    
    .time {
        font-size: 0.7rem;
        padding: 3px 6px;
        min-width: 65px;
    }
    
    .volume-control input {
        width: 50px;
    }
    
    .rewind-config input {
        width: 35px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .controls button:hover,
    .playlist-items li:hover,
    .add-video button:hover,
    .playlist-toggle:hover {
        transform: none;
        background: var(--button-gradient);
    }
    
    .controls button:active,
    .playlist-items li:active,
    .add-video button:active,
    .playlist-toggle:active {
        transform: scale(0.95);
        background: var(--button-hover-gradient);
    }
    
    .controls button::before {
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .controls button,
    .playlist-items li,
    .add-video input,
    .rewind-config input {
        border-width: 2px;
    }
    
    .progress-fill {
        background: #3b82f6;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}