/* Modern AI Nutrition Bot Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #EC4899 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.15"/><circle cx="10" cy="50" r="0.5" fill="white" opacity="0.15"/><circle cx="90" cy="30" r="0.5" fill="white" opacity="0.15"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.container {
    width: 100%;
    max-width: 900px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

h1 {
    text-align: center;
    padding: 28px 24px;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    position: relative;
}

h1::after {
    content: '🥗';
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.chat-container {
    height: 550px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #fafafa;
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

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

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

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

.chat-window::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.message {
    max-width: 75%;
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(20px) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

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

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

.message-content {
    padding: 16px 20px;
    border-radius: 20px;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 15px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.user-message .message-content {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.ai-message .message-content {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-message .message-content strong {
    color: #4F46E5;
    font-weight: 700;
    font-size: 16px;
}

.ai-message .message-content b {
    color: #7C3AED;
    font-weight: 600;
}

.ai-message .message-content em {
    color: #EC4899;
    font-style: italic;
}

.ai-message .message-content h1,
.ai-message .message-content h2,
.ai-message .message-content h3 {
    color: #4F46E5;
    margin: 20px 0 12px 0;
    font-weight: 600;
}

.ai-message .message-content h2 {
    font-size: 18px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 6px;
}

.ai-message .message-content h3 {
    font-size: 16px;
    color: #7C3AED;
}

.ai-message .message-content ul {
    margin: 12px 0;
    padding-left: 20px;
}

.ai-message .message-content li {
    margin: 8px 0;
    line-height: 1.6;
}

.ai-message .message-content p {
    margin: 12px 0;
    line-height: 1.7;
}

.ai-message .message-content pre {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    overflow-x: auto;
}

.ai-message .message-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #1f2937;
    font-size: 14px;
}

.ai-message .message-content blockquote {
    border-left: 4px solid #4F46E5;
    padding-left: 16px;
    margin: 16px 0;
    font-style: italic;
    color: #6b7280;
}

.ai-message .message-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, #4F46E5 0%, #7C3AED 50%, #EC4899 100%);
    margin: 24px 0;
    border-radius: 1px;
}

.typing-indicator {
    padding: 24px;
    display: flex;
    align-items: center;
}

.typing-dots {
    display: flex;
    gap: 6px;
    padding: 16px 20px;
    background: white;
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-dots span {
    width: 10px;
    height: 10px;
    background: #4F46E5;
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

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

@keyframes bounce {
    0%, 60%, 100% { 
        transform: translateY(0); 
        background: #4F46E5;
    }
    30% { 
        transform: translateY(-12px); 
        background: #7C3AED;
    }
}

.input-container {
    display: flex;
    padding: 20px;
    gap: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: white;
}

#user-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    background: #fafafa;
    font-family: inherit;
    color: #1f2937;
}

#user-input:focus {
    border-color: #4F46E5;
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#user-input::placeholder {
    color: #9ca3af;
}

button {
    padding: 14px 24px;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

#send-button {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

#send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

#send-button:active {
    transform: translateY(0);
}

#clear-button {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

#clear-button:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.quick-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.quick-btn {
    background: white;
    color: #4F46E5;
    border: 2px solid #4F46E5;
    padding: 12px 20px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.quick-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    transition: left 0.3s ease;
    z-index: -1;
}

.quick-btn:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.quick-btn:hover::before {
    left: 0;
}

/* Enhanced Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        margin: 0;
        border-radius: 20px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.5rem;
        padding: 20px 16px;
    }
    
    h1::after {
        display: none;
    }
    
    .chat-window {
        height: 450px;
        padding: 16px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .message-content {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .input-container {
        flex-direction: column;
        padding: 16px;
        gap: 8px;
    }
    
    #user-input {
        padding: 12px 16px;
    }
    
    button {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .quick-buttons {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 8px;
    }
    
    .quick-btn {
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .container {
        background: rgba(17, 24, 39, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .chat-container {
        background: #111827;
    }
    
    .ai-message .message-content {
        background: #1f2937;
        color: #f9fafb;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .ai-message .message-content strong {
        color: #60a5fa;
    }
    
    .ai-message .message-content b {
        color: #818cf8;
    }
    
    .ai-message .message-content em {
        color: #f472b6;
    }
    
    .ai-message .message-content h1,
    .ai-message .message-content h2,
    .ai-message .message-content h3 {
        color: #60a5fa;
    }
    
    .ai-message .message-content h2 {
        border-color: rgba(96, 165, 250, 0.2);
    }
    
    .ai-message .message-content h3 {
        color: #818cf8;
    }
    
    .input-container {
        background: #1f2937;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    #user-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    #user-input::placeholder {
        color: #9ca3af;
    }
    
    .quick-buttons {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    }
    
    .quick-btn {
        background: #374151;
        border-color: #4F46E5;
    }
}
