/* Your full "Insanely Good" style.css from before */
:root {
    --primary-color: #ff6347; /* Tomato */
    --secondary-color: #4CAF50; /* Green */
    --background-color: #f4f4f9; /* Light grey */
    --text-color: #333;
    --card-bg-color: #ffffff;
    --border-radius: 12px;
    --box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    --font-primary: 'Poppins', sans-serif;
    --font-secondary: 'Playfair Display', serif;
}

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

body {
    font-family: var(--font-primary);
    background-color: var(--background-color); /* Fallback */
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align to top for scroll */
    min-height: 100vh;
    padding: 20px;
    background-image: linear-gradient(to bottom right, #ff7e5f, #feb47b); /* Subtle gradient */
}

.container {
    width: 100%;
    max-width: 900px;
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px 40px;
    /* overflow: hidden; */ /* MODIFICATION: Comment out or set to visible for PDF page flow */
    overflow: visible; /* Allow content to flow for PDF */
    animation: fadeInContainer 0.8s ease-out;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    animation: slideDownHeader 0.6s ease-out;
}

@keyframes slideDownHeader {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-title {
    font-family: var(--font-secondary);
    font-size: 3.5em;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.logo-title .beta-tag {
    font-family: var(--font-primary);
    font-size: 0.3em;
    color: var(--secondary-color);
    vertical-align: super;
    margin-left: 5px;
    font-weight: 600;
}

.tagline {
    font-size: 1.1em;
    color: #555;
}

.search-area {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    animation: popInSearch 0.7s ease-out 0.3s backwards;
}

@keyframes popInSearch {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

#food-query {
    flex-grow: 1;
    padding: 15px 20px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1.1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#food-query:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 99, 71, 0.3);
}

#get-recipe-btn {
    background-image: linear-gradient(to right, var(--primary-color), #ff8a65);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#get-recipe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 99, 71, 0.4);
}

#get-recipe-btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 8px rgba(255, 99, 71, 0.3);
}

.button-icon {
    display: inline-block;
    animation: sparkle 1.5s infinite;
}

@keyframes sparkle {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.loading-indicator {
    text-align: center;
    padding: 30px;
    color: var(--primary-color);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 99, 71, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background-color: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 20px;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}

/* Container for recipe output and download button */
#recipe-output-container {
    /* This element itself doesn't need overflow modifications for PDF */
    /* Its child #recipe-output-area is the one that matters for content flow */
}


/* This is the element whose content is sent for PDF */
#recipe-output-area {
    background-color: #fff; /* White or very light for contrast */
    padding: 25px;
    border-radius: var(--border-radius);
    /* margin-top: 20px; Handled by container */
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); /* This shadow will be rendered in PDF */
    animation: slideUpRecipe 0.7s ease-out;
    overflow: visible !important; /* MODIFICATION: CRITICAL for PDF full content flow */
}

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

#recipe-title {
    font-family: var(--font-secondary);
    color: var(--primary-color);
    font-size: 2.2em;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
}

#recipe-content {
    font-size: 1.05em;
    overflow: visible !important; /* MODIFICATION: CRITICAL for PDF full content flow */
}

#recipe-content h3 {
    font-family: var(--font-primary);
    font-weight: 600;
    color: var(--secondary-color);
    margin-top: 25px;
    margin-bottom: 10px;
    font-size: 1.4em;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    page-break-after: avoid; /* PDF hint */
}

#recipe-content ul, #recipe-content ol {
    margin-left: 25px;
    margin-bottom: 15px;
    padding-left: 10px; /* Better alignment for custom bullets */
}

#recipe-content li {
    margin-bottom: 8px;
    padding-left: 10px;
    position: relative; /* For custom bullet positioning */
    page-break-inside: avoid; /* PDF hint */
}

/* Custom bullets for a bit more flair */
/* Puppeteer *should* be able to render emoji content */
#recipe-content ul li::before {
    content: "🍲"; /* Or any other food emoji / icon */
    position: absolute;
    left: -20px; /* Adjust if needed based on padding-left of li */
    top: 0px;   /* Adjust for vertical alignment */
    color: var(--primary-color);
    font-size: 1em; /* Ensure it scales with li text */
}
#recipe-content ol li::before {
    /* Let the default numbers show for ordered lists if ::before is problematic */
    content: "";
}

#recipe-content p {
    margin-bottom: 15px;
    page-break-inside: avoid; /* PDF hint */
}

#recipe-content strong {
    font-weight: 600;
    color: var(--text-color);
}

/* Styles for the download button (from previous stable version) */
.download-pdf-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    /* Reintroduce gradient if desired, Puppeteer handles gradients well */
    background-image: linear-gradient(to right, var(--secondary-color), #66bb6a);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: var(--border-radius);
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-image 0.3s ease;
    width: 100%;
    max-width: 300px;
    margin: 20px auto 0; /* Added margin-top */
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
}

.download-pdf-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.5);
    background-image: linear-gradient(to right, #66bb6a, var(--secondary-color));
}

.download-pdf-btn:active {
    transform: translateY(-1px) scale(1);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

.download-icon {
    font-size: 1.2em;
    display: inline-block;
    transition: transform 0.3s ease-out;
}

.download-pdf-btn:hover .download-icon {
    transform: rotate(-15deg) scale(1.1);
}


footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #777;
}

/* Responsive Design (from your "insanely good" version) */
@media (max-width: 768px) {
    .container { padding: 20px; margin: 10px; }
    .logo-title { font-size: 2.8em; }
    .search-area { flex-direction: column; }
    #food-query, #get-recipe-btn { font-size: 1em; width: 100%; }
    #recipe-title { font-size: 1.8em; }
    .download-pdf-btn { max-width: 100%; }
}

@media (max-width: 480px) {
    .logo-title { font-size: 2.2em; }
    .tagline { font-size: 0.9em; }
    /* .container { margin: 10px; padding: 15px; } */ /* .container already handled above */
    #food-query, #get-recipe-btn, #recipe-content, .download-pdf-btn { font-size: 0.9em; }
}


/* --- Print Specific Styles for Server-Side PDF --- */
/* These styles are applied by Puppeteer when rendering the PDF */
@media print {
    body {
        background-image: none !important; /* Remove body gradient for print */
        background-color: #fff !important; /* Ensure white background */
        -webkit-print-color-adjust: exact !important; /* Force printing of backgrounds and colors */
        print-color-adjust: exact !important;
    }

    .container {
        box-shadow: none !important;
        animation: none !important; /* Disable animations for print */
        overflow: visible !important; /* Crucial for multi-page PDFs */
        border-radius: 0 !important;
        padding: 0 !important; /* Let #recipe-output-area handle padding */
        margin: 0 !important;
        max-width: none !important; /* Allow full width */
    }

    header, .search-area, #get-recipe-btn, .loading-indicator, .error-message, footer, .download-pdf-btn {
        display: none !important; /* Hide elements not for PDF */
    }

    #recipe-output-container {
        margin: 0;
        padding: 0;
    }

    #recipe-output-area {
        margin: 0 !important; /* Server sets PDF page margins */
        padding: 20mm 15mm !important; /* Content padding within PDF page margins */
        box-shadow: none !important;
        border-radius: 0 !important;
        animation: none !important;
        overflow: visible !important;
        width: auto !important; /* Let content flow */
        /* background-color: #fff !important; Explicitly set white bg */
    }

    /* Ensure custom bullets are attempted, but have fallbacks */
    #recipe-content ul li::before {
        /* Emoji should render, but ensure it doesn't break layout */
        /* If emojis are an issue, switch to standard bullets for print: */
        /* content: "" !important; list-style-type: disc !important; position: static !important; */
    }

    /* Remove animations from elements that might be printed if any were missed */
    * {
        animation: none !important;
        transition: none !important;
    }
}