/* NOVA — Iron Man HUD Style */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Rajdhani:wght@300;400;500;600;700&display=swap');

:root {
    --nova-blue: #00d4ff;
    --nova-blue-dim: #0099cc;
    --nova-blue-glow: rgba(0, 212, 255, 0.3);
    --nova-dark: #0a0a0f;
    --nova-dark-2: #12121a;
    --nova-dark-3: #1a1a2e;
    --nova-text: #e0e0e0;
    --nova-text-dim: #888;
    --nova-accent: #ff6b35;
    --nova-green: #00ff88;
    --nova-red: #ff3366;
    --nova-yellow: #ffcc00;
}

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

body {
    background: var(--nova-dark);
    color: var(--nova-text);
    font-family: 'Rajdhani', sans-serif;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Animated background grid */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* === HEADER === */
.nova-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 30px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    background: rgba(10, 10, 15, 0.95);
    position: relative;
    z-index: 10;
}

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

.nova-logo-icon {
    width: 40px;
    height: 40px;
    border: 2px solid var(--nova-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: logoPulse 3s ease-in-out infinite;
}

.nova-logo-icon::after {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--nova-blue);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--nova-blue), 0 0 40px var(--nova-blue-glow);
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 10px var(--nova-blue-glow); }
    50% { box-shadow: 0 0 25px var(--nova-blue-glow), 0 0 50px rgba(0, 212, 255, 0.1); }
}

.nova-logo h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--nova-blue);
    letter-spacing: 6px;
    text-shadow: 0 0 20px var(--nova-blue-glow);
}

.nova-logo span {
    font-size: 0.65rem;
    color: var(--nova-text-dim);
    letter-spacing: 2px;
    font-weight: 300;
}

.nova-status {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--nova-text-dim);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nova-green);
    box-shadow: 0 0 10px var(--nova-green);
    animation: dotPulse 2s ease-in-out infinite;
}

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

.status-dot.standby {
    background: var(--nova-blue);
    box-shadow: 0 0 10px var(--nova-blue);
    animation: dotPulse 3s ease-in-out infinite;
}

.status-dot.listening {
    background: var(--nova-accent);
    box-shadow: 0 0 10px var(--nova-accent);
}

.status-dot.speaking {
    background: var(--nova-green);
    box-shadow: 0 0 10px var(--nova-green);
    animation: dotPulse 1s ease-in-out infinite;
}

.status-dot.thinking {
    background: var(--nova-yellow);
    box-shadow: 0 0 10px var(--nova-yellow);
    animation: dotPulse 0.5s ease-in-out infinite;
}

/* === MAIN LAYOUT === */
.nova-main {
    display: flex;
    height: calc(100vh - 70px);
    position: relative;
    z-index: 1;
}

/* === SIDEBAR === */
.nova-sidebar {
    width: 280px;
    background: rgba(18, 18, 26, 0.9);
    border-right: 1px solid rgba(0, 212, 255, 0.1);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.sidebar-section {
    background: rgba(26, 26, 46, 0.5);
    border: 1px solid rgba(0, 212, 255, 0.08);
    border-radius: 8px;
    padding: 15px;
}

.sidebar-section h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: var(--nova-blue);
    letter-spacing: 3px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.info-row:last-child { border-bottom: none; }
.info-label { color: var(--nova-text-dim); }
.info-value { color: var(--nova-text); font-weight: 500; }

.memory-list {
    list-style: none;
    font-size: 0.8rem;
}

.memory-list li {
    padding: 6px 0;
    color: var(--nova-text-dim);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    gap: 6px;
}

.memory-list li::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--nova-blue);
    border-radius: 50%;
    flex-shrink: 0;
}

/* === CHAT AREA === */
.nova-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 15, 0.5);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.2);
    border-radius: 2px;
}

/* Messages */
.message {
    max-width: 75%;
    animation: messageIn 0.3s ease-out;
}

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

.message.user {
    align-self: flex-end;
}

.message.nova {
    align-self: flex-start;
}

.message-content {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
}

.message.user .message-content {
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px 12px 2px 12px;
    color: var(--nova-text);
}

.message.nova .message-content {
    background: rgba(26, 26, 46, 0.7);
    border: 1px solid rgba(0, 212, 255, 0.08);
    border-radius: 12px 12px 12px 2px;
    color: var(--nova-text);
}

.message-label {
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-family: 'Orbitron', sans-serif;
}

.message.user .message-label {
    color: var(--nova-blue-dim);
    text-align: right;
}

.message.nova .message-label {
    color: var(--nova-blue);
}

.message.system {
    align-self: center;
    max-width: 90%;
}

.message.system .message-content {
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-radius: 8px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--nova-text-dim);
    padding: 10px 20px;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    padding: 14px 20px;
    background: rgba(26, 26, 46, 0.7);
    border: 1px solid rgba(0, 212, 255, 0.08);
    border-radius: 12px 12px 12px 2px;
}

.typing-indicator.active {
    display: flex;
    gap: 6px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--nova-blue);
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* === INPUT AREA === */
.nova-input {
    padding: 20px 30px;
    border-top: 1px solid rgba(0, 212, 255, 0.1);
    background: rgba(18, 18, 26, 0.95);
    display: flex;
    align-items: center;
    gap: 15px;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

#chat-input {
    width: 100%;
    padding: 14px 20px;
    background: rgba(26, 26, 46, 0.5);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 10px;
    color: var(--nova-text);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#chat-input:focus {
    border-color: var(--nova-blue);
    box-shadow: 0 0 15px var(--nova-blue-glow);
}

#chat-input::placeholder {
    color: var(--nova-text-dim);
}

/* Buttons */
.btn-nova {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.08);
    color: var(--nova-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
}

.btn-nova:hover {
    background: rgba(0, 212, 255, 0.15);
    box-shadow: 0 0 20px var(--nova-blue-glow);
    border-color: var(--nova-blue);
}

.btn-nova:active {
    transform: scale(0.95);
}

.btn-nova.recording {
    border-color: var(--nova-red);
    background: rgba(255, 51, 102, 0.15);
    color: var(--nova-red);
    animation: recordPulse 1s ease-in-out infinite;
}

@keyframes recordPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 51, 102, 0.3); }
    50% { box-shadow: 0 0 25px rgba(255, 51, 102, 0.5); }
}

.btn-send {
    background: rgba(0, 212, 255, 0.15);
}

.btn-send:hover {
    background: rgba(0, 212, 255, 0.25);
}

/* SVG icons */
.btn-nova svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* === VOICE VISUALIZER === */
.voice-visualizer {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 30px;
    margin: 0 10px;
}

.voice-visualizer.active {
    display: flex;
}

.voice-bar {
    width: 3px;
    background: var(--nova-blue);
    border-radius: 3px;
    animation: voiceBar 0.5s ease-in-out infinite alternate;
}

.voice-bar:nth-child(1) { height: 10px; animation-delay: 0s; }
.voice-bar:nth-child(2) { height: 20px; animation-delay: 0.1s; }
.voice-bar:nth-child(3) { height: 15px; animation-delay: 0.2s; }
.voice-bar:nth-child(4) { height: 25px; animation-delay: 0.3s; }
.voice-bar:nth-child(5) { height: 12px; animation-delay: 0.4s; }
.voice-bar:nth-child(6) { height: 18px; animation-delay: 0.15s; }
.voice-bar:nth-child(7) { height: 22px; animation-delay: 0.25s; }

@keyframes voiceBar {
    from { height: 5px; }
    to { height: 25px; }
}

/* === WELCOME SCREEN === */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    gap: 20px;
    padding: 40px;
}

.welcome-arc {
    width: 120px;
    height: 120px;
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: arcRotate 10s linear infinite;
}

.welcome-arc::before {
    content: '';
    position: absolute;
    width: 140px;
    height: 140px;
    border: 1px solid rgba(0, 212, 255, 0.1);
    border-top-color: var(--nova-blue);
    border-radius: 50%;
    animation: arcRotate 8s linear infinite reverse;
}

.welcome-arc::after {
    content: '';
    width: 30px;
    height: 30px;
    background: var(--nova-blue);
    border-radius: 50%;
    box-shadow: 0 0 30px var(--nova-blue), 0 0 60px var(--nova-blue-glow);
}

@keyframes arcRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.welcome-screen h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: var(--nova-blue);
    letter-spacing: 4px;
}

.welcome-screen p {
    color: var(--nova-text-dim);
    font-size: 1rem;
    max-width: 400px;
    line-height: 1.6;
}

.welcome-hint {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

.hint-chip {
    padding: 8px 16px;
    background: rgba(0, 212, 255, 0.06);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--nova-text-dim);
    cursor: pointer;
    transition: all 0.3s;
}

.hint-chip:hover {
    background: rgba(0, 212, 255, 0.12);
    color: var(--nova-text);
    border-color: var(--nova-blue);
}

/* === RESPONSIVE — MOBILE (Phone) === */
@media (max-width: 768px) {
    .nova-sidebar {
        display: none;
    }

    .nova-header {
        padding: 10px 15px;
    }

    .nova-logo h1 {
        font-size: 1.1rem;
        letter-spacing: 4px;
    }

    .nova-logo span {
        display: none;
    }

    .nova-input {
        padding: 12px 15px;
    }

    #chat-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 12px 16px;
    }

    .btn-nova {
        width: 52px;
        height: 52px;
    }

    .message {
        max-width: 90%;
    }

    .message-content {
        font-size: 0.9rem;
        padding: 12px 16px;
    }

    .chat-messages {
        padding: 15px;
    }

    .welcome-arc {
        width: 80px;
        height: 80px;
    }

    .welcome-arc::before {
        width: 100px;
        height: 100px;
    }

    .welcome-screen h2 {
        font-size: 1.2rem;
    }

    .welcome-screen p {
        font-size: 0.85rem;
    }

    .hint-chip {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
}

/* Safe area for notched phones (iPhone etc) */
@supports (padding-top: env(safe-area-inset-top)) {
    .nova-header {
        padding-top: calc(15px + env(safe-area-inset-top));
    }

    .nova-input {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}
