/* Styling for recipe index page */

body { /* Page fills the screen, so only the recipe list scrolls */
    height: 100dvh;
    display: flex;
    flex-direction: column;
}
#header {
    flex-shrink: 0;
}
#recipe-body {
    margin: 6rem auto 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
#recipe-list {
    list-style: none;
    margin: 0;
    padding: 0 0 4rem;
    text-align: center;
    flex: 1;
    overflow-y: auto;
}
#recipe-list li {
    margin: 0.8rem 0;
    font-size: 1.4rem;
}
#recipe-list a {
    color: var(--chalkboard);
}
#recipe-list a:hover {
    color: var(--dark-fava);
}
#recipe-list a.edit-recipe {
    margin-left: 0.5rem;
    font-size: 1.1rem;
    text-decoration: none;
    opacity: 0.6;
}
#recipe-list a.edit-recipe:hover {
    opacity: 1;
}
#recipe-filters {
    width: min(90%, 44rem);
    margin: 0 auto 2rem;
    flex-shrink: 0;
}
#recipe-filters::after { /* Short centered rule above the recipes, like the recipe viewer's; here so it doesn't scroll with them */
    content: '';
    display: block;
    width: 33%; /* About 30% of the page column, since the filters are a bit narrower */
    margin: 1.5rem auto 0;
    border-top: 1px solid var(--chalkboard);
}
#tag-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
    gap: 8px;
    margin-top: 10px;
}
#filter-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
    min-height: 1.8rem; /* Room for a row of pills even when empty, so the recipes don't jump when one is added */
}
/* Search bar: magnifying glass, search box, and the "Add filters" toggle, inside one border */
#search-bar {
    display: flex;
    align-items: center;
    border-radius: 5px;
    background-color: var(--offwhite);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
#search-icon {
    display: flex;
    padding: 0 4px 0 12px;
    color: var(--chalkboard-light);
    cursor: text;
}
#recipe-search {
    flex: 1;
    min-width: 0; /* Lets the box shrink on narrow screens */
    padding: 8px;
    border: none;
    font-family: 'EB Garamond', serif;
    font-size: 1.2rem;
    background: none;
    color: var(--chalkboard);
}
#recipe-search:focus {
    outline: none;
}
#recipe-search::-webkit-search-cancel-button { /* The browser's clear button, redrawn as an × in the site's colors */
    -webkit-appearance: none;
    width: 0.8rem;
    height: 0.8rem;
    margin-left: 6px;
    background-color: var(--chalkboard-light);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 1l8 8M9 1l-8 8' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
    cursor: pointer;
}
#recipe-search::-webkit-search-cancel-button:hover {
    background-color: var(--dark-fava);
}
#filter-toggle {
    align-self: stretch;
    padding: 0 14px;
    border: none;
    border-radius: 0 4px 4px 0; /* Follows the search bar's rounded corners */
    background-color: var(--aix-door); /* The recipe creator's background */
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: var(--chalkboard-light);
    white-space: nowrap;
    cursor: pointer;
}
#filter-toggle:hover,
#filter-toggle[aria-expanded="true"] {
    color: var(--dark-fava);
}
#filter-toggle::after { /* Down caret, flipped up while the filters are shown */
    content: "";
    display: inline-block;
    width: 0.35em;
    height: 0.35em;
    margin: 0 0 0.2em 0.5em;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    vertical-align: middle;
}
#filter-toggle[aria-expanded="true"]::after {
    margin-bottom: -0.1em;
    transform: rotate(-135deg);
}

/* Searchable multiselect filters (tagFilter.js) */
.tag-filter {
    position: relative;
}
.tag-filter-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 10px;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    text-align: center;
    background: none;
    color: var(--chalkboard);
    cursor: pointer; /* Reads as a button until you're typing in it */
}
.tag-filter-input::placeholder {
    color: var(--chalkboard-light);
}
.tag-filter-input:focus {
    outline: none;
}
.tag-filter-input:focus:not(:placeholder-shown) { /* Typing */
    cursor: text;
}
.tag-filter-input:focus::placeholder { /* Shows which filter you're in */
    color: var(--dark-fava);
}
.tag-filter-input:placeholder-shown { /* No caret blinking inside the centred label until you type */
    caret-color: transparent;
}
.tag-filter-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    text-align: left;
    background-color: var(--offwhite);
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.tag-filter-option {
    padding: 8px 12px;
    cursor: pointer;
    font-family: 'EB Garamond', serif;
    font-size: 1.05rem;
    color: var(--chalkboard);
}
.tag-filter-option:hover,
.tag-filter-option.highlighted {
    background-color: var(--light-fava);
    color: var(--offwhite);
}
.tag-filter-pills {
    display: contents; /* Each filter's pills flow in the shared row */
}
.tag-filter-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 4px 2px 10px;
    border-radius: 999px;
    background-color: var(--light-fava);
    color: var(--offwhite);
    font-family: 'EB Garamond', serif;
    font-size: 1rem;
}
.tag-filter-remove {
    border: none;
    background: none;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}
.tag-filter-remove:hover {
    color: var(--chalkboard);
}

@media (max-width: 700px) {
    #recipe-body { /* Keep the search bar near the top on small screens */
        margin-top: 3rem;
    }
    #filter-toggle { /* Caret only; the text stays for screen readers */
        font-size: 0;
    }
    #filter-toggle::after {
        font-size: 0.85rem;
        margin-left: 0;
    }
}
