/* Custom properties based on original styles.css for a cohesive look */
:root {
    --bg: #080a12;
    --card: #0f1320;
    --card-alt: #101626;
    --text: #e7ecf5;
    --muted: #9aa4b8;
    --accent: #6ae3ff; /* Lighter Cyan */
    --accent-2: #9c7bff; /* Purple/Accent 2 */
    --border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Manrope', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    overflow-y: scroll;
    position: relative; /* Needed for z-index stacking */
}

/* --------------------
   Matrix Rain Styles (Restored)
   -------------------- */
.rain-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0; /* Ensures it stays in the background */
    pointer-events: none;
    opacity: 0.75;
}

/* --------------------
   Chat UI Containers (Transparency Added)
   -------------------- */

.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 700px;
    height: 95vh; 
    min-height: 500px;
    /* --- MODIFIED: Added transparency (0.9) to background --- */
    background: rgba(15, 19, 32, 0.9); /* var(--card) with 90% opacity */
    border-radius: 18px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    padding: 0;
    z-index: 1; /* Ensures the chat box is on top of the rain */
    position: relative;
}

header {
    padding: 15px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    /* --- MODIFIED: Added transparency (0.95) to header --- */
    background-color: rgba(16, 22, 38, 0.95); /* var(--card-alt) with 95% opacity */
}

header h1 {
    font-size: 1.5em;
    margin: 0;
}

header p {
    font-size: 0.8em;
    color: var(--muted);
    margin-top: 5px;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

/* --------------------
   Messages
   -------------------- */

.message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 85%;
    line-height: 1.5;
    word-wrap: break-word;
}

.message p {
    margin: 0;
}

/* Bot message background must also be opaque enough for readability */
.bot-message {
    /* Retaining a solid color for good contrast */
    background-color: var(--card-alt); 
    color: var(--text);
    margin-right: auto;
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

/* --------------------
   Input Area (Kept opaque for easy typing)
   -------------------- */

.input-area {
    display: flex;
    padding: 10px 15px;
    border-top: 1px solid var(--border);
    background-color: var(--card-alt); /* Keeping this opaque */
    align-items: flex-end;
}

#user-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 18px;
    margin-right: 10px;
    background: var(--card); /* Keeping this opaque */
    color: var(--text);
    font-family: inherit;
    font-size: 1em;
    resize: none;
    max-height: 150px;
    line-height: 1.4;
    transition: border-color 0.2s;
}

#user-input:focus {
    outline: none;
    border-color: var(--accent);
}

.send-btn {
    background-color: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.send-btn:hover {
    background-color: #4dc2ff; 
}

/* -------------------------------------- */
/* Mobile-Optimized Floating Voice Button */
/* -------------------------------------- */

.floating-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background-color: var(--accent-2); 
    color: white;
    border: none;
    border-radius: 50%;
    width: 65px; 
    height: 65px;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: background-color 0.2s, transform 0.15s, box-shadow 0.2s;
    z-index: 1000; 
}

/* Animation for listening state (Mobile Focus) */
.floating-btn.listening {
    background-color: #ff5252; 
    animation: pulse 1.5s infinite;
}

.floating-btn:hover {
    transform: scale(1.05);
}

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

.voice-status {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9em;
    pointer-events: none;
    z-index: 999;
    text-align: center;
    min-width: 150px;
}

/* Typing indicator for streaming */
.cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background-color: var(--text);
    animation: blink 1s step-start infinite;
    vertical-align: middle;
    margin-left: 2px;
}

/* --------------------
   Desktop Adjustment (>= 768px)
   -------------------- */
@media (min-width: 768px) {
    body {
        padding: 50px;
    }
    .chat-container {
        height: 80vh; 
    }
    
    .input-area {
        position: relative;
    }
    .floating-btn {
        position: static;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-right: 10px;
        order: -1; 
        background-color: var(--accent);
        box-shadow: none;
    }
    .floating-btn:hover {
        transform: none;
        background-color: #4dc2ff;
    }
    .floating-btn.listening {
        background-color: #ff5252;
        animation: none;
    }

    /* Hide the floating status text on desktop */
    .voice-status {
        display: none;
    }
}