:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #fae8ff 100%);
    --surface: rgba(255, 255, 255, 0.85);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --ai-msg: #ffffff;
    --user-msg: linear-gradient(135deg, #4F46E5, #6366F1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    width: 100%;
    max-width: 900px;
    height: 95vh;
    max-height: 900px;
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 10px;
}

.header {
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    z-index: 10;
}

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

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.ai-avatar-header, .ai-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}

.user-avatar {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.logo-container h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.status {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.icon-btn {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.chat-container {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

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

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

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

.message {
    display: flex;
    gap: 15px;
    max-width: 85%;
    animation: fadeIn 0.3s ease forwards;
}

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

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

.message-content {
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    word-wrap: break-word;
}

.message.ai .message-content {
    background: var(--ai-msg);
    border-bottom-left-radius: 4px;
    color: var(--text-main);
    border: 1px solid rgba(0,0,0,0.03);
}

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

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

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

.message-content code {
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}
.message.user .message-content code {
    background: rgba(255,255,255,0.2);
}

.message-content pre {
    background: #1f2937;
    color: #f3f4f6;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin-top: 8px;
    font-size: 0.85rem;
}

/* Quick Questions */
.quick-questions {
    margin-top: 10px;
    margin-left: 60px;
    animation: fadeIn 0.5s ease forwards;
}

.quick-title {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    background: white;
    border: 1px solid rgba(79, 70, 229, 0.2);
    color: var(--primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.chip:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

/* Loading Indicator */
.loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    padding: 10px 0;
    margin-left: 60px;
    animation: fadeIn 0.3s ease forwards;
}

.dots {
    display: flex;
    gap: 4px;
}

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

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

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

/* Input Area */
.input-area {
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 24px;
    padding: 8px 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

textarea {
    flex: 1;
    border: none;
    resize: none;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.95rem;
    background: transparent;
    max-height: 120px;
    outline: none;
    color: var(--text-main);
}

textarea::placeholder {
    color: #9ca3af;
}

.send-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    margin-right: 4px;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.api-key-warning {
    color: #ef4444;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
}

/* Responsive */
@media (max-width: 600px) {
    .app-container {
        height: 100vh;
        max-height: none;
        border-radius: 0;
        margin: 0;
        border: none;
    }
    
    .message {
        max-width: 95%;
    }
    
    .quick-questions, .loading {
        margin-left: 0;
    }
    
    .header {
        padding: 15px 20px;
    }
    
    .chat-container {
        padding: 20px;
    }
    
    .input-area {
        padding: 15px 20px;
    }
}
