:root {
    --bg-dark: #030812;
    --panel-bg: rgba(7, 24, 40, 0.6);
    --panel-border: rgba(0, 212, 255, 0.2);
    --accent-cyan: #00d4ff;
    --accent-blue: #0066ff;
    --accent-gold: #ffc200;
    --accent-green: #00ff88;
    --text-main: #cce8ff;
    --text-dim: #4a7fa5;
    
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

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

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

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.grid-overlay {
    width: 100%;
    height: 100%;
    background-image: 
        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: 30px 30px;
    background-position: center center;
    perspective: 1000px;
}

.glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
}

.glow-1 {
    top: -100px;
    left: -100px;
    background: var(--accent-cyan);
}

.glow-2 {
    bottom: -200px;
    right: -100px;
    background: var(--accent-blue);
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    height: 100%;
    padding: 20px;
    gap: 20px;
    width: 100%;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Header */
.header {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    gap: 20px;
    flex-shrink: 0;
}

.header-info {
    flex-grow: 1;
}

.header-info h1 {
    font-family: var(--font-heading);
    color: var(--accent-cyan);
    font-size: 1.8rem;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.version {
    font-size: 0.9rem;
    color: var(--text-dim);
    text-shadow: none;
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-top: 4px;
    letter-spacing: 1px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.online { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.dot.thinking { background: var(--accent-gold); box-shadow: 0 0 8px var(--accent-gold); }
.dot.speaking { background: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }
.dot.error { background: #ff4466; box-shadow: 0 0 8px #ff4466; }

/* Arc Reactor Animation */
.reactor-container {
    width: 80px;
    height: 80px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.arc-reactor {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.arc-reactor.idle {
    --r-color: var(--accent-blue);
    --r-speed: 6s;
    --r-glow: 10px;
}
.arc-reactor.listening {
    --r-color: var(--accent-green);
    --r-speed: 2s;
    --r-glow: 20px;
}
.arc-reactor.thinking {
    --r-color: var(--accent-gold);
    --r-speed: 1.5s;
    --r-glow: 25px;
}
.arc-reactor.speaking {
    --r-color: var(--accent-cyan);
    --r-speed: 3s;
    --r-glow: 20px;
}

.arc-reactor .core {
    width: 25px;
    height: 25px;
    background: var(--r-color);
    border-radius: 50%;
    box-shadow: 0 0 var(--r-glow) var(--r-color), inset 0 0 5px #fff;
    z-index: 10;
}

.arc-reactor .ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--r-color);
    box-sizing: border-box;
}

.arc-reactor .inner-ring {
    width: 45px;
    height: 45px;
    border-style: dashed;
    animation: spin var(--r-speed) linear infinite reverse;
}

.arc-reactor .middle-ring {
    width: 60px;
    height: 60px;
    border-top-color: transparent;
    border-bottom-color: transparent;
    animation: spin calc(var(--r-speed) * 0.8) linear infinite;
}

.arc-reactor .outer-ring {
    width: 75px;
    height: 75px;
    border-width: 1px;
    box-shadow: inset 0 0 10px rgba(0, 212, 255, 0.2);
}

.arc-reactor .coils {
    position: absolute;
    width: 100%;
    height: 100%;
    animation: spin calc(var(--r-speed) * 1.5) linear infinite;
}

.arc-reactor .coil {
    position: absolute;
    width: 8px;
    height: 15px;
    background: var(--bg-dark);
    border: 1px solid var(--r-color);
    top: 2px;
    left: calc(50% - 4px);
    transform-origin: 50% 38px;
    transform: rotate(calc(var(--i) * 120deg));
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* Chat Area */
.chat-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar {
    width: 8px;
}
.chat-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}
.chat-container::-webkit-scrollbar-thumb {
    background: var(--panel-border);
    border-radius: 4px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fadeUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

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

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

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

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

.msg-label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.message.user .msg-label {
    color: var(--accent-gold);
    text-align: right;
}

.message.bot .msg-label {
    color: var(--accent-cyan);
}

.msg-content {
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 1.1rem;
    line-height: 1.5;
    position: relative;
}

.message.user .msg-content {
    background: rgba(10, 37, 64, 0.8);
    border: 1px solid rgba(255, 194, 0, 0.2);
    border-bottom-right-radius: 2px;
}

.message.bot .msg-content {
    background: rgba(7, 29, 53, 0.8);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-bottom-left-radius: 2px;
}

.message.system .msg-content {
    background: transparent;
    border: 1px dashed var(--text-dim);
    color: var(--text-dim);
    font-size: 0.9rem;
}

.system-title {
    color: var(--accent-blue);
    font-family: var(--font-heading);
    display: block;
    margin-bottom: 5px;
}

/* Input Area */
.input-area {
    display: flex;
    gap: 15px;
    padding: 15px;
    align-items: center;
    flex-shrink: 0;
}

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

#textInput {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 15px 20px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s;
}

#textInput:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.1);
}

.action-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
}

.action-btn svg {
    width: 24px;
    height: 24px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.mic-btn.listening {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--accent-green);
    color: var(--accent-green);
    animation: pulse 1.5s infinite;
}

.send-btn {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-cyan);
}

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

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(0, 255, 136, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 136, 0); }
}

@media (max-width: 768px) {
    .app-container { padding: 10px; gap: 10px; }
    .header-info h1 { font-size: 1.4rem; }
    .reactor-container { width: 60px; height: 60px; }
    .arc-reactor .inner-ring { width: 35px; height: 35px; }
    .arc-reactor .middle-ring { width: 45px; height: 45px; }
    .arc-reactor .outer-ring { width: 55px; height: 55px; }
}
