:root {
    --background-color: #121212;
    --surface-color: #1E1E1E;
    --primary-color: #BB86FC;
    --primary-variant-color: #3700B3;
    --secondary-color: #03DAC6;
    --on-surface-color: #E1E1E1;
    --on-surface-secondary-color: #8A8A8A;
    --user-message-bg: #3700B3;
    --other-message-bg: #2C2C2C;
}

body {
    font-family: 'Roboto Mono', monospace;
    background-color: var(--background-color);
    color: var(--on-surface-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#chat-container {
    width: 95%;
    max-width: 800px;
    height: 95vh;
    background-color: var(--surface-color);
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- NEW STYLES FOR THE HEADER AND SWITCH --- */
#controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #2a2a2a;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.switch-container {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--secondary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--secondary-color);
}

input:checked + .slider:before {
    transform: translateX(22px);
}
/* --- END OF NEW STYLES --- */


#message-box {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    gap: 5px;
}

#message-box::-webkit-scrollbar {
    width: 8px;
}
#message-box::-webkit-scrollbar-track {
    background: var(--surface-color);
}
#message-box::-webkit-scrollbar-thumb {
    background-color: var(--primary-variant-color);
    border-radius: 10px;
    border: 2px solid var(--surface-color);
}

.message {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 75%;
    line-height: 1.4;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message .username {
    font-weight: bold;
    font-size: 0.85em;
    margin-bottom: 4px;
    color: var(--secondary-color);
    opacity: 0.9;
}

.message .text {
    word-wrap: break-word;
}

.other-user {
    background-color: var(--other-message-bg);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.current-user {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-variant-color));
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    color: white;
}

.current-user .username {
    color: white;
    opacity: 0.8;
}

#input-area {
    display: flex;
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 10px;
}

#message-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid transparent;
    border-radius: 20px;
    background-color: #2C2C2C;
    color: var(--on-surface-color);
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(187, 134, 252, 0.2);
}

#send-btn {
    padding: 12px 25px;
    border: none;
    background-color: var(--primary-color);
    color: #000;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    transition: transform 0.2s, background-color 0.2s;
}

#send-btn:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}
