:root {
    --bg-color: #0b0914;
    --text-main: #ffffff;
    --text-muted: #a0a0b0;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary-glow: rgba(255, 65, 108, 0.4);
    --accent-1: #ff416c;
    --accent-2: #ff4b2b;
    --border-radius-lg: 24px;
    --border-radius-md: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Animated Background */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: linear-gradient(-45deg, #050505, #1a0b1c, #0d0a20, #050505);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

.background-animation::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(255, 65, 108, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(255, 75, 43, 0.1), transparent 25%);
    filter: blur(40px);
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

header {
    text-align: center;
    animation: fadeInDown 1s ease-out;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

h1.glitch-text {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, var(--accent-1), var(--accent-2), #ff9068);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 4s linear infinite;
    text-shadow: 0 0 30px var(--primary-glow);
}

@keyframes shine {
    to { background-position: 200% center; }
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 1s ease-out 0.2s both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Input Group */
.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (max-width: 600px) {
    .input-group {
        flex-direction: column;
    }
}

.input-wrapper {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1.2rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.input-wrapper:focus-within .input-icon {
    color: var(--accent-1);
}

input[type="url"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    padding: 1rem 1rem 1rem 3rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

input[type="url"]:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 15px rgba(255, 65, 108, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

input[type="url"]::placeholder {
    color: #666;
}

button {
    background: linear-gradient(45deg, var(--accent-1), var(--accent-2));
    color: white;
    border: none;
    padding: 0 2rem;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition);
    height: 54px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--accent-2), var(--accent-1));
    z-index: -1;
    transition: opacity 0.3s ease;
    opacity: 0;
}

button:hover::before {
    opacity: 1;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 65, 108, 0.4);
}

button:active {
    transform: translateY(1px);
}

/* Video Player */
.video-container {
    border-radius: var(--border-radius-md);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--glass-border);
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    aspect-ratio: 16/9;
}

.video-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

video {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
}

/* Customizing basic controls where possible */
video::-webkit-media-controls-panel {
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

/* States */
.hidden {
    display: none !important;
}

.error-message {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 65, 65, 0.1);
    border-left: 4px solid #ff4141;
    color: #ff8888;
    border-radius: 4px;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 65, 108, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-1);
    animation: spin 1s ease-in-out infinite;
}

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

/* Quality Selector */
.quality-container {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.2rem 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.quality-container:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--accent-1);
}

.quality-selector {
    background: transparent;
    color: var(--text-main);
    border: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 15px;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 8px auto;
}

.quality-selector option {
    background: var(--bg-color);
    color: var(--text-main);
}

/* Custom Video Controls */
.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.video-wrapper:hover .custom-controls,
.video-wrapper.active .custom-controls {
    opacity: 1;
    pointer-events: all;
}

.control-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: var(--transition);
    padding: 0;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
    color: var(--accent-1);
    box-shadow: none;
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

.timeline-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    position: relative;
    height: 20px;
    cursor: pointer;
}

/* Custom Range Input */
input[type="range"]#timeline {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    padding: 0;
    border: none;
    margin: 0;
    box-shadow: none;
    cursor: pointer;
    position: relative;
    transition: height 0.2s;
}

.timeline-container:hover input[type="range"]#timeline {
    height: 8px;
}

/* The thumb */
input[type="range"]#timeline::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-1);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 65, 108, 0.8);
    transition: transform 0.2s;
}

input[type="range"]#timeline::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--accent-1);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 65, 108, 0.8);
    transition: transform 0.2s;
}

.timeline-container:hover input[type="range"]#timeline::-webkit-slider-thumb {
    transform: scale(1.3);
}

.timeline-container:hover input[type="range"]#timeline::-moz-range-thumb {
    transform: scale(1.3);
}

/* Time display */
.time-display {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
    user-select: none;
    min-width: 90px;
    text-align: right;
    letter-spacing: 0.5px;
}
