/* ==========================================================================
   CYRANDEIRO FORRÓ STUDIO - COREÓGRAFO VISUAL INTERATIVO (MVP)
   Design System & Premium Aesthetics (Dark Mode + Gold DNA)
   ========================================================================== */

:root {
    --bg-primary: #0a0b0e;
    --bg-surface: rgba(18, 20, 26, 0.75);
    --bg-panel: rgba(26, 29, 38, 0.85);
    --gold-primary: #FFD700;
    --gold-glow: rgba(255, 215, 0, 0.4);
    --gold-gradient: linear-gradient(135deg, #FFD700 0%, #F3A953 100%);
    --accent-red: #FF3B30;
    --accent-red-glow: rgba(255, 59, 48, 0.5);
    --text-primary: #FFFFFF;
    --text-secondary: #A0A5B5;
    --border-glass: rgba(255, 255, 255, 0.12);
    --border-gold: rgba(255, 215, 0, 0.35);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 8px;
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- 1. Top Brand Header --- */
.top-header {
    height: 64px;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(8, 10, 14, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(180deg, #F5D77F 0%, #C4973B 50%, #6E5014 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.9));
}

.tagline {
    font-size: 11px;
    color: #8E94A5;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid var(--border-glass);
    font-size: 12px;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #34C759;
    box-shadow: 0 0 8px #34C759;
}

/* --- 2. Main Viewport Container (Camera + Canvas) --- */
.viewport-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: calc(100vh - 64px - 140px);
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#cameraStream {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 10;
}

#overlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none; /* Allows clicks to pass through if needed */
}

/* Countdown Overlay */
.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 40;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.2s ease;
}

.countdown-number {
    font-family: var(--font-heading);
    font-size: 160px;
    font-weight: 900;
    color: var(--gold-primary);
    text-shadow: 0 0 40px var(--gold-glow);
    animation: scalePulse 0.9s infinite cubic-bezier(0.1, 0.8, 0.3, 1);
}

@keyframes scalePulse {
    0% { transform: scale(1.4); opacity: 0; }
    30% { transform: scale(1); opacity: 1; }
    80% { transform: scale(0.95); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0; }
}

/* Recording Badge */
.recording-badge {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 59, 48, 0.9);
    padding: 8px 18px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    box-shadow: 0 0 20px var(--accent-red-glow);
    z-index: 30;
}

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

@keyframes blink {
    50% { opacity: 0; }
}

.hidden {
    display: none !important;
}

/* --- 3. Interactive Floating Control Deck (Glassmorphism) --- */
/* --- 3. Interactive Floating Control Deck (Glassmorphism Studio Glow Up) --- */
.control-deck {
    height: 155px;
    background: rgba(6, 8, 12, 0.92);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border-top: 1px solid rgba(255, 215, 0, 0.2);
    padding: 14px 24px;
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 18px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
    z-index: 50;
}

.control-panel {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.control-panel:hover {
    border-color: rgba(255, 215, 0, 0.25);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #9CA3AF;
}

/* Audio Selector & BPM */
.styled-select {
    width: 100%;
    background: rgba(15, 18, 25, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    padding: 8px 12px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.styled-select:focus {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.bpm-display {
    font-family: var(--font-heading);
    color: #FFD700;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.bpm-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.styled-slider {
    flex: 1;
    accent-color: #FFD700;
    cursor: pointer;
}

.btn-icon, .btn-tap {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-tap {
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.4);
    color: #FFD700;
}

.btn-icon:hover, .btn-tap:hover {
    background: #FFD700;
    border-color: #FFD700;
    color: #000000;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

/* Mode Buttons */
.mode-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    height: 100%;
    align-items: center;
}

.btn-mode {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    color: var(--text-secondary);
}

.mode-icon {
    font-size: 18px;
}

.mode-label {
    font-size: 11px;
    font-weight: 600;
}

.btn-mode:hover {
    border-color: rgba(255, 215, 0, 0.5);
    color: var(--text-primary);
}

.btn-mode.active {
    background: var(--gold-gradient);
    color: #000;
    border-color: transparent;
    box-shadow: 0 0 15px var(--gold-glow);
    font-weight: 700;
    transform: translateY(-2px);
}

/* Action Panel Buttons */
.action-panel {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 10px;
    padding: 10px !important;
}

.btn-action {
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-test {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

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

.btn-record {
    background: var(--accent-red);
    color: #FFF;
    box-shadow: 0 0 20px var(--accent-red-glow);
}

.btn-record:hover {
    background: #FF2419;
    transform: scale(1.02);
}

.btn-record.is-recording {
    background: #FFF;
    color: #000;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.6);
}

/* --- 4. Modal Styles --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.glass-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.glass-card h2 {
    font-family: var(--font-heading);
    color: var(--gold-primary);
    margin-bottom: 8px;
}

.glass-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.video-preview-wrapper {
    width: 100%;
    max-height: 350px;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--border-glass);
}

.video-preview-wrapper video {
    width: 100%;
    height: 100%;
    max-height: 350px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--gold-gradient);
    color: #000;
    box-shadow: 0 0 20px var(--gold-glow);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #FFF;
    border: 1px solid var(--border-glass);
}

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

/* --- 5. Mobile Responsiveness --- */
@media (max-width: 768px) {
    .top-header {
        height: 56px;
        padding: 0 14px;
    }

    .brand-title {
        font-size: 16px;
        letter-spacing: 2px;
    }

    .tagline {
        font-size: 9.5px;
        letter-spacing: 1px;
    }

    .status-badge {
        padding: 4px 10px;
        font-size: 11px;
    }

    .control-deck {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 48vh;
        overflow-y: auto;
        gap: 10px;
        padding: 12px 14px;
        border-radius: 20px 20px 0 0;
    }

    .control-panel {
        padding: 10px 12px;
        border-radius: 12px;
    }

    .mode-buttons {
        gap: 4px;
    }

    .btn-mode {
        padding: 6px 2px;
    }

    .mode-icon {
        font-size: 12px;
    }

    .mode-label {
        font-size: 10px;
    }

    .action-panel {
        flex-direction: row;
        gap: 8px;
    }

    .btn-action {
        padding: 12px 10px;
        font-size: 12px;
    }

    .glass-card {
        padding: 20px 16px;
    }
}
