:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --background-color: #f8fafc;
    --text-color: #1e293b;
    --message-bg: #eff6ff;
    --input-bg: #ffffff;
    --border-color: #cbd5e1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
}

.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.navbar {
    background-color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.nav-logo i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.primary-button:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.primary-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
    height: calc(100vh - 72px);
    position: relative;
    overflow: hidden;
}

.messages {
    position: absolute;
    top: 2rem;
    bottom: 120px;
    left: 2rem;
    right: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-right: 1rem;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    max-width: 100%;
    animation: fadeIn 0.3s ease-in;
}

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

.user-message {
    background-color: var(--primary-color);
    color: white;
    margin-left: auto;
    border: none;
    max-width: 80%;
}

.assistant-message {
    background-color: white;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.message-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-message .message-icon {
    background-color: rgba(255, 255, 255, 0.2);
}

.message-content {
    flex: 1;
    line-height: 1.6;
    font-size: 1rem;
}

.user-message .message-content {
    color: white;
}

.assistant-message .message-content {
    color: var(--text-color);
}

.message-content h1,
.message-content h2,
.message-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.message-content p {
    margin-bottom: 0.75rem;
}

.message-content ul,
.message-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.message-content code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.message-content pre {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.75rem 0;
}

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

.input-container {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    background-color: white;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 1rem;
    z-index: 10;
}

#messageInput {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    resize: none;
    background-color: var(--input-bg);
    transition: border-color 0.2s;
    font-family: inherit;
    max-height: 150px;
    overflow-y: auto;
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#sendBtn {
    padding: 0.75rem 1.5rem;
}

#sendBtn i {
    font-size: 1rem;
}

/* Typing indicator */
.typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background-color: var(--message-bg);
    border-radius: 12px;
    min-width: 0;
    width: fit-content;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    flex-wrap: nowrap;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot:nth-child(1) {
    animation: thinkingDot 1.4s infinite ease-in-out;
    animation-delay: 0s;
}

.dot:nth-child(2) {
    animation: thinkingDot 1.4s infinite ease-in-out;
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation: thinkingDot 1.4s infinite ease-in-out;
    animation-delay: 0.4s;
}

@keyframes thinkingDot {
    0%, 60%, 100% { 
        opacity: 0.3; 
        transform: translateY(0) scale(0.8); 
    }
    30% { 
        opacity: 1; 
        transform: translateY(-8px) scale(1); 
    }
}

.thinking-message .message-content {
    background: none;
    padding: 0;
    display: inline-block;
    white-space: nowrap;
}

.error {
    color: #dc2626;
    background-color: #fef2f2;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .nav-logo span {
        font-size: 1rem;
    }

    .chat-container {
        padding: 1rem;
    }

    .messages {
        top: 1rem;
        bottom: 100px;
        left: 1rem;
        right: 1rem;
    }

    .message {
        padding: 0.75rem;
    }

    .user-message {
        max-width: 85%;
    }

    .input-container {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        padding: 0.75rem;
    }

    #sendBtn {
        padding: 0.75rem;
    }
}

