/* --- Global Styles for the App --- */
#ai-product-advisor-app {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: #f7fafc; /* Light gray background */
    padding: 20px;
    border-radius: 12px;
    margin: 2rem auto 20px auto; /* Added 2rem margin to the top */
}

/* --- Card Layout --- */
#ai-product-advisor-app .card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 2rem; /* Increased padding */
    max-width: 800px; /* Max width for the card */
    margin: 0 auto; /* Center the card inside the app container */
}

/* --- Typography --- */
#ai-product-advisor-app .text-center { text-align: center; }
#ai-product-advisor-app .mb-8 { margin-bottom: 2rem; }
#ai-product-advisor-app .mt-2 { margin-top: 0.5rem; }
#ai-product-advisor-app .text-3xl { font-size: 1.875rem; }
#ai-product-advisor-app .font-bold { font-weight: 700; }
#ai-product-advisor-app .text-gray-800 { color: #2d3748; }
#ai-product-advisor-app .text-gray-500 { color: #718096; }

/* --- Input Fields & Buttons --- */
#ai-product-advisor-app .product-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#ai-product-advisor-app .product-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

#ai-product-advisor-app .flex { display: flex; }
#ai-product-advisor-app .items-center { align-items: center; }
#ai-product-advisor-app .space-x-2 > * + * { margin-left: 0.5rem; }
#ai-product-advisor-app .space-y-4 > * + * { margin-top: 1rem; }
#ai-product-advisor-app .mb-4 { margin-bottom: 1rem; }
#ai-product-advisor-app .mb-6 { margin-bottom: 1.5rem; }
#ai-product-advisor-app .justify-between { justify-content: space-between; }

/* General Button Styles */
#ai-product-advisor-app button {
    cursor: pointer;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}
#ai-product-advisor-app button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

/* Specific Buttons */
#ai-product-advisor-app #add-product {
    color: #3182ce;
    background: none;
    padding: 0.5rem;
}
#ai-product-advisor-app #add-product:hover {
    color: #2b6cb0;
}

#ai-product-advisor-app #analyze-btn {
    background-color: #3182ce;
    color: white;
    padding: 0.75rem 2rem;
}
#ai-product-advisor-app #analyze-btn:hover {
    background-color: #2b6cb0;
}

#ai-product-advisor-app .voice-search {
    padding: 0.75rem;
    background-color: #e2e8f0;
}
#ai-product-advisor-app .voice-search:hover {
    background-color: #cbd5e0;
}
#ai-product-advisor-app .voice-search.bg-red-500 { background-color: #e53e3e; } /* For active state */
#ai-product-advisor-app .voice-search.text-white { color: white; }

#ai-product-advisor-app .remove-product {
    color: #e53e3e;
    background: none;
    font-size: 1.5rem;
    padding: 0 0.5rem;
}
#ai-product-advisor-app .remove-product:hover {
    color: #c53030;
}

#ai-product-advisor-app #reset-btn {
    background-color: #4a5568;
    color: white;
    padding: 0.5rem 1.5rem;
    margin-top: 1.5rem;
}
#ai-product-advisor-app #reset-btn:hover {
    background-color: #2d3748;
}

/* --- Loader & Result Section --- */
#ai-product-advisor-app .hidden { display: none; }
#ai-product-advisor-app #loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 0;
}
#ai-product-advisor-app .loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}
#ai-product-advisor-app .ml-4 { margin-left: 1rem; }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- AI Response Formatting --- */
.prose-styles { max-width: 100%; }
.prose-styles h1, .prose-styles h2, .prose-styles h3, .prose-styles h4 {
    color: #1f2937;
    font-weight: 600;
    margin-bottom: 1rem;
    margin-top: 2rem;
}
.prose-styles h3 { font-size: 1.25rem; }
.prose-styles h4 { font-size: 1.1rem; }
.prose-styles p { line-height: 1.7; margin-bottom: 1.25rem; }
.prose-styles ul { list-style-type: disc; padding-left: 25px; margin-bottom: 1.25rem; }
.prose-styles li { margin-bottom: 0.5rem; }
.prose-styles table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.prose-styles th, .prose-styles td {
    border: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
    text-align: left;
}
.prose-styles th {
    background-color: #f9fafb;
    font-weight: 600;
}
.prose-styles tr:nth-child(even) {
    background-color: #f9fafb;
}

/* --- Affiliate Button Styles --- */
.affiliate-button {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: white !important;
    font-weight: bold;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-right: 10px;
    margin-top: 5px;
    border: none;
}
.affiliate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.affiliate-button.amazon {
    background: linear-gradient(135deg, #FF9900, #F2C200);
}
.affiliate-button.flipkart {
    background: linear-gradient(135deg, #2874F0, #1A9AF8);
}

/* --- Responsive Design --- */
@media (max-width: 640px) {
    #ai-product-advisor-app .card {
        padding: 1.5rem;
    }
    #ai-product-advisor-app .text-3xl {
        font-size: 1.5rem;
    }
    #ai-product-advisor-app #input-section .flex.justify-between {
        flex-direction: column;
        align-items: stretch;
    }
    #ai-product-advisor-app #input-section .flex.justify-between > * + * {
        margin-left: 0;
        margin-top: 1rem;
    }
    #ai-product-advisor-app #analyze-btn {
        width: 100%;
    }
}
