:root {
    --bg: #1e1e2f;
    --fg: #e0e0e0;
    --accent: #3a3a5e;
    --user-bg: #4b4b7a;
    --agent-bg: #2a2a4a;
    --input-bg: #2a2a3a;
    --toggle: #e0e0e0;
}

html[data-theme="light"] {
    --bg: #f5f5f5;
    --fg: #1e1e1e;
    --accent: #ddd;
    --user-bg: #c5c5c5;
    --agent-bg: #c5c5c5;
    --input-bg: #c5c5c5;
    --toggle: #4b4b7a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
    color: var(--fg);
    font-family: sans-serif;
    overflow-y: auto;
    /* padding-bottom: 1rem; */
}

header {
    padding: 1.8rem;
    background: var(--accent);
    text-align: center;
    font-size: 1.25rem;
    position: relative;
}

a {
    color: white;
    text-decoration: none;
}

textarea:focus {
    outline: none;
}

#messages {
    display: flex;
    flex: 1;
    /* overflow-y: auto; */
    padding: 1rem;
    flex-direction: column;
    width: 50%;
    align-self: center;
    /* scrollbar-width: none; */
    overflow: visible;
}

/* 
#messages::-webkit-scrollbar {
    display: none;
} */

.msg {
    max-width: 70%;
    margin-bottom: 1.4rem;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

.agent {
    background: var(--agent-bg);
    align-self: flex-end;
    white-space: pre-wrap;
}

.agent img{
    height: 110px;
    width: 110px;
}

.agent a{
    /* background-color: #3498db;
    padding: 10px 20px; */
    border-radius: 50px;
    text-decoration: underline;
    cursor: pointer;
}

.user {
    background: var(--user-bg);
    align-self: flex-start;
}

#input-bar {
    display: flex;
    padding: 1rem;
    background: var(--input-bg);
    width: 50%;
    align-self: center;
    border-radius: 20px;
    align-items: flex-end;
    position: fixed;
    bottom: 2.5%;
}

#input-bar textarea {
    flex: 1;
    padding: 0.5rem;
    border: none;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
    background: var(--bg);
    color: var(--fg);
    font-size: 1.2rem;
    resize: none;
    min-height: 6rem;
    font-family: inherit;
}

textarea::-webkit-scrollbar-track {
    background-color: var(--accent);
}

#input-bar button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 0.25rem;
    background: var(--accent);
    color: var(--fg);
    cursor: pointer;
    font-size: 1.2rem;
    max-height: 3rem;
}

#theme-toggle {
    position: absolute;
    top: 50%;
    right: 3rem;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--toggle);
    /* padding: 0.25rem 0.5rem; */
    /* border-radius: 0.25rem; */
    cursor: pointer;
    background-color: var(--toggle);
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.6);
}

#theme-toggle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3rem;
    height: 3rem;
    background: repeating-conic-gradient(from 0deg,
            var(--toggle) 0deg 10deg,
            transparent 10deg 20deg);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    /* z-index: -; */
}

#clear-btn {
    margin-left: 0.5rem;
}


.loader-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
}

.loader-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #3498db;
    border-radius: 50%;
    animation: bounce 1.2s infinite;
}

.loader-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0.8);
    }

    40% {
        transform: scale(1.2);
    }
}


.copy-icon {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 0.5rem;
}

.user .copy-icon {
    bottom: -26px;
    right: -24px;
}

.agent .copy-icon {
    bottom: -26px;
    left: -24px;
}

.msg:hover .copy-icon {
    opacity: 1;
    pointer-events: auto;
}

.copy-icon:hover {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

#scroll-to-bottom-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background-color: #66696c;
    color: red;
    border: none;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: none;
    transition: background 0.3s;
}

#scroll-to-bottom-btn:hover {
    background-color: #343537;
}