:root {
    --bg-base: #0a0e17;
    --bg-surface: #111827;
    --bg-surface-elevated: #1a2234;
    --bg-surface-hover: #222d42;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.16);
    
    --primary: #ff0033;
    --primary-hover: #e6002e;
    --primary-glow: rgba(255, 0, 51, 0.25);
    
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.25);
    
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --text-dim: #6b7280;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Ambient glow in background */
.ambient-glow {
    position: fixed;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 0, 51, 0.12) 0%, rgba(99, 102, 241, 0.08) 50%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    filter: blur(80px);
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 14, 23, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ff0033 0%, #cc0029 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.brand-text h1 span {
    color: var(--primary);
}

.badge {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.render-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #a7f3d0;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    text-decoration: none;
    transition: var(--transition);
}

.render-pill:hover {
    background: rgba(16, 185, 129, 0.18);
    transform: translateY(-1px);
}

.dot {
    width: 7px;
    height: 7px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Main Container */
.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    width: 100%;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Flash alerts */
.flash-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.flash-alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    animation: slideDown 0.3s ease-out;
}

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

/* Control Card */
.control-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px);
}

.url-form {
    width: 100%;
}

.input-group {
    display: flex;
    align-items: center;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.5rem 0.4rem 1rem;
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
    color: var(--text-dim);
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
}

.input-group input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    min-width: 0;
}

.input-group input::placeholder {
    color: var(--text-dim);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.4rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 0, 51, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Quick Presets */
.presets-section {
    margin-top: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.presets-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.presets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preset-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    text-decoration: none;
    transition: var(--transition);
}

.preset-chip:hover {
    color: var(--text-main);
    background: var(--bg-surface-hover);
    border-color: var(--border-highlight);
    transform: translateY(-1px);
}

.preset-chip.active {
    background: rgba(255, 0, 51, 0.15);
    color: #ff8099;
    border-color: rgba(255, 0, 51, 0.35);
    font-weight: 500;
}

/* Player Card */
.player-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    transition: var(--transition);
}

.player-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.video-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.info-label {
    color: var(--text-dim);
}

.info-code {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    color: #38bdf8;
    font-family: monospace;
    font-size: 0.85rem;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--bg-surface-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
}

.tool-btn:hover {
    color: var(--text-main);
    background: var(--bg-surface-hover);
    border-color: var(--border-highlight);
}

/* Responsive 16:9 Video Embed Wrapper */
.video-responsive-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: #000;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.video-responsive-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Theater Mode */
.theater-mode {
    max-width: 100% !important;
}

.player-card.theater {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6), 0 0 30px var(--accent-glow);
}

/* Footer / Info Panel */
.info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-top: 0.5rem;
}

.feature-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.feature-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.feature-item h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.feature-item p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.feature-item code {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    color: #e5e7eb;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #10b981;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive queries */
@media (max-width: 640px) {
    .main-wrapper {
        padding: 1.25rem 1rem 3rem;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .input-group input {
        width: 100%;
        padding: 0.4rem 0;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .player-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}
