:root {
    --primary-bg: #f0f2f5; /* Light grey */
    --secondary-bg: #ffffff; /* White */
    --accent-bg: #e0e0e0; /* Lighter grey */
    --text-color: #333333; /* Dark text */
    --highlight-color: #007bff; /* Standard blue */
    --button-bg: linear-gradient(45deg, #007bff, #0056b3);
    --button-text-color: #ffffff;
    --button-hover-bg: linear-gradient(45deg, #0056b3, #007bff);
    --input-bg: #ffffff;
    --border-color: #dddddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --user-message-bg: #e9e9eb;
    --bot-message-bg: #d1e7dd;
    --status-color: #6c757d;
    --font-primary: 'Orbitron', sans-serif;
    --font-secondary: 'Roboto', sans-serif;
}

body.dark-mode {
    --primary-bg: #0f0c29;
    --secondary-bg: #24243e;
    --accent-bg: #302b63;
    --text-color: #e0e0e0;
    --highlight-color: #00d4ff;
    --button-bg: linear-gradient(45deg, #26d0ce, #1a2980);
    --button-text-color: #e0e0e0;
    --button-hover-bg: linear-gradient(45deg, #1a2980, #26d0ce);
    --input-bg: rgba(255, 255, 255, 0.05);
    --border-color: rgba(0, 212, 255, 0.2);
    --shadow-color: rgba(0, 212, 255, 0.1);
    --user-message-bg: #2c3e50;
    --bot-message-bg: #34495e;
    --status-color: #9e9e9e;
}


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

body {
    font-family: var(--font-secondary);
    background: var(--primary-bg);
    background: linear-gradient(to right, var(--primary-bg), var(--secondary-bg), var(--accent-bg));
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* Prevent scrollbars from gradient body */
}

.app-container {
    width: 95vw;
    max-width: 500px; /* Optimized for a more phone-like portrait view */
    height: 90vh;
    max-height: 800px;
    background-color: rgba(10, 10, 30, 0.85); /* Slightly transparent dark bg */
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 0 30px var(--shadow-color);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Important for rounded corners on children */
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: rgba(0,0,0,0.3);
    border-bottom: 1px solid var(--border-color);
}

.top-bar h1 {
    font-family: var(--font-primary);
    color: var(--highlight-color);
    font-size: 1.8em;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--highlight-color);
}

.top-bar-controls button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--highlight-color);
    padding: 8px 10px;
    border-radius: 50%;
    cursor: pointer;
    margin-left: 10px;
    font-size: 1.2em;
    transition: background-color 0.3s, box-shadow 0.3s;
}
.top-bar-controls button:hover {
    background-color: var(--border-color);
    box-shadow: 0 0 15px var(--highlight-color);
}


.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Important for child overflow */
    position: relative; /* For positioning animation/chat */
}

.chat-visual-container {
    flex-grow: 1;
    display: flex; /* Will be managed by JS to show one or other */
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 10px;
}

.animation-area {
    /* Ensure it's a flex container if not already, to center the orbContainer */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%; /* Or specific dimensions */
    height: 300px; /* Or specific dimensions, matching old GIF area or new design */
}


.chat-area-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, opacity 0.5s ease-in-out;
}

.chat-area-wrapper.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none; /* Prevent interaction when collapsed */
    display: none; /* Hard hide when collapsed, animation area takes over */
}
.chat-area-wrapper.expanded {
    max-height: 1000px; /* Large enough to show content */
    opacity: 1;
    display: block; /* Show when expanded */
}


#chat-area {
    height: 100%; /* Takes full height of its wrapper */
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column-reverse; /* Newest messages at the bottom, visually */
}
/* Custom scrollbar for chat area */
#chat-area::-webkit-scrollbar { width: 8px; }
#chat-area::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 4px;}
#chat-area::-webkit-scrollbar-thumb { background: var(--highlight-color); border-radius: 4px;}
#chat-area::-webkit-scrollbar-thumb:hover { background: #00a0c0; }


#chat-area pre {
    padding: 10px 15px;
    border-radius: 15px;
    margin-bottom: 8px;
    max-width: 100%;
    font-family: var(--text-font, Arial, sans-serif); /* Use your site's font */
    width: fit-content;
    line-height: 1.4;
    white-space: pre-wrap;
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

#chat-area pre.user-message {
    background: var(--user-message-bg);
    color: var(--text-color);
    border-bottom-right-radius: 5px;
}
#chat-area pre.bot-message {
    background: var(--bot-message-bg);
    color: var(--text-color);
    border-bottom-left-radius: 5px;

}


.status-indicator {
    padding: 8px 15px;
    text-align: center;
    font-style: italic;
    color: var(--status-color);
    min-height: 1.5em; /* Ensure space even when empty */
    font-size: 0.9em;
    background-color: rgba(0,0,0,0.2);
}

.input-container {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: rgba(0,0,0,0.3);
    border-top: 1px solid var(--border-color);
}

#message-input {
    flex-grow: 1;
    padding: 12px 18px;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    margin-right: 10px;
    font-size: 1em;
    outline: none;
    transition: box-shadow 0.3s;
}
#message-input:focus {
    box-shadow: 0 0 15px var(--highlight-color);
    border-color: var(--highlight-color);
}
#message-input::placeholder { color: var(--status-color); }

.input-container button {
    background: var(--button-bg);
    border: none;
    color: var(--button-text-color); 
    border-radius: 50%; /* Circular buttons */
    width: 48px;        /* Explicit width */
    height: 48px;       /* Explicit height */
    font-size: 1.5em;   /* Adjust for icon size */
    cursor: pointer;
    margin-left: 8px;   /* Spacing between buttons */
    transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
    display: flex;      /* For centering content (icon) */
    justify-content: center;
    align-items: center;
    padding: 0; /* Remove padding if width/height are fixed and using flex for centering */
}

.input-container button:hover {
    background: var(--button-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.input-container button:disabled {
    background: #555; 
    color: #aaa;      
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Orb Container */
.orbContainer {
    width: auto; /* Let orb size dictate or set specific */
    height: auto;
    /* display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 0;
    height: 300px;
    background: linear-gradient(to bottom, #222, #333);
    position: relative;
    overflow: hidden; */
}

/* Orb and Core Styling */
.orb {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    overflow: visible;
}

.orbCore {
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    position: relative;
    transition: all 0.4s ease;
}

/* Particle Styling */
.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* IDLE Animation */
.idle {
    background: linear-gradient(to bottom, #555, #333);
    animation: breatheIdle 6s infinite ease-in-out;
}

.idle .particle {
    background-color: rgba(150, 150, 150, 0.8);
}

.idle .orbCore {
    transform: scale(0.8);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

/* LISTENING Animation */
.listening {
    background: linear-gradient(to bottom, #4CAF50, #388E3C);
    animation: pulseListen 2s infinite ease-in-out;
    filter: drop-shadow(0 0 10px #4CAF50);
}

.listening .particle {
    background-color: rgba(0, 200, 0, 0.8);
}

.listening .orbCore {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.7);
}

/* SPEAKING Animation */
.speaking {
    background: linear-gradient(to bottom, #2196F3, #1976D2);
    animation: pulseSpeak 2.5s infinite alternate;
    filter: drop-shadow(0 0 15px #2196F3);
}

.speaking .particle {
    background-color: rgba(100, 200, 255, 0.8);
}

.speaking .orbCore {
    transform: scale(1.1);
    animation: corePulse 2s infinite ease-in-out;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* More Complex Animations */
@keyframes breatheIdle {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes pulseListen {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px #4CAF50;
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px #4CAF50;
    }
}

@keyframes pulseSpeak {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 10px #2196F3;
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 25px #2196F3;
    }
}

@keyframes corePulse {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes moveParticlesSynchronized {
    0% { transform: rotate(0deg) translate(75px, 0); }
    100% { transform: rotate(360deg) translate(75px, 0); }
}

/* Tool Tags Styling */
.message-container {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

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

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

.tool-tags-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 5px;
    margin-left: 10px; /* Align with bot message padding */
    max-width: 100%;
}

.tool-tag-title {
    font-size: 0.8em;
    font-weight: bold;
    color: var(--status-color);
    margin-right: 5px;
}

.tool-tag {
    background-color: var(--accent-bg);
    color: var(--text-color);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-right: 5px;
    margin-bottom: 5px;
}
