/* ========================================
   DOUG'S VIDEO MAKER - PREMIUM DARK THEME
   ======================================== */

:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-glass: rgba(20, 20, 30, 0.8);

    --accent-cyan: #00ffff;
    --accent-magenta: #ff00ff;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-orange: #f97316;

    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #64748b;

    --border-color: rgba(255, 255, 255, 0.1);
    --glow-cyan: 0 0 20px rgba(0, 255, 255, 0.5);
    --glow-magenta: 0 0 20px rgba(255, 0, 255, 0.5);

    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 0, 255, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    padding: 1rem 2rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.logo h1 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.header-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
    padding: 1.5rem;
    max-height: calc(100vh - 140px);
}

/* ========================================
   VIDEO PREVIEW SECTION
   ======================================== */
.preview-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.video-container {
    position: relative;
    flex: 1;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid var(--border-color);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container::before {
    content: '📷 Click "Start Camera" to begin';
    position: absolute;
    font-size: 1.25rem;
    color: var(--text-muted);
    z-index: 1;
}

.video-container.active::before {
    display: none;
}

#webcamVideo {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    display: none;
}

#effectCanvas {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.text-overlay-preview {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
    pointer-events: none;
    font-weight: bold;
    text-shadow: 0 0 20px currentColor, 0 2px 4px rgba(0, 0, 0, 0.8);
}

.text-overlay-preview.top {
    top: 20px;
}

.text-overlay-preview.center {
    top: 50%;
    transform: translateY(-50%);
}

.text-overlay-preview.bottom {
    bottom: 20px;
}

/* Text Animations */
.text-overlay-preview.anim-pulse {
    animation: textPulse 1s ease-in-out infinite;
}

.text-overlay-preview.anim-shake {
    animation: textShake 0.5s ease-in-out infinite;
}

.text-overlay-preview.anim-glow {
    animation: textGlow 1.5s ease-in-out infinite;
}

.text-overlay-preview.anim-rainbow {
    animation: textRainbow 3s linear infinite;
}

@keyframes textPulse {

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

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes textShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

@keyframes textGlow {

    0%,
    100% {
        text-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
    }

    50% {
        text-shadow: 0 0 40px currentColor, 0 0 80px currentColor, 0 0 120px currentColor;
    }
}

@keyframes textRainbow {
    0% {
        filter: hue-rotate(0deg);
    }

    100% {
        filter: hue-rotate(360deg);
    }
}

/* Recording Indicator */
.recording-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 20;
    animation: recBlink 1s infinite;
}

.recording-indicator.hidden {
    display: none;
}

.rec-dot {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: recDot 1s infinite;
}

@keyframes recBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes recDot {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

/* Control Bar */
.control-bar {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.25rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: var(--bg-primary);
    box-shadow: var(--glow-cyan);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.7);
}

.btn-record {
    background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
    color: white;
}

.btn-record:hover:not(:disabled) {
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.7);
}

.btn-stop {
    background: var(--accent-red);
    color: white;
}

.btn-download {
    background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
    color: var(--bg-primary);
}

.btn-download:hover:not(:disabled) {
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.7);
}

.hidden {
    display: none !important;
}

/* ========================================
   EFFECTS PANEL
   ======================================== */
.effects-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
    background: rgba(0, 255, 255, 0.1);
}

.tab-content {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

/* Effects Grid */
.effects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.effect-btn,
.warp-btn,
.voice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.effect-btn:hover,
.warp-btn:hover,
.voice-btn:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 255, 255, 0.1);
    transform: scale(1.02);
}

.effect-btn.active,
.warp-btn.active,
.voice-btn.active {
    border-color: var(--accent-magenta);
    background: rgba(255, 0, 255, 0.2);
    box-shadow: var(--glow-magenta);
}

.effect-icon {
    font-size: 1.5rem;
}

.effect-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

/* Effect Controls */
.effect-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.effect-controls label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.effect-controls input[type="range"] {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

.effect-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Text Controls */
.text-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-group input[type="text"],
.form-group select {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    border-color: var(--accent-cyan);
}

.form-group input[type="color"] {
    width: 100%;
    height: 40px;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
}

.form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    accent-color: var(--accent-cyan);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    padding: 1rem 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: var(--accent-cyan);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .effects-panel {
        max-height: 400px;
    }

    .header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .control-bar {
        flex-wrap: wrap;
    }

    .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
}

@media (max-width: 500px) {
    .effects-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .effect-btn,
    .warp-btn,
    .voice-btn {
        padding: 0.75rem 0.25rem;
    }

    .effect-icon {
        font-size: 1.25rem;
    }

    .effect-name {
        font-size: 0.65rem;
    }
}