/* ═══════════════════════════════════════════════════════
   KAIROS LAB — Assistant Chat & Voice UI
   ═══════════════════════════════════════════════════════ */

/* ── Chat Panel (bottom-right floating) ───────────── */
.assistant-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-height: 550px;
    background: rgba(13, 17, 23, 0.98);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    z-index: 3000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), var(--neon-shadow);
    transform: translateY(120%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.assistant-panel.open {
    transform: translateY(0);
}

/* ── Header ───────────────────────────────────────── */
.assistant-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.1), rgba(0, 153, 255, 0.1));
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.assistant-header h4 {
    margin: 0;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.voice-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    transition: background 0.3s;
}
.voice-status.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

/* ── Chat Log ─────────────────────────────────────── */
#chatLog {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 250px;
    max-height: 350px;
}

.chat-msg {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
    font-family: 'Roboto Mono', monospace;
    max-width: 90%;
    word-break: break-word;
}
.chat-user {
    background: rgba(88, 166, 255, 0.15);
    border: 1px solid rgba(88, 166, 255, 0.3);
    align-self: flex-end;
}
.chat-assistant {
    background: rgba(0, 242, 255, 0.08);
    border: 1px solid rgba(0, 242, 255, 0.2);
    align-self: flex-start;
}
.chat-system {
    background: rgba(218, 54, 51, 0.1);
    border: 1px solid rgba(218, 54, 51, 0.3);
    align-self: center;
    font-size: 0.75rem;
    color: var(--danger);
}
.chat-function {
    background: rgba(35, 134, 54, 0.1);
    border: 1px solid rgba(35, 134, 54, 0.3);
    align-self: center;
    font-size: 0.75rem;
}
.chat-role {
    font-weight: 700;
    font-family: 'Rajdhani', sans-serif;
    margin-right: 5px;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}
.chat-user .chat-role { color: var(--accent); }
.chat-assistant .chat-role { color: var(--highlight); }
.chat-fn-badge {
    display: inline-block;
    background: rgba(35, 134, 54, 0.2);
    border: 1px solid var(--success);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    font-family: 'Rajdhani', sans-serif;
    margin-right: 5px;
}

/* ── Input Area ───────────────────────────────────── */
.assistant-input {
    padding: 12px 15px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(22, 27, 34, 0.5);
}
.assistant-input input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 8px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.9rem;
}
.assistant-input input:focus {
    border-color: var(--highlight);
    outline: none;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}
.assistant-input input::placeholder {
    color: var(--text-muted);
}

/* ── Mic Button ───────────────────────────────────── */
#micButton {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
#micButton:hover {
    border-color: var(--highlight);
    color: var(--highlight);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}
#micButton.recording {
    border-color: var(--danger);
    background: rgba(218, 54, 51, 0.2);
    color: var(--danger);
    animation: mic-pulse 1s infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(218, 54, 51, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(218, 54, 51, 0); }
}

/* ── Send Button ──────────────────────────────────── */
.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--highlight), #0099ff);
    color: #000;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.5);
}

/* ── FAB (Floating Action Button to open) ─────────── */
.assistant-fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--highlight);
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.2), rgba(0, 153, 255, 0.2));
    color: var(--highlight);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 242, 255, 0.3);
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}
.assistant-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 30px rgba(0, 242, 255, 0.5);
}
.assistant-fab.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}
