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

:root {
    /* Light Theme Colors */
    --primary: #4F46E5;
    --primary-light: #6366F1;
    --primary-dark: #4338CA;
    --secondary: #10B981;
    --background: #F9FAFB;
    --surface: #FFFFFF;
    --surface-hover: #F3F4F6;
    --border: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --user-message: #4F46E5;
    --ai-message: #F3F4F6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo svg {
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 400;
}

/* Main Container */
.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
}

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

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

.chat-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Welcome Message */
.welcome-message {
    max-width: 700px;
    margin: 4rem auto;
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

.welcome-message h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.welcome-message>p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.example-questions {
    margin-top: 2rem;
}

.example-title {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.example-btn {
    display: block;
    width: 100%;
    max-width: 500px;
    margin: 0.75rem auto;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
}

.example-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Messages */
.message {
    margin-bottom: 1.5rem;
    animation: slideIn 0.4s ease-out;
    max-width: 800px;
}

.message-user {
    margin-left: auto;
    display: flex;
    justify-content: flex-end;
}

.message-user .message-content {
    background: var(--user-message);
    color: white;
    padding: 0.875rem 1.25rem;
    border-radius: 18px 18px 4px 18px;
    max-width: 80%;
    box-shadow: var(--shadow-sm);
    font-size: 0.95rem;
    line-height: 1.5;
}

.message-ai {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.message-ai .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    color: white;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

.message-ai .message-content {
    background: var(--ai-message);
    padding: 0.875rem 1.25rem;
    border-radius: 18px 18px 18px 4px;
    max-width: 80%;
    line-height: 1.6;
    font-size: 0.95rem;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

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

.section-reference {
    font-weight: 600;
    color: var(--text-primary);
}

.sql-query {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: #F8F9FA;
    border-radius: 8px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
}

.sql-query strong {
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.8rem;
}

.sql-query code {
    color: var(--text-primary);
    font-family: 'Monaco', 'Courier New', monospace;
    word-break: break-all;
    display: block;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    animation: slideIn 0.4s ease-out;
}

.typing-indicator .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 600;
    color: white;
    font-size: 0.875rem;
}

.typing-dots {
    background: var(--ai-message);
    padding: 1rem 1.5rem;
    border-radius: 18px 18px 18px 4px;
    display: flex;
    gap: 0.4rem;
    border: 1px solid var(--border);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.4s infinite;
}

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

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

/* Input Container */
.input-container {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 24px;
    padding: 0.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), var(--shadow);
}

#questionInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    padding: 0.75rem 1rem;
    line-height: 1.5;
}

#questionInput::placeholder {
    color: var(--text-muted);
}

#sendBtn {
    background: var(--primary);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#sendBtn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

#sendBtn:active {
    transform: scale(0.95);
}

#sendBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

.disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

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

    .logo h1 {
        font-size: 1.25rem;
    }

    .chat-container {
        padding: 1rem;
    }

    .welcome-message {
        margin: 2rem auto;
    }

    .welcome-message h2 {
        font-size: 1.5rem;
    }

    .message-content {
        max-width: 90% !important;
    }

    .input-container {
        padding: 1rem;
    }
}