/* =====================================================
   Meeting Prep Agent - Information Materialization UI
   ===================================================== */

/* CSS Variables */
:root {
    --bg: #0a0a0a;
    --bg-surface: #141414;
    --bg-elevated: #1c1c1c;
    --border: #2a2a2a;
    --border-light: #333333;

    --text-primary: #f5f5f5;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    --accent: #818cf8;
    --accent-secondary: #a855f7;
    --accent-soft: rgba(129, 140, 248, 0.12);
    --accent-glow: rgba(129, 140, 248, 0.4);

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    --bubble-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --orb-glow: 0 0 80px rgba(129, 140, 248, 0.5);

    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    --transition-fast: 0.15s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
#app {
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* =====================================================
   Status Bar
   ===================================================== */
.status-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    z-index: 100;
    background: linear-gradient(to bottom, var(--bg) 0%, transparent 100%);
}

.status-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.disconnected {
    background: var(--error);
}

.status-dot.processing {
    background: var(--accent);
    animation: statusPulse 0.8s ease-in-out infinite;
}

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

.status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.status-right .time {
    font-size: 13px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Mode Selector (Live | Niels | Judges) */
.mode-selector {
    display: flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    margin-right: 16px;
}

.mode-btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-sans);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mode-btn:hover {
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--accent);
    color: #fff;
}

.mode-btn[data-mode="demo-niels"].active {
    background: var(--success);
}

.mode-btn[data-mode="demo-judges"].active {
    background: var(--warning);
}

/* Demo Quick Action Buttons */
.demo-buttons {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    gap: 12px;
}

.demo-buttons.hidden {
    display: none;
}

.demo-action-btn {
    padding: 14px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.3);
}

.demo-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(129, 140, 248, 0.4);
}

.demo-action-btn.hidden {
    display: none;
}

/* Different colors for different demo targets */
.demo-action-btn[data-target="niels"] {
    background: var(--success);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.demo-action-btn[data-target="niels"]:hover {
    background: #059669;
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
}

.demo-action-btn[data-target="agrim"] {
    background: var(--warning);
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.demo-action-btn[data-target="agrim"]:hover {
    background: #d97706;
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.4);
}

.demo-action-btn[data-target="thor"] {
    background: #8b5cf6;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.demo-action-btn[data-target="thor"]:hover {
    background: #7c3aed;
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.4);
}

/* =====================================================
   Bubble Canvas - Main Stage
   ===================================================== */
#bubble-canvas {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* =====================================================
   Voice Orb
   ===================================================== */
#voice-orb {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-medium);
}

#voice-orb:hover {
    transform: scale(1.05);
}

.orb-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    box-shadow: var(--orb-glow);
    animation: orbBreathe 4s ease-in-out infinite;
}

.orb-ring {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-medium);
}

.ring-2 {
    inset: -40px;
    border-width: 1px;
}

/* Orb States */
#voice-orb.idle .orb-core {
    animation: orbBreathe 4s ease-in-out infinite;
}

#voice-orb.listening .orb-core {
    animation: orbBreathe 1.5s ease-in-out infinite;
    box-shadow: 0 0 100px rgba(129, 140, 248, 0.7);
}

#voice-orb.listening .orb-ring {
    opacity: 0.6;
    transform: scale(1);
    animation: ringPulse 2s ease-in-out infinite;
}

#voice-orb.listening .ring-2 {
    animation-delay: 0.5s;
}

#voice-orb.processing .orb-core {
    animation: orbProcess 1s ease-in-out infinite;
}

#voice-orb.processing .orb-ring {
    opacity: 0.4;
    transform: scale(1);
    animation: ringRotate 3s linear infinite;
}

#voice-orb.speaking .orb-core {
    animation: orbSpeak 0.8s ease-in-out infinite;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

@keyframes orbBreathe {
    0%, 100% {
        transform: scale(1);
        opacity: 0.95;
    }
    50% {
        transform: scale(1.06);
        opacity: 1;
    }
}

@keyframes orbProcess {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes orbSpeak {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.08);
    }
    75% {
        transform: scale(0.95);
    }
}

@keyframes ringPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

@keyframes ringRotate {
    from { transform: rotate(0deg) scale(1); }
    to { transform: rotate(360deg) scale(1); }
}

/* =====================================================
   Bubble Stack Container
   ===================================================== */
#bubble-stack {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1000px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-content: flex-start;
    padding: 20px;
    z-index: 20;
}

#bubble-stack:empty {
    display: none;
}

/* =====================================================
   Info Bubbles - Float Up Animation
   ===================================================== */
.info-bubble {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: var(--bubble-shadow);
    backdrop-filter: blur(12px);
    max-width: 280px;
    min-width: 200px;
    z-index: 10;

    /* Float up animation */
    animation: bubbleFloat 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
    transform: translateY(80px) scale(0.9);
}

@keyframes bubbleFloat {
    0% {
        opacity: 0;
        transform: translateY(80px) scale(0.9);
    }
    40% {
        opacity: 1;
        transform: translateY(20px) scale(1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Bubble exit animation */
.info-bubble.exit {
    animation: bubblePopOut 0.3s ease-in forwards;
}

@keyframes bubblePopOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
}

/* =====================================================
   Image Bubbles (Nano Banana generated)
   ===================================================== */
.info-bubble.has-image {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: hidden;
}

.bubble-image {
    width: 100%;
    max-width: 300px;
    border-radius: 16px;
    display: block;
    opacity: 0;
    animation: imageFadeIn 0.5s ease-out forwards;
}

@keyframes imageFadeIn {
    0% { opacity: 0; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

/* Image loading placeholder */
.bubble-image-loading {
    width: 280px;
    height: 160px;
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 12px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Bubble content */
.bubble-icon {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.bubble-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}

.bubble-content {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.bubble-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Bubble Types */
.bubble-meeting {
    border-color: var(--accent);
    border-left-width: 3px;
}

.bubble-meeting .bubble-icon {
    color: var(--accent);
}

.bubble-person {
    border-color: var(--accent-secondary);
    border-left-width: 3px;
}

.bubble-company {
    border-color: #3b82f6;
    border-left-width: 3px;
}

.bubble-funding {
    border-color: var(--success);
    border-left-width: 3px;
}

.bubble-history {
    border-color: var(--warning);
    border-left-width: 3px;
}

.bubble-insight {
    background: var(--accent-soft);
    border: 2px solid var(--accent);
    box-shadow: 0 0 40px rgba(129, 140, 248, 0.2), var(--bubble-shadow);
}

.bubble-insight .bubble-content {
    color: var(--text-primary);
    font-weight: 600;
}

/* Contact bubble (person + company combined) */
.bubble-contact {
    border-color: var(--accent-secondary);
    border-left-width: 3px;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.bubble-contact .bubble-content {
    font-size: 18px;
    font-weight: 600;
}

/* Context bubble (history + news combined) */
.bubble-context {
    border-color: var(--warning);
    border-left-width: 3px;
}

/* Highlight text (for news/important info) */
.bubble-highlight {
    color: var(--success);
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 6px;
}

/* Tag pills inside bubbles */
.bubble-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Strategy bubble (sales flowchart) */
.bubble-strategy {
    max-width: 420px;
    min-width: 380px;
    border-color: var(--accent);
    border-left-width: 3px;
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(129, 140, 248, 0.05) 100%);
}

.strategy-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.strategy-step {
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    min-width: 90px;
}

.step-action {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}

.step-detail {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.step-arrow {
    color: var(--accent);
    font-size: 16px;
    opacity: 0.6;
}

/* User context bubble (who you are) */
.bubble-user-context {
    border-color: var(--success);
    border-left-width: 3px;
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(16, 185, 129, 0.05) 100%);
}

/* Intel bubble (fresh news) */
.bubble-intel {
    border-color: var(--warning);
    border-left-width: 3px;
}

/* =====================================================
   Stop Audio Button
   ===================================================== */
.stop-audio-btn {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 16px 28px;
    background: rgba(239, 68, 68, 0.9);
    backdrop-filter: blur(8px);
    border: 2px solid #ef4444;
    border-radius: 50px;

    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;

    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.4);
    transition: all var(--transition-fast);
    animation: stopBtnPulse 1.5s ease-in-out infinite;
}

.stop-audio-btn:hover {
    background: #dc2626;
    transform: translate(-50%, -50%) scale(1.05);
}

.stop-audio-btn svg {
    width: 20px;
    height: 20px;
}

.stop-audio-btn.hidden {
    display: none;
}

@keyframes stopBtnPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 8px 48px rgba(239, 68, 68, 0.6); }
}

/* =====================================================
   Prompt Text
   ===================================================== */
#prompt {
    position: fixed;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    text-align: center;
}

.prompt-text {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 400;
}

#prompt.hidden {
    opacity: 0;
    pointer-events: none;
}

/* =====================================================
   Action Panel
   ===================================================== */
#action-panel {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    animation: slideUp 0.4s ease-out;
}

#action-panel.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.action-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px 28px;
    box-shadow: var(--bubble-shadow);
    text-align: center;
}

.action-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-primary {
    padding: 12px 28px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.4);
}

.btn-secondary {
    padding: 12px 28px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

/* =====================================================
   Input Bar
   ===================================================== */
#input-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.mic-button {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.mic-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.mic-button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    animation: micPulse 1.5s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(129, 140, 248, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(129, 140, 248, 0); }
}

.mic-icon {
    width: 22px;
    height: 22px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 4px 4px 4px 20px;
    transition: border-color var(--transition-fast);
}

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

#text-input {
    width: 280px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
}

#text-input::placeholder {
    color: var(--text-muted);
}

#text-input:disabled {
    opacity: 0.5;
}

.send-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.send-button:hover {
    background: #6366f1;
    transform: scale(1.05);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.send-button svg {
    width: 18px;
    height: 18px;
}

/* =====================================================
   Transcript
   ===================================================== */
#transcript-container {
    position: fixed;
    bottom: 90px;
    left: 24px;
    max-width: 300px;
    max-height: 100px;
    overflow-y: auto;
    z-index: 50;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

#transcript-container:hover {
    opacity: 1;
}

#transcript {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

#transcript .user {
    color: var(--text-secondary);
}

#transcript .agent {
    color: var(--accent);
}

#transcript .error {
    color: var(--error);
}

#transcript > div {
    margin-bottom: 4px;
}

/* =====================================================
   Hidden utility
   ===================================================== */
.hidden {
    display: none !important;
}

/* =====================================================
   Scrollbar
   ===================================================== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* =====================================================
   Settings Button
   ===================================================== */
.settings-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    margin-right: 12px;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.settings-btn svg {
    width: 18px;
    height: 18px;
}

/* =====================================================
   Onboarding Modal
   ===================================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    width: 100%;
    max-width: 400px;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast);
}

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

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-full {
    width: 100%;
    margin-top: 8px;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    #voice-orb {
        width: 100px;
        height: 100px;
    }

    .info-bubble {
        max-width: 220px;
        padding: 14px 16px;
    }

    #text-input {
        width: 200px;
    }

    #transcript-container {
        display: none;
    }
}
