/* General styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary-color: #4a6fa5; /* Updated blue */
    --secondary-color: #6c9bcf;
    --accent-color: #e4f0ff;
    --text-dark: #333;
    --text-light: #f8f9fa;
    --background-light: #f8f9fa;
    --background-main: #ffffff;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.08);
    --gradient-header: linear-gradient(135deg, #4a6fa5, #6c9bcf);
}

body {
    background-color: var(--background-light);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(circle at 30% 107%, rgba(214, 228, 250, 0.8) 0%, rgba(230, 237, 246, 0.6) 60%, rgba(240, 245, 250, 0.3) 100%);
}

/* Add the CSS styles for the dual chat layout at the beginning */

/* Media query for mobile devices to stack the chats vertically */
@media (max-width: 768px) {
    .dual-chat-container {
        flex-direction: column;
    }
    
    .chat-container {
        max-width: 100%;
        height: 50vh;
        margin: 5px 0;
    }
}

/* Chat container */
.chat-container {
    width: 100%;
    max-width: 750px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
}

/* Header */
header {
    background: var(--gradient-header);
    color: var(--text-light);
    padding: 20px;
    position: relative;
    z-index: 2;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.logo i {
    font-size: 26px;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

header p {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
    margin-left: 52px;
    font-weight: 300;
}

/* Chat box */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: var(--background-main);
    scroll-behavior: smooth;
}

.chat-box::-webkit-scrollbar {
    width: 6px;
}

.chat-box::-webkit-scrollbar-track {
    background: transparent;
}

.chat-box::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* Message styles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user {
    align-self: flex-end;
}

.assistant, .system {
    align-self: flex-start;
}

.message-content {
    padding: 14px 18px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-size: 15px;
    line-height: 1.5;
    position: relative;
}

.message-content p {
    margin-bottom: 6px;
}

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

.user .message-content {
    background-color: var(--primary-color);
    color: white;
    border-top-right-radius: 4px;
}

.assistant .message-content, .system .message-content {
    background-color: var(--accent-color);
    color: var(--text-dark);
    border-top-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #777;
    margin-top: 5px;
    align-self: flex-end;
}

.user .message-time {
    margin-right: 5px;
}

.assistant .message-time, .system .message-time {
    margin-left: 5px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 15px;
    background-color: var(--accent-color);
    border-radius: 18px;
    width: fit-content;
    margin-top: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite both;
    opacity: 0.6;
}

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

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

@keyframes typing {
    0% {
        opacity: 0.4;
        transform: scale(0.8);
    }
    50% {
        opacity: 0.8;
        transform: scale(1);
    }
    100% {
        opacity: 0.4;
        transform: scale(0.8);
    }
}

/* Chat input */
.chat-input-container {
    padding: 18px;
    display: flex;
    gap: 12px;
    background-color: var(--background-main);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 2;
}

#userInput {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    outline: none;
    font-size: 15px;
    background-color: var(--background-light);
    transition: all 0.2s;
}

#userInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.1);
}

.chat-input-container button {
    width: 48px;
    height: 48px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(74, 111, 165, 0.3);
}

.chat-input-container button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.chat-input-container button:active {
    transform: translateY(0);
}

.chat-input-container button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.chat-input-container button i {
    font-size: 18px;
}

/* Responsive adjustments */
@media (max-width: 580px) {
    .chat-container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    
    body {
        padding: 0;
    }
}