/* ============================================
   DIAGNOSTIC TERMINAL - Cyberpunk Terminal Quiz
   ============================================ */

/* Variables */
:root {
    --terminal-bg: #0c0c0c;
    --terminal-surface: #121212;
    --terminal-border: #252525;
    --terminal-text: #e0e0e0;
    --terminal-muted: #555555;
    --terminal-accent: #ffffff;
    --terminal-success: #22c55e;
    --terminal-warning: #f97316;
    --terminal-error: #ef4444;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   MAIN CONTAINER
   ============================================ */

#diagnostic-terminal {
    background: var(--terminal-bg);
    padding: 60px 24px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    min-height: 100vh;
}

.terminal {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--terminal-surface);
    border: 1px solid var(--terminal-border);
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 550px;
}

/* ============================================
   TELEMETRY PANEL (Left)
   ============================================ */

.telemetry-stream {
    border-right: 1px solid var(--terminal-border);
    background: #0e0e0e;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.system-header {
    font-size: 9px;
    color: var(--terminal-muted);
    letter-spacing: 2px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--terminal-border);
}

/* Voice Transcript */
.voice-transcript-container {
    margin-bottom: 15px;
    border: 1px solid var(--terminal-border);
    background: rgba(255, 255, 255, 0.02);
    transition: height 0.3s ease;
}

.voice-transcript-container.collapsed {
    height: 40px;
    overflow: hidden;
}

.transcript-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--terminal-border);
    background: rgba(0, 0, 0, 0.3);
}

.transcript-label {
    font-size: 0.6rem;
    letter-spacing: 2px;
    color: var(--terminal-accent);
}

.transcript-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.transcript-toggle:hover {
    opacity: 1;
}

.transcript-output {
    padding: 12px;
    min-height: 100px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--terminal-text);
}

.transcript-line {
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
}

.transcript-line.muted {
    color: var(--terminal-muted);
    font-style: italic;
}

.transcript-line.speaking {
    color: var(--terminal-accent);
}

.transcript-line.typing::after {
    content: '▌';
    animation: blink 0.8s steps(2) infinite;
    margin-left: 2px;
}

.audio-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--terminal-accent);
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 1.5s infinite;
}

.separator-telemetry {
    height: 1px;
    background: var(--terminal-border);
    margin: 15px 0;
}

/* Log Stream */
.log-stream {
    flex-grow: 1;
    font-size: 9px;
    color: var(--terminal-muted);
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
}

.log-entry {
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

.log-entry.alert {
    color: var(--terminal-accent);
    font-weight: bold;
}

/* ============================================
   WORKSPACE (Right)
   ============================================ */

.diagnostic-workspace {
    padding: 35px;
    position: relative;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease;
    flex: 1;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ============================================
   LEAD CAPTURE SCREEN
   ============================================ */

.lead-capture-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 20px;
}

.access-header {
    margin-bottom: 40px;
    text-align: center;
}

.access-line {
    font-size: 0.75rem;
    color: var(--terminal-muted);
    letter-spacing: 2px;
    margin-bottom: 6px;
}

.capture-form {
    width: 100%;
    max-width: 380px;
}

.audio-test-status {
    margin-top: 12px;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.audio-test-status.muted {
    color: var(--terminal-muted);
}

.audio-test-status.success {
    color: var(--terminal-success);
}

.audio-test-status.error {
    color: var(--terminal-error);
}

.form-group {
    margin-bottom: 25px;
}

.terminal-label {
    display: block;
    font-size: 0.65rem;
    color: var(--terminal-muted);
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.terminal-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--terminal-border);
    color: var(--terminal-text);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px 0;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
}

.terminal-input:focus {
    border-bottom-color: var(--terminal-accent);
}

.terminal-input::placeholder {
    color: var(--terminal-muted);
    opacity: 0.5;
}

.form-consent {
    margin: 25px 0;
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.7rem;
    color: var(--terminal-muted);
    cursor: pointer;
    line-height: 1.5;
}

.consent-label input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
}

.terminal-btn {
    width: 100%;
    background: var(--terminal-accent);
    color: var(--terminal-bg);
    border: none;
    padding: 14px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 15px;
}

.terminal-btn:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

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

.privacy-note {
    margin-top: 25px;
    font-size: 0.6rem;
    color: var(--terminal-muted);
    text-align: center;
}

/* ============================================
   WELCOME SCREEN
   ============================================ */

.welcome-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.welcome-header {
    margin-bottom: 25px;
}

.status-line {
    font-size: 0.7rem;
    color: var(--terminal-muted);
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.status-line.success {
    color: var(--terminal-accent);
}

.separator-line {
    width: 100%;
    height: 1px;
    background: var(--terminal-border);
    margin: 20px 0;
}

.welcome-message {
    margin-bottom: 20px;
}

.welcome-line {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--terminal-text);
    margin-bottom: 10px;
    animation: slideIn 0.5s ease forwards;
    opacity: 0;
}

.welcome-line:nth-child(1) { animation-delay: 0.2s; }
.welcome-line:nth-child(2) { animation-delay: 0.4s; }
.welcome-line:nth-child(3) { animation-delay: 0.6s; }

.welcome-line.emphasis {
    color: var(--terminal-accent);
    font-weight: 700;
}

.protocol-info {
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: var(--terminal-muted);
    line-height: 1.6;
}

.briefing {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--terminal-text);
}

.generation-status {
    margin-top: 20px;
}

.status-label {
    font-size: 0.65rem;
    letter-spacing: 3px;
    color: var(--terminal-accent);
    margin-bottom: 12px;
    animation: pulse 1.5s infinite;
}

.progress-bar-container {
    width: 100%;
    height: 2px;
    background: var(--terminal-border);
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--terminal-accent);
    width: 0%;
    transition: width 0.3s ease;
}

.substatus {
    font-size: 0.6rem;
    color: var(--terminal-muted);
}

/* ============================================
   QUIZ SCREEN
   ============================================ */

.quiz-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--terminal-muted);
    margin-bottom: 35px;
    letter-spacing: 1px;
}

#stepCounter {
    color: var(--terminal-accent);
}

.question-display {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 35px;
    min-height: 3em;
    color: var(--terminal-text);
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 1.1em;
    background: var(--terminal-accent);
    margin-left: 4px;
    vertical-align: text-bottom;
    animation: blink 1s steps(2) infinite;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.option-btn {
    all: unset;
    padding: 14px 18px;
    border: 1px solid var(--terminal-border);
    transition: none; /* Instant hover */
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    line-height: 1.4;
}

.option-btn::before {
    content: '0' attr(data-index);
    margin-right: 15px;
    font-size: 0.65rem;
    opacity: 0.5;
}

.option-btn:hover {
    background: var(--terminal-accent);
    color: var(--terminal-bg);
    border-color: var(--terminal-accent);
    padding-left: 25px;
}

/* ============================================
   ANALYSIS SCREEN
   ============================================ */

.analysis-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    text-align: center;
}

.analysis-label {
    font-size: 0.65rem;
    letter-spacing: 4px;
    color: var(--terminal-accent);
    margin-bottom: 20px;
    animation: pulse 1.5s infinite;
}

#analysisScreen .progress-bar-container {
    max-width: 350px;
}

.analysis-status {
    margin-top: 12px;
    font-size: 0.6rem;
    color: var(--terminal-muted);
}

/* ============================================
   RESULT SCREEN
   ============================================ */

.result-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.verdict-line {
    opacity: 0;
    transform: translateY(10px);
    animation: revealLine 0.5s ease forwards;
    margin-bottom: 10px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.verdict-label {
    font-size: 0.65rem;
    letter-spacing: 3px;
    color: var(--terminal-muted);
    margin-bottom: 5px;
}

.verdict-separator {
    width: 0;
    height: 1px;
    background: var(--terminal-border);
    animation: expandLine 0.4s ease forwards;
    animation-delay: 200ms;
    margin: 12px 0;
}

.verdict-separator-text {
    color: var(--terminal-muted);
    margin: 15px 0;
}

.verdict-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.verdict-title.incompatible {
    color: var(--terminal-error);
}

.verdict-title.moderate {
    color: var(--terminal-warning);
}

.verdict-title.match {
    color: var(--terminal-success);
}

.verdict-cta {
    margin-top: 25px;
}

.cta-link {
    display: inline-block;
    padding: 14px 35px;
    background: var(--terminal-accent);
    color: var(--terminal-bg);
    text-decoration: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.2s;
    font-size: 0.8rem;
}

.cta-link:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

.cta-secondary {
    display: inline-block;
    padding: 10px 25px;
    background: transparent;
    color: var(--terminal-muted);
    border: 1px solid var(--terminal-border);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
    transition: 0.2s;
}

.cta-secondary:hover {
    border-color: var(--terminal-accent);
    color: var(--terminal-accent);
}

.verdict-score {
    font-size: 0.7rem;
    color: var(--terminal-muted);
    margin-top: 20px;
    letter-spacing: 1px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-15px); }
    to { opacity: 1; transform: translateX(0); }
}

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

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

@keyframes revealLine {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes expandLine {
    to { width: 100px; }
}

/* ============================================
   SCROLLBARS
   ============================================ */

.transcript-output::-webkit-scrollbar,
.log-stream::-webkit-scrollbar,
.diagnostic-workspace::-webkit-scrollbar {
    width: 3px;
}

.transcript-output::-webkit-scrollbar-track,
.log-stream::-webkit-scrollbar-track,
.diagnostic-workspace::-webkit-scrollbar-track {
    background: var(--terminal-bg);
}

.transcript-output::-webkit-scrollbar-thumb,
.log-stream::-webkit-scrollbar-thumb,
.diagnostic-workspace::-webkit-scrollbar-thumb {
    background: var(--terminal-border);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    #diagnostic-terminal {
        padding: 30px 15px;
    }
    
    .terminal {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    
    .telemetry-stream {
        display: none;
    }
    
    .diagnostic-workspace {
        padding: 25px 20px;
        min-height: 500px;
    }
    
    .question-display {
        font-size: 1.1rem;
    }
    
    .verdict-title {
        font-size: 1.3rem;
    }
    
    .option-btn {
        padding: 12px 15px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .diagnostic-workspace {
        padding: 20px 15px;
    }
    
    .question-display {
        font-size: 1rem;
    }
    
    .cta-link,
    .cta-secondary {
        width: 100%;
        text-align: center;
        display: block;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

#diagnostic-terminal.hidden {
    display: none !important;
}

#diagnostic-terminal .hidden {
    display: none !important;
}

/* ============================================
   GHOST LOGS (V7 Multi-Persona)
   ============================================ */

.ghost-log {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--terminal-border);
    padding: 8px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--terminal-accent);
    letter-spacing: 1px;
    z-index: 1000;
    animation: ghostFade 3s ease forwards;
    pointer-events: none;
}

@keyframes ghostFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    70% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

@media (max-width: 600px) {
    .ghost-log {
        bottom: auto;
        top: 80px;
        left: 10px;
        right: 10px;
        transform: none;
        text-align: center;
    }
    
    @keyframes ghostFade {
        0% { opacity: 0; transform: translateY(-10px); }
        10% { opacity: 1; transform: translateY(0); }
        70% { opacity: 1; transform: translateY(0); }
        100% { opacity: 0; transform: translateY(10px); }
    }
}

/* ============================================
   AUDIO WAVEFORM INDICATOR
   ============================================ */

.audio-waveform {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
    margin-top: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.audio-waveform.active {
    opacity: 1;
}

.audio-waveform .bar {
    width: 3px;
    background: var(--terminal-accent);
    border-radius: 1px;
    animation: waveform 0.5s ease-in-out infinite;
}

.audio-waveform .bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.audio-waveform .bar:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.audio-waveform .bar:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.audio-waveform .bar:nth-child(4) { height: 16px; animation-delay: 0.3s; }
.audio-waveform .bar:nth-child(5) { height: 8px; animation-delay: 0.4s; }

@keyframes waveform {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}

/* Hide telemetry stream on mobile (now using ghost logs instead) */
@media (max-width: 900px) {
    .telemetry-stream {
        display: none;
    }
}
