:root {
    --bg-color: #f3f4f6;
    --chat-bg: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #e5e7eb;
    --secondary-hover: #d1d5db;
    --bot-msg-bg: #f9fafb;
    --bot-msg-border: #e5e7eb;
    --user-msg-bg: #4f46e5;
    --user-msg-text: #ffffff;
    --header-bg: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg);
    box-shadow: var(--shadow-md);
}

@media (min-width: 768px) {
    .app-container {
        height: 95vh;
        border-radius: var(--radius-lg);
        overflow: hidden;
    }
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--bot-msg-border);
    z-index: 10;
}

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

.logo-icon {
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.header-logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Chat Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

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

.bot-message {
    align-self: flex-start;
}

.bot-message .message-avatar {
    background-color: #e0e7ff;
    color: var(--primary-color);
}

.bot-message .message-content {
    background-color: var(--bot-msg-bg);
    border: 1px solid var(--bot-msg-border);
    color: var(--text-color);
    border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background-color: var(--secondary-color);
    color: var(--text-muted);
}

.user-message .message-content {
    background-color: var(--user-msg-bg);
    color: var(--user-msg-text);
    border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg);
}

.message-content {
    padding: 1rem 1.25rem;
    line-height: 1.5;
    font-size: 0.95rem;
    word-break: break-word;
}

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

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

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

.message-content code {
    font-family: monospace;
    background-color: rgba(0,0,0,0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

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

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

/* Loading Indicator */
.typing-indicator {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Quick Questions */
.quick-questions {
    padding: 0 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quick-btn {
    background-color: transparent;
    border: 1px solid var(--bot-msg-border);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:hover {
    background-color: var(--bot-msg-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Input Area */
.input-container {
    padding: 0 1.5rem 1.5rem 1.5rem;
    background-color: var(--chat-bg);
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    background-color: var(--bot-msg-bg);
    border: 1px solid var(--bot-msg-border);
    border-radius: var(--radius-lg);
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    align-items: flex-end;
    transition: border-color 0.2s;
}

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

textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    padding: 0.5rem 0;
    font-family: var(--font-family);
    font-size: 1rem;
    color: var(--text-color);
    max-height: 150px;
    outline: none;
}

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

.footer-text {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--chat-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 450px;
    padding: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.modal-body p {
    font-size: 0.95rem;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.modal-body input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--bot-msg-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    outline: none;
}

.modal-body input:focus {
    border-color: var(--primary-color);
}

.modal-help {
    font-size: 0.85rem !important;
    color: var(--text-muted) !important;
}

.modal-help a {
    color: var(--primary-color);
    text-decoration: none;
}

.modal-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

/* Hide scrollbar for neatness */
.chat-box::-webkit-scrollbar {
    width: 6px;
}
.chat-box::-webkit-scrollbar-track {
    background: transparent;
}
.chat-box::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.chat-box::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
