/* Main container styling */
#ai-meal-coaching {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #eaeaea;
}

#ai-meal-coaching h1 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

/* Form elements styling */
#ai-meal-coaching label {
    display: block;
    margin: 1.25rem 0 0.5rem;
    font-weight: 500;
    color: #34495e;
    font-size: 0.95rem;
}

#ai-meal-coaching select {
    width: 100%;
    padding: 1rem 4rem 1rem 1rem; /* Significantly increased right padding */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: white;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1.5rem center; /* Moved arrow further right */
    background-size: 1rem;
    box-sizing: border-box;
    min-height: 54px; /* Increased height */
    line-height: 1.5; /* Better line height */
    text-overflow: ellipsis; /* Add ellipsis for very long text */
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden; /* Hide overflow */
}

#ai-meal-coaching select:focus {
    outline: none;
    border-color: #27bb34;
    box-shadow: 0 0 0 3px rgba(39, 187, 52, 0.1);
}

/* Fix for dropdown options */
#ai-meal-coaching select option {
    padding: 0.8rem;
    white-space: normal; /* Allow text wrapping in options */
}

#get-recommendations {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.9rem;
    background-color: #27bb34;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin: 1.75rem 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(39, 187, 52, 0.2);
}

#get-recommendations:hover {
    background-color: #1f9c2c;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(39, 187, 52, 0.3);
}

#get-recommendations:active {
    transform: translateY(0);
}

#get-recommendations:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading states */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    display: inline-block;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

.loading-spinner.large {
    width: 40px;
    height: 40px;
    border-width: 3px;
    margin: 0 auto 1rem;
    display: block;
}

.loading-spinner.small {
    width: 16px;
    height: 16px;
    margin-right: 8px;
}

.loading-state {
    text-align: center;
    padding: 2rem;
    color: #4a5568;
}

.loading-state p {
    margin: 0.5rem 0;
}

.loading-subtext {
    font-size: 0.9rem;
    color: #718096;
}

.error-state {
    text-align: center;
    padding: 2rem;
    color: #e53e3e;
    background: #fff5f5;
    border-radius: 8px;
    border: 1px solid #fed7d7;
}

.error-state p {
    margin: 0.5rem 0;
}

.retry-button {
    background-color: #e53e3e;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.retry-button:hover {
    background-color: #c53030;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #4a5568;
}

.empty-state p {
    margin: 0.5rem 0;
}

/* Meal recommendations styling */
.meal-recommendations-container {
    margin-top: 1.5rem;
    animation: fadeIn 0.4s ease-out;
}

.meal-recommendations-container h2 {
    color: #2c3e50;
    border-bottom: 2px solid #27bb34;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.meal-card {
    background-color: white;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.meal-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    border-color: #e0e0e0;
}

.meal-card h3 {
    color: #ff7e34;
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.meal-card p {
    margin: 0.5rem 0;
    color: #4a5568;
    font-size: 0.95rem;
    line-height: 1.5;
}

.meal-details {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #27bb34;
}

.meal-details p {
    margin: 0.5rem 0;
}

.save-meal {
    background-color: #27bb34;
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.save-meal:hover {
    background-color: #1f9c2c;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(39, 187, 52, 0.2);
}

.save-meal:active {
    transform: translateY(0);
}

.save-meal:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Chatbot styling */
#chatbot {
    margin-top: 2.5rem;
    border-top: 1px solid #f0f0f0;
    padding-top: 1.5rem;
}

#chatbot-messages {
    height: 250px;
    overflow-y: auto;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: white;
    scrollbar-width: thin;
    scrollbar-color: #e0e0e0 transparent;
}

#chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

#chatbot-messages::-webkit-scrollbar-thumb {
    background-color: #e0e0e0;
    border-radius: 3px;
}

.message {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 0.95rem;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease-out;
}

.user-message {
    background-color: #27bb34;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.bot-message {
    background-color: #f8f9fa;
    color: #2c3e50;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border: 1px solid #f0f0f0;
}

#chatbot-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

#chatbot-input:focus {
    outline: none;
    border-color: #27bb34;
    box-shadow: 0 0 0 3px rgba(39, 187, 52, 0.1);
}

/* Map styling */
#map {
    height: 300px;
    width: 100%;
    margin-top: 1.5rem;
    border-radius: 10px;
    border: 1px solid #eaeaea;
    overflow: hidden;
}

/* Responsive design */
@media (max-width: 768px) {
    #ai-meal-coaching {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    #ai-meal-coaching h1 {
        font-size: 1.5rem;
    }
    
    .meal-card {
        padding: 1rem;
    }
    
    #chatbot-messages {
        height: 200px;
    }

    /* Enhanced mobile dropdown styling */
    #ai-meal-coaching select {
        padding: 1.2rem 5rem 1.2rem 1.2rem; /* Even larger padding for mobile */
        font-size: 1.1rem; /* Larger font for mobile */
        min-height: 60px; /* Larger touch target for mobile */
        background-position: right 2rem center; /* Adjust arrow position */
        line-height: 1.6; /* Better line height for mobile */
    }
    
    /* Adjust label spacing for mobile */
    #ai-meal-coaching label {
        margin: 1.5rem 0 0.75rem;
        font-size: 1rem;
    }
}

/* Animation for messages */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}