:root {
    /* Light theme colors */
    --primary-color: #6366f1;
    --secondary-color: #4f46e5;
    --light-bg: #f5f7fb;
    --user-msg-bg: #6366f1;
    --user-msg-color: white;
    --bot-msg-bg: #f3f4f6;
    --bot-msg-color: #1f2937;
    --container-bg: white;
    --input-bg: white;
    --input-color: #1f2937;
    --input-border: #d1d5db;
    --header-text: white;
    --chat-border: #e5e7eb;
    --typing-dot: #888;
    --border-radius: 20px;
}

[data-theme="dark"] {
    /* Dark theme colors */
    --light-bg: #111827;
    --user-msg-bg: #6366f1;
    --user-msg-color: white;
    --bot-msg-bg: #2d3748;
    --bot-msg-color: #f9fafb;
    --container-bg: #1e293b;
    --input-bg: #374151;
    --input-color: #e5e7eb;
    --input-border: #4b5563;
    --header-text: white;
    --chat-border: #4b5563;
    --typing-dot: #d1d5db;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 20px;
    transition: background-color 0.3s ease;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    background-color: var(--container-bg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.red-circle {
    background: var(--youlearnt-red);
    border-radius: 50%;
}

.blue-circle {
    background: var(--youlearnt-blue);
    border-radius: 50%;
}

.red-square {
    background: var(--youlearnt-red);
    border-radius: 2px;
}

.blue-square {
    background: var(--youlearnt-blue);
    border-radius: 2px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--youlearnt-red);
}

.brand-yl {
    color: var(--youlearnt-blue);
}

.status-text {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-light);
}

.status-bullet {
    color: #10B981;
    font-weight: bold;
}
.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--header-text);
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.chat-header .subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
}

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #F9FAFB;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 300px;
    scroll-behavior: smooth;
    transition: background-color 0.3s ease;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: fadeInUp 0.3s ease-out;
}

.message.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.bot-avatar, .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bot-avatar {
    background: white;
    border: 1px solid #E5E7EB;
}

.bot-avatar .logo-squares {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    width: 20px;
    height: 20px;
}

.bot-avatar .square {
    width: 9px;
    height: 9px;
}

.bot-avatar .red-circle { background: #E53E3E; border-radius: 50%; }
.bot-avatar .blue-circle { background: #2B4C8C; border-radius: 50%; }
.bot-avatar .red-square { background: #E53E3E; border-radius: 1px; }
.bot-avatar .blue-square { background: #2B4C8C; border-radius: 1px; }

.user-avatar {
    background: #E53E3E;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.message-content {
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-text {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message:not(.user) .message-text {
    background: transparent;
    color: #2D3748;
    border: 1.5px solid #E53E3E;
    border-radius: 20px 20px 20px 6px;
}

.message.user .message-text {
    background: #2B4C8C;
    color: white;
    border-radius: 20px 20px 6px 20px;
}

.message-time {
    font-size: 11px;
    color: #9CA3AF;
    padding: 0 4px;
}

.message.user .message-time {
    text-align: right;
}

.powered-by {
    font-size: 10px;
    color: #A1A1AA;
    margin-top: 4px;
    margin-bottom: 2px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.typing-indicator {
    align-self: flex-start;
    background-color: var(--bot-msg-bg);
    color: var(--bot-msg-color);
    padding: 12px 18px;
    border-radius: var(--border-radius);
    border-bottom-left-radius: 5px;
    margin-bottom: 12px;
    display: none;
    animation: fadeIn 0.3s ease-in-out, pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.typing-indicator span {
    display: inline-block;
    margin-right: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--typing-dot);
    animation: typingDot 1.5s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

@keyframes typingDot {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

.chat-input {
    display: flex;
    padding: 16px 20px;
    background-color: var(--container-bg);
    border-top: 1px solid var(--chat-border);
    transition: background-color 0.3s ease;
}

#message-input {
    flex-grow: 1;
    border-radius: 30px;
    border: 1px solid var(--input-border);
    padding: 12px 20px;
    font-size: 16px;
    transition: all 0.3s;
    background-color: var(--input-bg);
    color: var(--input-color);
}

#message-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

#message-input::placeholder {
    color: var(--input-color);
    opacity: 0.7;
}

#send-button {
    margin-left: 10px;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    border: none;
    transition: all 0.3s;
}

#send-button:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}

.date-divider {
    text-align: center;
    color: #6b7280;
    font-size: 0.8rem;
    margin: 20px 0;
    position: relative;
}

.date-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: #e5e7eb;
}

.date-divider::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: #e5e7eb;
}

.proto-ai-logo {
    font-weight: bold;
    letter-spacing: 1px;
}

.proto-ai-logo .highlight {
    color: #a5b4fc;
}

/* Theme Toggle Button */
.theme-toggle {
    position: relative;
    right: unset;
    top: unset;
    transform: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* lang Toggle Button */
.lang-toggle {
    position: relative;
    right: unset;
    top: unset;
    transform: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
}


/* Custom scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.7);
}

/* --- Language Toggle Styles (moved from index.html) --- */
.language-toggle {
    display: flex;
    gap: 6px;
}
.lang-btn {
    background: #2B4C8C;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lang-btn:not(.active) {
    background: #E5E7EB;
    color: #2D3748;
}
.lang-btn:hover {
    opacity: 0.9;
}