html {
    line-height: 1.5;
    font-family: Helvetica, Sans-Serif;
}

hr {
    border-width: 1px 0 0 0;
    border-color: #37343442;
}

form  {
    display: table;
    margin-bottom: 16px;
}
form > p {
    display: table-row; 
    margin-top: 4px;
}
form > p > label {
    display: table-cell;
    padding-right: 4px;
}
form > p > input {
    display: table-cell; 
    margin-right: 4px;
}

form > p > button {
    display: table-cell; 
    padding-right: 4px;
}

button {
    background-color: white;
    color: black;
    border: 1px solid #ccc;
    border-radius: 3px;
    transition-duration: 0.15s;
}

button:hover {
    background-color: #f0f0f0;
    color: black;
    cursor: pointer;
}

input {
    background-color: white;
    color: black;
    border: 1px solid black;
}

.content {
    max-width: 800px;
    margin: 0 auto;
}

.filter {
    cursor: pointer;
    margin-right: 5px;
}

.filter:hover {
    text-decoration: underline;
    color: #e41010a8;
}

#selected-tags,
#selected-ingredients {
    height: auto;
    display: inline;
}

.steps {
    text-align: justify;
}

.timer {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #fff8f0;
    border: 1px solid #ffd8a8;
    border-radius: 3px;
    padding: 0px 5px;
    font-size: 0.88em;
    color: #b05e00;
    white-space: nowrap;
    vertical-align: baseline;
}

.timer::before {
    font-family: 'Material Symbols Outlined';
    content: 'timer';
    font-size: 0.95em;
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

.temperature {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #fff5f5;
    border: 1px solid #ffc9c9;
    border-radius: 3px;
    padding: 0px 5px;
    font-size: 0.88em;
    color: #c0392b;
    white-space: nowrap;
    vertical-align: baseline;
    text-decoration: none;
}

.temperature::before {
    font-family: 'Material Symbols Outlined';
    content: 'thermostat';
    font-size: 0.95em;
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

#results {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ingredients-list {
    width: 100%;
    border-collapse: collapse;
    padding: 0;
    margin: 0;
}

.ingredient-servings {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9em;
    color: #555;
    margin-bottom: 10px;
}

.ingredient-servings .material-symbols-outlined {
    font-size: 1em;
    color: #888;
}

.servings-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #ccc;
    background: white;
    color: #333;
    font-size: 1em;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.servings-btn:hover {
    background: #f0f0f0;
    color: black;
}

#servings-count {
    min-width: 1.5em;
    text-align: center;
    font-weight: 600;
    color: #333;
}

.ingredient-row {
    border-bottom: 1px solid #f0f0f0;
}

.ingredient-row:last-child {
    border-bottom: none;
}

header {
    border-bottom: 1px solid #e0e0e0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: black;
    font-weight: 600;
    font-size: 1.05em;
}

.header-brand .material-symbols-outlined {
    font-size: 1.3em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-user {
    font-size: 0.9em;
    color: #444;
}

.header-sep {
    color: #ccc;
}

.header-link-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.9em;
    color: #888;
    cursor: pointer;
}

.header-link-btn:hover {
    background: none;
    color: #333;
}

.header-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    color: black;
    text-decoration: none;
    margin-left: 4px;
}

.header-new-btn:hover {
    background: #f5f5f5;
}

.recipe-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.recipe-title-row h1 {
    margin: 0;
}

.recipe-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.recipe-img {
    object-fit: cover;
    width: 100%;
    aspect-ratio: 16/9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}

.time-slider-wrap {
    padding: 6px 0 0;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(
        to right,
        #333 var(--slider-pct, 0%),
        #e0e0e0 var(--slider-pct, 0%)
    );
    outline: none;
    margin: 0;
    cursor: pointer;
    border: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid #333;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid #333;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/*
 * The slider thumb's travel path is inset from the track's edges by half its
 * own width (7px) — a value of 0 doesn't put the thumb's center at literal
 * 0px, it can't hang half-off the track. Labels below are positioned to
 * match that same 7px inset via calc(), rather than plain space-between
 * (which spaces label edges evenly, ignoring both the thumb inset and the
 * labels' differing text widths — neither lines label centers up with
 * where the thumb actually stops).
 */
.time-slider-labels {
    position: relative;
    height: 14px;
    margin-top: 10px;
    font-size: 0.75em;
    color: #888;
    user-select: none;
}

.time-slider-labels span {
    position: absolute;
    top: 0;
    white-space: nowrap;
}

.time-slider-labels span:nth-child(1) {
    left: 7px;
}

.time-slider-labels span:nth-child(2) {
    left: calc(7px + (100% - 14px) * 0.25);
    transform: translateX(-50%);
}

.time-slider-labels span:nth-child(3) {
    left: calc(7px + (100% - 14px) * 0.5);
    transform: translateX(-50%);
}

.time-slider-labels span:nth-child(4) {
    left: calc(7px + (100% - 14px) * 0.75);
    transform: translateX(-50%);
}

.time-slider-labels span:nth-child(5) {
    left: calc(100% - 7px);
    transform: translateX(-100%);
}

#ingredient-search {
    width: 100%;
    margin: 4px;
    border-color: #ddd;
}

.recipe-layout {
    width: 100%;

    display: grid;
    grid-template-rows: 1fr;
    grid-template-columns: 1fr 3fr;
    gap: 8px;

}

.ingredient-quantity {
    text-align: right;
    white-space: nowrap;
    padding: 5px 10px 5px 0;
    vertical-align: top;
}

.ingredient-amount {
    font-weight: 600;
}

.ingredient-unit {
    color: #666;
    margin-left: 2px;
}

.ingredient-name {
    text-align: left;
    padding: 5px 0;
    vertical-align: top;
}

.ingredient-note {
    display: block;
    color: #999;
    font-size: 0.85em;
}

.recipe-card {
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.15s, transform 0.15s;
}

.recipe-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
    transform: translateY(-2px);
}

.recipe-card-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}

.recipe-card-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #f0ede8 0%, #e0d8ce 100%);
}

.recipe-card-header {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: center;
    padding: 10px 12px 6px;
    gap: 4px;
}

.recipe-card-name {
    font-weight: 600;
    font-size: 1em;
    line-height: 1.3;
}

.recipe-card-cuisine {
    font-size: 0.78em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.recipe-card-body {
    border-top: 1px solid #eee;
    padding: 7px 12px;
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    font-size: 0.85em;
    color: #555;
}

.recipe-card-meta-item {
    display: flex;
    align-items: center;
    gap: 3px;
}

.recipe-card-meta-item .material-symbols-outlined {
    font-size: 1em;
    color: #999;
}

.recipe-card-difficulty {
    margin-left: auto;
    color: #888;
}

.time {
    color: gray;
}

.bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bar-icon {
    align-content: center;
    padding-right: 10px;
    padding-left: 10px;
}

.bar-left {
    display: flex;
}
.bar-right {
    align-content: center;
}

.button {
    border-radius: 3px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    text-align: center;
    font-size: 0.9em;
    border: 1px solid #ccc;
    cursor: pointer;
}

.button-delete {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.button-delete:hover {
    background-color: #f1b8bc;
    color: #721c24;
}

.button-create {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.button-create:hover {
    background-color: #b8dfc4;
    color: #155724;
}

.button-edit {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.button-edit:hover {
    background-color: #ffe896;
    color: #856404;
}

.recipe-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: white;
    color: #555;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
}

.recipe-action-btn .material-symbols-outlined {
    font-size: 18px;
}

.recipe-action-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.recipe-action-btn.recipe-action-delete:hover {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.filter-search {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    margin-bottom: 6px;
    border: 1px solid #ddd;
    font-size: 0.85em;
}

.filter-tag.filter-tag-hidden {
    display: none;
}

.filter-toggle {
    display: inline-block;
    padding: 3px 10px;
    margin: 3px 2px;
    border: 1px dashed #ccc;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.82em;
    color: #888;
    white-space: nowrap;
}

.filter-toggle:hover {
    background: #f0f0f0;
    border-color: #aaa;
    color: #333;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 10px;
}

#sort-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.sort-dropdown {
    position: relative;
}

.sort-btn {
    padding: 4px 10px;
    border: 1px solid #ddd;
    font-size: 0.9em;
    cursor: pointer;
    background: white;
    color: black;
}

.sort-btn:hover {
    background: #f5f5f5;
}

.sort-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: white;
    border: 1px solid #ddd;
    min-width: 100%;
}

.sort-menu.open {
    display: block;
}

.sort-menu-item {
    padding: 6px 12px;
    font-size: 0.9em;
    cursor: pointer;
    white-space: nowrap;
}

.sort-menu-item:hover {
    background: #f5f5f5;
}

.sort-menu-item.active {
    background: #333;
    color: white;
}

.metadata {
    color: gray;
    font-size: 0.9em;
}

main {
    padding: 10px;
    flex: 1;
    min-width: 0;
}

aside {
    max-width: 400px;
    min-width: 300px;
    border-right: 1px solid #ddd;
}

section {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.select-list {
    list-style-type: none;
}

.filter-tag {
    display: inline-block;
    padding: 3px 10px;
    margin: 3px 2px;
    border: 1px solid #ddd;
    border-radius: 999px;
    white-space: nowrap;
    cursor: pointer;
    font-size: 0.82em;
    color: #444;
    background: white;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.filter-tag:hover {
    background: #f0f0f0;
    border-color: #bbb;
    color: #111;
}

.filter-tag.selected {
    background: #333;
    border-color: #333;
    color: white;
}

.filter-tag.selected:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: white;
}

section {
    cursor: pointer;
}

aside {
    width: 250px;
}

/* Recipe detail */
.recipe-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
}

.recipe-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #ddd;
    font-size: 0.85em;
    color: #444;
}

.recipe-meta-chip .material-symbols-outlined {
    font-size: 1em;
    color: #888;
}

.recipe-meta-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid #bbb;
    font-size: 0.85em;
    color: #444;
    background: #f5f5f5;
}

.recipe-hero-img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 24px;
    display: block;
}

.step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    align-items: flex-start;
    position: relative;
}

.step + .step::before {
    content: '';
    position: absolute;
    left: 13px;
    top: -24px;
    height: 24px;
    width: 1px;
    background: #e0e0e0;
}

.step-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #333;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78em;
    font-weight: 700;
    margin-top: 2px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.step-number:hover {
    background: #555;
}

.step.done .step-number {
    background: #5a9e6f;
}

.step.done .step-content {
    opacity: 0.45;
    text-decoration: line-through;
    text-decoration-color: #aaa;
}

.step-content {
    margin: 0;
    line-height: 1.7;
    padding-top: 3px;
}

b.ingredient {
    background: #f0ede4;
    border-radius: 3px;
    padding: 1px 5px;
    font-weight: 600;
    font-size: 0.95em;
}

b.cookware {
    font-weight: 600;
    color: #555;
}

.recipe-source {
    color: #888;
    font-size: 0.9em;
}

/* ── Layout base ─────────────────────────────────────────────── */

.main-layout {
    display: flex;
}

.filter-open-btn {
    display: none;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 6px 12px;
    font-size: 0.9em;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: white;
    cursor: pointer;
}

.filter-open-btn .material-symbols-outlined {
    font-size: 1.1em;
}

.filter-open-btn:hover {
    background: #f5f5f5;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 960px) {
    #results {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .content {
        padding: 0 12px;
    }

    /* Sidebar */
    .main-layout {
        flex-direction: column;
    }

    aside {
        display: none;
        width: 100%;
        min-width: unset;
        max-width: unset;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    aside.open {
        display: block;
    }

    .filter-open-btn {
        display: flex;
    }

    main {
        padding: 10px 0;
    }

    /* Recipe grid */
    #results {
        grid-template-columns: 1fr;
    }

    /* Recipe page */
    .recipe-layout {
        grid-template-columns: 1fr;
    }

    .recipe-title-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .recipe-hero-img {
        max-height: 240px;
    }

    /* Header */
    .header-user {
        display: none;
    }

    .header-sep {
        display: none;
    }
}
