:root {
    --primary-blue: #030193;
    --primary-dark: #020170;
    --primary-light: #e1e7ff;
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #d1d1d1;
    --gray-500: #6B7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --success: #10B981;
    --info: #3B82F6;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    font-size: 16px;
    color: var(--gray-900);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-blue) 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Chat Container */
.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    max-height: 700px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    color: var(--white);
    padding: 1.5rem;
    text-align: center;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.header-content p {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--gray-50);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--gray-500);
    border-radius: 3px;
}

/* Message Styles */
.message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-in;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message-bubble {
    padding: 1rem;
    border-radius: 12px;
    line-height: 1.6;
}

.message-bubble p {
    margin-bottom: 0.5rem;
}

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

/* Bot Message */
.bot-message .message-avatar {
    background: var(--primary-blue);
}

.bot-message .message-bubble {
    background: var(--white);
    border: 1px solid var(--gray-200);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* User Message */
.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: var(--success);
}

.user-message .message-bubble {
    background: var(--primary-blue);
    color: var(--white);
}

.user-message .message-content {
    align-items: flex-end;
}

/* Sources */
.message-sources {
    font-size: 0.75rem;
    color: var(--gray-500);
    padding: 0.5rem;
    background: var(--gray-100);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.message-sources strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--gray-700);
}

.source-item {
    padding: 0.25rem 0;
}

.source-domain {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--primary-light);
    color: var(--white);
    border-radius: 10px;
    font-size: 0.7rem;
    margin-right: 0.5rem;
}

/* Suggestions */
.suggestions {
    padding: 1rem 1.5rem;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

.suggestions-title {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-btn {
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-btn:hover {
    background: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
}

/* Input Area */
.chat-input-container {
    padding: 1rem 1.5rem;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

.chat-form {
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 24px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--primary-blue);
}

.send-button {
    width: 48px;
    height: 48px;
    background: var(--primary-blue);
    border: none;
    border-radius: 50%;
    color: var(--white);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.send-button:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
}

/* Loading Indicator */
.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--white);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .chat-container {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .chat-messages {
        padding: 1rem;
    }

    .suggestions {
        padding: 0.75rem 1rem;
    }

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

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 1rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--gray-500);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}
