:root {
    --bg: #121212;
    --panel: #1e1e1e;
    --text: #e0e0e0;
    --accent: #0a84ff;
    --border: #333;
}

[data-theme="light"] {
    --bg: #f5f5f7;
    --panel: #ffffff;
    --text: #1d1d1f;
    --accent: #007aff;
    --border: #d1d1d6;
}

body {
    font-family: -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: 0.3s;
}

#sys-mon {
    display: flex;
    gap: 20px;
    padding: 8px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.bar-bg {
    width: 100px;
    height: 6px;
    background: #333;
    border-radius: 3px;
    display: inline-block;
    margin-left: 5px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: #34c759;
    transition: 0.4s;
}

.critical {
    background: #ff3b30;
}

#chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bot-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    max-width: 85%;
    margin-bottom: 10px;
}

.copy-btn {
    align-self: flex-end;
    margin-bottom: -10px;
    margin-right: 10px;
    z-index: 10;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 8px;
    font-size: 10px;
    color: var(--text);
    cursor: pointer;
}

.msg {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 15px;
}

.user {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    max-width: 85%;
}

.bot {
    align-self: flex-start;
    background: var(--panel);
    border: 1px solid var(--border);
    white-space: pre-wrap;
    width: 100%;
}

.controls {
    padding: 15px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.row {
    display: flex;
    gap: 10px;
    align-items: center;
}

input[type="text"] {
    flex: 1;
    padding: 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    outline: none;
}

button {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

/* Mic Recording Animation */
#mic-btn.recording {
    background: #ff3b30;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 10px rgba(255, 59, 48, 0.5);
    }

    100% {
        transform: scale(1);
    }
}
textarea#user-input {
    flex: 1;
    padding: 12px 18px;
    background: var(--bg);
    /* Matches your server.js theme setup */
    color: var(--text);
    border: 1px solid var(--border);
    /* Re-establishes the border */
    border-radius: 20px;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    overflow-y: auto;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.4;
}

/* Add a glow when you click inside it */
textarea#user-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.2);
}

/* Thinking Indicator Styling */
.thinking {
    font-style: italic;
    color: #888;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    padding: 10px;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}

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

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

@keyframes blink {

    0%,
    80%,
    100% {
        opacity: 0;
    }

    40% {
        opacity: 1;
    }
}