/* --------------------------------------------------
   Global Layout & Typography
-------------------------------------------------- */

body {
    font-family: 'IBM Plex Mono', monospace;
    margin: 40px;
    background: #fafafa;
    color: #333;
    line-height: 1.6;
}

h1 {
    font-size: 32px;
    margin-bottom: 20px;
}

h2 {
    font-size: 24px;
    margin-top: 30px;
    margin-bottom: 10px;
}

h3 {
    font-size: 18px;
    margin-top: 20px;
    margin-bottom: 8px;
}

main {
    max-width: 1200px;
    margin: 0 auto;
}

/* --------------------------------------------------
   Navigation Bar
-------------------------------------------------- */

nav {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid #ddd;
}

nav a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

nav a:hover {
    background: #eaeaea;
}

/* --------------------------------------------------
   Recipe Index Page (Alphabetical Grid)
-------------------------------------------------- */

.recipe-index {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.recipe-index li {
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    text-align: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.recipe-index li:hover {
    background: #e6f2e6;
    transform: translateY(-2px);
}

.recipe-index a {
    text-decoration: none;
    color: #0D4A2C; /* matches your LR favicon theme */
    font-weight: 600;
    font-size: 1rem;
}

/* --------------------------------------------------
   Slide-down shopping panel (Hybrid Style)
-------------------------------------------------- */

.shopping-panel {
    max-width: 1600px;
    margin: 1rem auto;
    padding: 1.5rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: none; /* hidden by default */
    animation: slideDown 0.3s ease-out;
    position: relative;
}

.shopping-close-x {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 24px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    line-height: 1;
}

.shopping-close-x:hover {
    color: #000;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.shopping-toggle {
    background: #333;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    margin-bottom: 1rem;
}

.shopping-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.shopping-actions button {
    background: #333;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.shopping-actions button:hover {
    background: #555;
}

.shopping-panel h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.shopping-category {
    margin-top: 1rem;
    font-weight: bold;
    font-size: 1.1rem;
}

.shopping-item {
    margin-left: 1rem;
    margin-bottom: 0.3rem;
}

/* Mobile-friendly */
@media (max-width: 800px) {
    .shopping-panel {
        padding: 1rem;
    }

    .shopping-actions {
        flex-direction: column;
    }

    .shopping-actions button {
        width: 100%;
    }
}

/* --------------------------------------------------
   Search Bar
-------------------------------------------------- */

.search-bar input {
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    min-width: 180px;
}

/* --------------------------------------------------
   Tags / Badges
-------------------------------------------------- */

.tag {
    display: inline-block;
    background: #eee;
    padding: 4px 8px;
    margin-right: 6px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 12px;
    color: #555;
}

/* --------------------------------------------------
   Lists (Ingredients, Method)
-------------------------------------------------- */

ul, ol {
    margin-left: 20px;
    margin-bottom: 20px;
}

li {
    margin-bottom: 6px;
}

/* --------------------------------------------------
   Shopping List Builder Page Layout
-------------------------------------------------- */

.shopping-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 4em);
}

.shopping-header {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 1em;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.shopping-body {
    display: flex;
    flex: 1;
    gap: 2em;
    padding-top: 1em;
}

.recipe-list {
    width: 40%;
    overflow-y: auto;
    padding-right: 1em;
    border-right: 1px solid #eee;
}

.recipe-item {
    display: block;
    padding: 0.5em 0;
}

.generated-list {
    flex: 1;
    overflow-y: auto;
    padding-left: 1em;
}

.placeholder {
    color: #777;
    font-style: italic;
}

.selected-info {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 1em;
}

/* --------------------------------------------------
   Shopping List Builder — Mobile Layout
-------------------------------------------------- */
@media (max-width: 700px) {

    .shopping-container {
        height: auto;
        padding: 0 1rem;
    }

    .shopping-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        position: static;
        padding: 1rem 0;
    }

    .shopping-body {
        flex-direction: column;
        gap: 2rem;
    }

    .recipe-list,
    .generated-list {
        width: 100%;
        padding: 0;
        border: none;
        overflow: visible;
    }

    .generated-list {
    padding-left: 0;
    overflow: visible;
    }


    .recipe-item {
        padding: 0.5rem 0;
        font-size: 1rem;
    }

    #generate-btn,
    .button {
        width: 100%;
        padding: 12px;
        font-size: 1.1rem;
        text-align: center;
    }

    nav {
        flex-direction: column;
        gap: 0.5rem;
    }

    nav a {
        padding: 0.5rem 0;
        font-size: 1.1rem;
    }

    nav form input {
        width: 100%;
        font-size: 1rem;
    }
}


/* --------------------------------------------------
   Buttons
-------------------------------------------------- */

button,
.button {
    display: inline-block;
    background: #333;
    color: #fff;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

button:hover,
.button:hover {
    background: #555;
}

/* --------------------------------------------------
   Recipe Forms
-------------------------------------------------- */

form label {
    display: block;
    margin-bottom: 8px;
}

/* --------------------------------------------------
   Hero image (full width)
-------------------------------------------------- */

.hero-photo img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin-bottom: 2rem;
    display: block;
}

/* --------------------------------------------------
   Two-column flowing layout
-------------------------------------------------- */

.recipe-columns {
    column-count: 2;
    column-gap: 2.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

.recipe-section,
.recipe-section h2,
.recipe-section h3,
.recipe-section ul,
.recipe-section ol {
    break-inside: avoid;
    margin-bottom: 2rem;
}

/* --------------------------------------------------
   Section images
-------------------------------------------------- */

.section-photos img {
    max-width: 40%;
    display: block;
    margin: 0.5rem auto 1rem auto;
    border-radius: 8px;
    break-inside: avoid;
}

/* --------------------------------------------------
   Responsive collapse
-------------------------------------------------- */

@media (max-width: 800px) {
    .recipe-columns {
        column-count: 1;
    }

    .section-photos img {
        max-width: 100%;
        margin: 1rem 0;
    }
}

.recipe-notes {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    font-size: 0.9rem;
    color: #555;
    font-style: italic;
}

/* --------------------------------------------------
   PRINT MODE — Unified
-------------------------------------------------- */
@media print {

    /* Hide everything by default */
    body * {
        visibility: hidden !important;
    }

    /* ------------------------------
       PRINT SHOPPING LIST ONLY
    ------------------------------ */
    body.print-shopping-list #shopping-list-panel,
    body.print-shopping-list #shopping-list-panel * {
        visibility: visible !important;
    }

    body.print-shopping-list #shopping-list-panel {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        box-shadow: none;
        border: none;
        padding: 0;
        margin: 0;
    }

    body.print-shopping-list #close-list,
    body.print-shopping-list #close-list-x,
    body.print-shopping-list .shopping-actions {
        display: none !important;
    }

    /* ------------------------------
       PRINT RECIPE ONLY
    ------------------------------ */
    body.print-recipe main,
    body.print-recipe main * {
        visibility: visible !important;
    }

    body.print-recipe nav,
    body.print-recipe #shopping-list-panel {
        display: none !important;
    }

    body.print-recipe .recipe-columns {
        column-count: 1 !important;
        max-width: 100% !important;
    }

    body.print-recipe body {
        margin: 0 !important;
        padding: 20px !important;
    }

    body.print-recipe .recipe-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
