/* --- Color Palette --- */
/* Primary: #E74C3C (Rustic Red/Tomato) */
/* Accent: #27AE60 (Earthy Green/Herb) */
/* Highlight: #F1C40F (Sunny Yellow/Spice) */
/* Text: #34495E (Dark Slate/Subtle) */
/* Background: #FDF5E6 (Creamy White/Linen) */
/* Border/Light: #ECF0F1 (Light Grey/Flour) */


body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #FDF5E6;
    color: #34495E;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16px; /* Set a base font size for rem calculations */
}

header {
    background: #E74C3C;
    color: #fff;
    padding: 1.5rem 0;
    text-align: center;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    padding-bottom: 0.5rem;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem; /* Space between nav links */
    margin-top: 0.5rem;
}

nav a {
    color: #fff;
    text-decoration: none;
    padding: 0.6rem 1.5rem;
    display: inline-block;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border-radius: 5px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3); /* Subtle border */
}

nav a:hover {
    background: #C0392B;
    transform: translateY(-2px);
}

main {
    max-width: 70ch; /* Max width based on character count for readability */
    width: 90%; /* Still allows it to shrink on smaller screens */
    
    padding: 2rem;
    margin: 2rem auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    flex-grow: 1;
}

h2 {
    color: #E74C3C;
    border-bottom: 2px solid #ECF0F1;
    padding-bottom: 0.8rem;
    margin-top: 0;
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.5rem;
}

#loading-message {
    font-style: italic;
    color: #666;
    text-align: center;
    padding: 2rem;
    font-size: 1.1rem;
}

.recipe-list {
    list-style: none;
    padding: 0;
}

.recipe-list li {
    background: #ECF0F1;
    margin-bottom: 1rem;
    padding: 1.2rem;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.recipe-list li:hover {
    background: #D9DCDE;
    transform: translateY(-3px);
}

.recipe-list li a {
    text-decoration: none;
    color: #34495E;
    font-weight: 600;
    font-size: 1.2rem;
    flex-grow: 1;
    display: block;
    margin-right: 1rem;
}

.recipe-list li a:hover {
    color: #E74C3C;
}

#back-to-list-btn {
    background-color: #27AE60;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#back-to-list-btn:hover {
    background-color: #229954;
    transform: translateY(-1px);
}

#recipe-body {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px solid #ECF0F1;
    background-color: #fcfcfc;
    border-radius: 8px;
    line-height: 1.8;
}

#recipe-body h3 {
    color: #27AE60;
    font-size: 1.6rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

#recipe-body p, #recipe-body ul, #recipe-body ol {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

#recipe-body ul, #recipe-body ol {
    margin-left: 1.5rem;
}

footer {
    text-align: center;
    padding: 1.5rem;
    color: #777;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-top: auto;
    background-color: #ECF0F1;
    border-top: 1px solid #D9DCDE;
}

/* --- NEW/ADJUSTED STYLES for Index Controls --- */
#index-controls-container {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #fcfcfc;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
}

#alphabet-nav-container {
    /* No specific margin-bottom here, it's inside index-controls-container */
}

.alphabet-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
}

.alphabet-nav-link {
    display: inline-block;
    text-decoration: none;
    color: #E74C3C;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.alphabet-nav-link:hover {
    background-color: #E74C3C;
    color: white;
}

.alphabet-nav-link.active {
    background-color: #27AE60;
    color: white;
    font-weight: 700;
}

/* We removed the disabled-letter class in JS, so this CSS rule is no longer needed */
/* .alphabet-nav-link.disabled-letter { ... } */


/* Optional: Badge for tags on recipe list items */
.recipe-tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-left: auto;
    font-size: 0.8rem;
    align-items: center;
}

.recipe-tag-badge {
    background-color: #FDF5E6;
    color: #E74C3C;
    border: 1px solid #E74C3C;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}

/* --- Responsive adjustments for smaller screens --- */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    main {
        width: 95%;
        padding: 1.5rem;
        margin: 1.5rem auto;
    }

    h2 {
        font-size: 1.6rem;
    }

    .recipe-list li {
        padding: 1rem;
    }

    .recipe-list li a {
        font-size: 1.1rem;
    }

    #back-to-list-btn {
        padding: 0.7rem 1.2rem;
        font-size: 1rem;
    }
    
    .alphabet-nav-link {
        font-size: 1rem;
        padding: 0.2rem 0.5rem;
    }

    nav {
        flex-direction: column; /* Stack nav links on small screens */
        gap: 0.8rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }

    nav a {
        padding: 0.4rem 0.8rem;
    }

    main {
        padding: 1rem;
        margin: 1rem auto;
    }

    h2 {
        font-size: 1.4rem;
    }

    .recipe-list li {
        padding: 0.8rem;
    }

    .recipe-list li a {
        font-size: 1rem;
    }

    #back-to-list-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}
