
:root {
    --background-color: #000000;
    --text-color: #E0E0E0;
    --accent-color: #FF1493;
    --input-bg-color: #1C1C1E;
    --message-user-bg: #333333;
    --message-bot-bg: #222222;
    --border-radius-large: 18px;
    --border-radius-small: 12px;
    --font-family: 'Roboto', sans-serif;
    --transition-speed: 0.2s;
}

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

html {
    height: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    line-height: 1.6;
    overscroll-behavior: none;
}

#warning-bar {
    background-color: var(--accent-color);
    color: var(--background-color);
    text-align: center;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#app-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px 10px 15px;
    overflow: hidden;
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0;
    flex-shrink: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
    animation: fadeIn 0.3s ease-out;
}

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

.logo-icon {
    color: var(--accent-color);
    font-size: 2rem;
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1.1);
    }
}

header h1 {
    font-size: 1.8rem;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--accent-color);
    background: linear-gradient(90deg, var(--accent-color), #ff7ac6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#chat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px 5px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--input-bg-color);
    scroll-behavior: smooth;
}

#chat-log::-webkit-scrollbar {
    width: 6px;
}
#chat-log::-webkit-scrollbar-track {
    background: var(--input-bg-color);
    border-radius: 3px;
}
#chat-log::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 3px;
}

.message {
    display: flex;
    align-items: flex-start;
    max-width: 85%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    animation: messageIn 0.3s ease-out;
    transition: transform var(--transition-speed) ease, opacity var(--transition-speed) ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message:hover {
    transform: translateY(-2px);
}

.message-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 20, 147, 0.2);
    margin-right: 12px;
    transition: transform var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

.message:hover .message-avatar {
    transform: scale(1.1);
    background-color: rgba(255, 20, 147, 0.3);
}

.message .icon {
    font-size: 1.4rem;
    color: var(--accent-color);
}

.message-content {
    background-color: var(--message-bot-bg);
    padding: 12px 16px;
    border-radius: var(--border-radius-large);
    flex-grow: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: box-shadow var(--transition-speed) ease;
}

.message:hover .message-content {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
}

.user-message .message-avatar {
    margin-right: 0;
    margin-left: 12px;
    background-color: rgba(51, 51, 51, 0.5);
}

.user-message .message-content {
    background-color: var(--message-user-bg);
    border-bottom-right-radius: 5px;
}

.bot-message {
    align-self: flex-start;
    margin-right: auto;
}

.bot-message .message-content {
    border-bottom-left-radius: 5px;
}

/* Styling for Markdown generated elements inside bot messages */
.message-content p strong {
    color: var(--accent-color);
    font-weight: 700;
    text-shadow: 0 0 2px rgba(255, 20, 147, 0.5);
}

.message-content p em {
    font-style: italic;
    opacity: 0.9;
}

.message-content p p,
.message-content p ol,
.message-content p ul {
    margin-top: 0.6em;
    margin-bottom: 0.6em;
}

.message-content p ol,
.message-content p ul {
    padding-left: 25px;
}

.message-content p li {
    margin-bottom: 0.3em;
}

.message-content p > *:first-child {
    margin-top: 0;
}

.message-content p > *:last-child {
    margin-bottom: 0;
}

.message-content p code {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-family: monospace;
}

.message-content p pre {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin-top: 0.6em;
    margin-bottom: 0.6em;
}

.message-content p pre code {
    background-color: transparent;
    padding: 0;
}

#input-area {
    display: flex;
    align-items: flex-end;
    padding: 15px 5px;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#user-input {
    flex-grow: 1;
    background-color: var(--input-bg-color);
    color: var(--text-color);
    border: 2px solid rgba(255, 20, 147, 0.3);
    outline: none;
    padding: 12px 15px;
    font-size: 1rem;
    font-family: var(--font-family);
    border-radius: var(--border-radius-large);
    resize: none;
    min-height: 48px;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.5;
    margin-right: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

#user-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(255, 20, 147, 0.3);
}

#user-input:disabled {
    background-color: rgba(51, 51, 51, 0.7);
    cursor: not-allowed;
    opacity: 0.7;
}

#send-button {
    background-color: var(--accent-color);
    color: var(--background-color);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#send-button .material-symbols-outlined {
    font-size: 24px;
    font-weight: 500;
}

#send-button:hover {
    background-color: #ff4da6;
    box-shadow: 0 4px 15px rgba(255, 20, 147, 0.4);
    transform: translateY(-2px);
}

#send-button:active {
    transform: scale(0.95) translateY(0);
}

#send-button:disabled {
    background-color: rgba(51, 51, 51, 0.7);
    cursor: not-allowed;
    box-shadow: none;
}

#send-button:disabled .material-symbols-outlined {
    color: #777;
}

#copyright {
    text-align: center;
    padding: 8px 0;
    font-size: 0.7rem;
    color: #555;
    flex-shrink: 0;
    background-color: rgba(0, 0, 0, 0.8);
}

.material-symbols-outlined {
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24;
}

.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.typing-indicator span {
    display: inline-block;
    background-color: var(--accent-color);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: typing 0.2s infinite alternate; /* Even faster animation */
    will-change: transform, opacity;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing {
    0% {
        opacity: 0.3;
        transform: translateY(0);
    }
    100% {
        opacity: 1;
        transform: translateY(-5px);
    }
}

.message.thinking .message-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 1.6em;
}

/* Responsive design */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .logo-icon {
        font-size: 1.6rem;
    }
    
    #user-input {
        font-size: 0.95rem;
        min-height: 44px;
        padding: 10px 12px;
    }
    
    #send-button {
        width: 44px;
        height: 44px;
    }
    
    #send-button .material-symbols-outlined {
        font-size: 22px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .message-content {
        padding: 10px 14px;
    }
    
    .message-content p ol,
    .message-content p ul {
        padding-left: 20px;
    }
    
    #chat-log {
        gap: 15px;
        padding: 10px 5px;
    }
    
    .message-avatar {
        width: 36px;
        height: 36px;
    }
    
    .message .icon {
        font-size: 1.2rem;
    }
}

/* What's New Popup */
.whats-new-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    backdrop-filter: blur(8px);
}

.whats-new-popup.show {
    opacity: 1;
    visibility: visible;
    animation: popIn 0.4s forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    70% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.whats-new-content {
    background-color: var(--input-bg-color);
    border-radius: var(--border-radius-large);
    max-width: 90%;
    width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    border: 2px solid var(--accent-color);
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    0% {
        box-shadow: 0 0 10px rgba(255, 20, 147, 0.5);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 20, 147, 0.8);
    }
}

.whats-new-header {
    background: linear-gradient(90deg, var(--accent-color), #ff7ac6);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.whats-new-header h2 {
    margin: 0;
    color: var(--background-color);
    font-size: 1.3rem;
    flex-grow: 1;
    text-align: center;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#version-code {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-left: 5px;
}

.whats-new-icon {
    color: var(--background-color);
    font-size: 1.5rem;
    margin-right: 10px;
    animation: spin 4s infinite linear;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

#close-whats-new {
    background: transparent;
    border: none;
    color: var(--background-color);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

#close-whats-new:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.whats-new-body {
    padding: 20px;
    color: var(--text-color);
}

.whats-new-body p {
    margin: 10px 0;
    line-height: 1.5;
    font-size: 1rem;
}

.whats-new-body p:first-child {
    margin-top: 0;
}

.whats-new-body p:last-child {
    margin-bottom: 0;
}

/* Add some motion design tweaks for low-end devices */
@media (prefers-reduced-motion) {
    .message {
        animation: simpleFade 0.3s ease-out;
    }
    
    @keyframes simpleFade {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    .message:hover {
        transform: none;
    }
    
    .message:hover .message-avatar {
        transform: none;
    }
    
    #chat-log {
        scroll-behavior: auto;
    }
    
    .logo-icon {
        animation: none;
    }
    
    .whats-new-popup.show {
        animation: none;
    }
    
    .whats-new-icon {
        animation: none;
    }
    
    .whats-new-content {
        animation: none;
    }
}
