/* "Remove unit" on ingredient form: --warning-color (#e67e22) + white ≈ 2.85:1 (fails AA).
   Use darker orange for ≥4.5:1 with white (normal text) per WCAG 1.4.3. */
:root {
    --chef-remove-unit-bg: #b85a00;
    --chef-remove-unit-bg-hover: #9a4a00;
    --chef-remove-unit-focus-ring: var(--sub-color, #0b446c);
}

@media (max-width: 800px) {
    main {
        max-width: 96vw;
    }

    .ZL-form-wide-container {
        padding: 30px 10px;
    }
}

.chef-index-description {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

body.chef-ingredient-create-open,
body.chef-unit-create-open {
    overflow: hidden;
}

.chef-ingredient-create-modal.is-hidden {
    display: none !important;
}

.chef-ingredient-create-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.chef-ingredient-create-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.chef-ingredient-create-dialog {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: min(90vh, 820px);
    overflow: auto;
    background: #ffffff;
    border: 1px solid #cccccc;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    padding: 16px 18px 18px;
}

.chef-ingredient-create-head {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.chef-ingredient-create-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.chef-ingredient-create-close.ZL-button-link {
    width: auto;
    min-width: 2rem;
    padding: 4px 8px;
    line-height: 1;
}

.chef-ingredient-create-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.chef-ingredient-create-actions .ZL-form-button,
.chef-ingredient-create-actions .ZL-button-link {
    width: auto;
}

.chef-ingredient-create-loading {
    margin: 0;
}

.chef-ingredient-create-general-error.ZL-alert,
.chef-ingredient-create-general-error.ZL-alert-warning,
.chef-unit-create-general-error.ZL-alert,
.chef-unit-create-general-error.ZL-alert-warning {
    color: #ffffff;
}

.chef-unit-create-modal.is-hidden {
    display: none !important;
}

.chef-unit-create-modal {
    position: fixed;
    inset: 0;
    z-index: 10070;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.chef-unit-create-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.chef-unit-create-dialog {
    position: relative;
    z-index: 1;
    width: min(480px, 100%);
    max-height: min(90vh, 820px);
    overflow: auto;
    background: #ffffff;
    border: 1px solid #cccccc;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    padding: 16px 18px 18px;
}

.chef-unit-create-head {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.chef-unit-create-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.chef-unit-create-close.ZL-button-link {
    width: auto;
    min-width: 2rem;
    padding: 4px 8px;
    line-height: 1;
}

.chef-unit-create-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.chef-unit-create-actions .ZL-form-button,
.chef-unit-create-actions .ZL-button-link {
    width: auto;
}

.chef-unit-create-loading {
    margin: 0;
}

.ui-autocomplete .ui-menu-item-wrapper {
    white-space: normal;
}

@media (max-width: 750px) {
    .chef-index-desktop {
        display: none;
    }
}

.Chef-units-toggle-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.Chef-ingredient-unit-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 10px;
    border: 1px solid #dddddd;
    border-radius: 6px;
    margin-bottom: 10px;
}

.Chef-ingredient-unit-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 12px;
    align-items: end;
}

.chef-recipe-step-timing {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px 20px;
    align-items: start;
    margin-bottom: 12px;
}

.chef-recipe-step-schedule {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    min-width: 0;
}

.chef-recipe-step-schedule > .ZL-form-group {
    margin-bottom: 0;
}

.chef-recipe-step-timing .ZL-duration-legend {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.chef-recipe-step-timing .ZL-duration-input {
    width: fit-content;
    max-width: 100%;
}

.chef-recipe-step-schedule select.ZL-form-control {
    width: auto;
    min-width: 12rem;
    max-width: 100%;
}

@media (max-width: 750px) {
    .chef-recipe-step-timing {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .chef-recipe-step-schedule {
        flex-direction: column;
        align-items: stretch;
    }

    .chef-recipe-step-schedule select.ZL-form-control {
        width: 100%;
    }
}

.ZL-form-wide-container {
    align-self: stretch;
    width: 100%;
    max-width: 100%;
    text-align: start;
}

.chef-recipe-form {
    width: 100%;
    max-width: 100%;
    text-align: start;
}

.chef-recipe-ingredients-wrap {
    margin-bottom: 8px;
    max-width: 100%;
}

.chef-recipe-ingredients-head,
.chef-recipe-ingredient-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28% 18% 3rem;
    gap: 6px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.chef-recipe-ingredients-head {
    margin-bottom: 4px;
    padding: 0 2px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color, #222);
}

.chef-recipe-ingredient-col-actions {
    min-height: 1em;
}

.chef-recipe-ingredients-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: block;
}

.chef-recipe-ingredient-row {
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
}

.chef-recipe-ingredient-name,
.chef-recipe-ingredient-unit,
.chef-recipe-ingredient-qty,
.chef-recipe-ingredient-actions {
    min-width: 0;
}

/*
 * Stack label + input in the same grid area so every field cell is exactly
 * input-tall. That keeps unit/qty aligned with the name field when the row
 * uses align-items: center (needed so the fixed-size remove button lines up).
 */
.chef-recipe-ingredient-name,
.chef-recipe-ingredient-unit,
.chef-recipe-ingredient-qty {
    position: relative;
    display: grid;
    align-items: center;
    min-width: 0;
}

.chef-recipe-ingredient-unit,
.chef-recipe-ingredient-qty {
    grid-template-columns: minmax(0, 1fr);
}

.chef-recipe-ingredient-name {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
}

.chef-recipe-ingredient-name > input[type="hidden"],
.chef-recipe-ingredient-unit > input[type="hidden"] {
    display: none;
}

.chef-recipe-ingredient-name > .ZL-visually-hidden,
.chef-recipe-ingredient-unit > .ZL-visually-hidden,
.chef-recipe-ingredient-qty > .ZL-visually-hidden {
    grid-column: 1;
    grid-row: 1;
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

.chef-recipe-ingredient-name > .chef-ingredient-autocomplete,
.chef-recipe-ingredient-unit > .ZL-form-control,
.chef-recipe-ingredient-qty > .ZL-form-control {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
}

.chef-recipe-ingredient-name > .chef-ingredient-edit,
.chef-recipe-ingredient-name > .chef-ingredient-edit.ZL-button-link {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 4px 6px;
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: nowrap;
}

.chef-recipe-ingredient-name > .chef-ingredient-edit[hidden] {
    display: none !important;
}

.chef-recipe-ingredients-list .ZL-form-control {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.chef-recipe-ingredient-actions {
    display: flex;
    justify-content: center;
    align-items: center;
}

.chef-recipe-ingredients-list .chef-recipe-ingredient-remove,
.chef-recipe-ingredients-list .chef-recipe-ingredient-remove.ZL-button-link {
    --chef-ingredient-remove-size: calc(1em + 20px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: var(--chef-ingredient-remove-size);
    height: var(--chef-ingredient-remove-size);
    min-width: var(--chef-ingredient-remove-size);
    min-height: var(--chef-ingredient-remove-size);
    max-width: var(--chef-ingredient-remove-size);
    max-height: var(--chef-ingredient-remove-size);
    margin: 0;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

@media (max-width: 750px) {
    .chef-recipe-step-body {
        padding: 8px 4px;
    }

    .chef-recipe-ingredients-wrap {
        margin-bottom: 4px;
    }

    .chef-recipe-ingredients-head {
        display: none;
    }

    .chef-recipe-ingredient-row {
        grid-template-columns: minmax(0, 1fr) minmax(4.5rem, 26%) minmax(3.5rem, 18%) 2.25rem;
        gap: 4px;
        font-size: 0.75rem;
    }

    .chef-recipe-ingredients-list .ZL-form-control {
        font-size: 0.75rem;
        padding: 4px 3px;
        height: auto;
        min-height: 0;
        line-height: 1.2;
    }

    .chef-recipe-ingredient-name .chef-ingredient-edit,
    .chef-recipe-ingredient-name .chef-ingredient-edit.ZL-button-link {
        padding: 3px 4px;
        font-size: 0.7rem;
    }

    .chef-recipe-ingredients-list .chef-recipe-ingredient-remove,
    .chef-recipe-ingredients-list .chef-recipe-ingredient-remove.ZL-button-link {
        font-size: 0.75rem;
        --chef-ingredient-remove-size: calc(1.2em + 10px);
    }
}
/* Shared remove styling (units, recipe steps, ingredients, images). */
.chef-remove-unit-button,
.chef-remove-unit-button.ZL-button-link {
    background-color: var(--chef-remove-unit-bg);
    border-color: var(--chef-remove-unit-bg);
    color: var(--white-color);
}

.chef-remove-unit-button:hover,
.chef-remove-unit-button.ZL-button-link:hover {
    background-color: var(--chef-remove-unit-bg-hover);
    border-color: var(--chef-remove-unit-bg-hover);
    color: var(--white-color);
}

.chef-remove-unit-button:focus-visible {
    outline: 2px solid var(--chef-remove-unit-focus-ring);
    outline-offset: 2px;
}

.Chef-ingredient-unit-row .chef-remove-unit-button,
.chef-recipe-ingredient-row .chef-remove-unit-button,
.chef-recipe-step-header .chef-remove-unit-button,
.chef-recipe-image-row .chef-remove-unit-button {
    flex: 0 0 auto;
    margin-bottom: 0;
}

@media (max-width: 800px) {
    .Chef-ingredient-unit-row {
        flex-wrap: wrap;
    }
}

/* Keep multilingual field frames visible even if ZL_ci.css is stale-cached */
.ZL-lang-scope {
    display: block;
    box-sizing: border-box;
    border: 1px solid #bbbbbb;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 16px 0;
    min-inline-size: 0;
    background-color: #ffffff;
}

/* Form sections (fieldset + legend instead of orphan labels) */
.chef-form-section {
    border: 1px solid #dddddd;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 16px 0;
    min-inline-size: 0;
}

.chef-form-section > legend {
    padding: 0 6px;
    font-weight: 600;
}

.chef-form-section-nested {
    margin: 12px 0;
    padding: 10px 12px;
}

.chef-recipe-categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.chef-recipe-category-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* One bordered frame for media picker + row remove (hide widget clear). */
.chef-recipe-image-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 1.25rem;
    padding: 12px;
    border: 1px solid #dddddd;
    box-sizing: border-box;
}

.chef-recipe-image-row .zl-media-widget {
    flex: 1 1 12rem;
    margin-bottom: 0;
    padding: 0;
    border: none;
}

.chef-recipe-image-row .zl-media-widget-remove {
    display: none !important;
}

.chef-recipe-step {
    border: 1px solid #cccccc;
    border-radius: 8px;
    margin-bottom: 14px;
    background: #fafafa;
    min-width: 0;
    max-width: 100%;
}

.chef-recipe-step-header {
    --chef-step-ctrl-drag: 22px;
    --chef-step-ctrl-toggle: 32px;
    --chef-step-ctrl-move: 62px;
    --chef-step-ctrl-remove: 7rem;
    --chef-step-ctrl-gap: 8px;
    --chef-step-ctrl-gaps: calc(var(--chef-step-ctrl-gap) * 4);

    display: flex;
    align-items: center;
    gap: var(--chef-step-ctrl-gap);
    padding: 10px 12px;
    border-bottom: 1px solid #dddddd;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.chef-recipe-step-toggle,
.chef-recipe-step-toggle.ZL-button-link {
    font-size: 1.1rem;
    line-height: 1;
    padding: 4px 8px;
    min-height: 0;
    min-width: var(--chef-step-ctrl-toggle);
    flex: 0 0 auto;
}

.chef-recipe-step-drag {
    cursor: grab;
    user-select: none;
    color: #666666;
    letter-spacing: -2px;
    line-height: 1;
    padding: 4px 2px;
    flex: 0 0 var(--chef-step-ctrl-drag);
    width: var(--chef-step-ctrl-drag);
    text-align: center;
}

.chef-recipe-step-drag:active {
    cursor: grabbing;
}

.chef-recipe-step-label {
    flex: 1 1 0;
    min-width: 0;
    max-width: calc(
        100%
        - var(--chef-step-ctrl-drag)
        - var(--chef-step-ctrl-toggle)
        - var(--chef-step-ctrl-move)
        - var(--chef-step-ctrl-remove)
        - var(--chef-step-ctrl-gaps)
    );
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.3;
}

.chef-recipe-step-order-actions {
    display: inline-flex;
    gap: 2px;
    flex: 0 0 var(--chef-step-ctrl-move);
    width: var(--chef-step-ctrl-move);
    justify-content: center;
}

.chef-recipe-step-header > .ZL_repeater_remove_item {
    flex: 0 0 auto;
}

.chef-recipe-step-remove-icon {
    display: none;
}

@media (max-width: 750px) {
    .chef-recipe-step-header {
        --chef-step-ctrl-gap: 4px;
        --chef-step-ctrl-remove: 32px;
        padding: 8px 6px;
    }

    .chef-recipe-step-header > .chef-remove-unit-button.ZL-button-link {
        flex: 0 0 32px;
        width: 32px;
        min-width: 32px;
        max-width: 32px;
        box-sizing: border-box;
        padding: 4px 0;
        font-size: 1.1rem;
        line-height: 1;
    }

    .chef-recipe-step-remove-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .chef-recipe-step-remove-icon {
        display: inline;
    }
}

.chef-recipe-step-move-up,
.chef-recipe-step-move-down,
.chef-recipe-step-move-up.ZL-button-link,
.chef-recipe-step-move-down.ZL-button-link {
    font-size: 0.75rem;
    line-height: 1;
    padding: 4px 6px;
    min-height: 0;
    min-width: 28px;
}

.chef-recipe-step-move-up:disabled,
.chef-recipe-step-move-down:disabled,
.chef-recipe-step-move-up.ZL-button-link:disabled,
.chef-recipe-step-move-down.ZL-button-link:disabled {
    opacity: 0.35;
    cursor: default;
}

#chef-recipe-steps .ZL_repeater_item.ui-sortable-helper {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

#chef-recipe-steps .ui-sortable-placeholder {
    visibility: visible !important;
    border: 1px dashed #999999;
    border-radius: 8px;
    margin-bottom: 14px;
    background: #f0f0f0;
    min-height: 48px;
}

.chef-recipe-step-body {
    padding: 12px;
}

.chef-recipe-step-body.is-collapsed {
    display: none;
}

.chef-mention-field {
    display: grid;
    position: relative;
    background: #ffffff;
    border: 1px solid var(--light-grey, #cccccc);
    border-radius: 4px;
}

.chef-mention-field:focus-within {
    border-color: var(--sub-color, #666666);
}

.chef-mention-field > textarea.chef-mention-input {
    grid-area: 1 / 1;
    position: relative;
    z-index: 1;
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 4px 4px 0 0;
    background: transparent;
    resize: vertical;
}

.chef-mention-field > textarea.chef-mention-input:focus,
.chef-mention-field > textarea.chef-mention-input:focus-visible {
    outline: none;
    border-color: transparent;
}

.chef-mention-mirror {
    grid-area: 1 / 1;
    position: absolute;
    inset: 0;
    z-index: 0;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: transparent;
    border-style: solid;
    border-color: transparent;
    box-sizing: border-box;
    border-radius: 4px;
}

.chef-mention-mirror-inner {
    color: transparent;
}

.chef-mention-bad {
    background: #ffd0d0;
    border-radius: 2px;
    color: transparent;
    box-decoration-break: clone;
}

.chef-mention-error {
    margin: 4px 0 0;
    color: #a40000;
    font-size: 0.85rem;
}

.chef-mention-error:empty {
    display: none;
}

.chef-mention-field > .chef-mention-add {
    grid-area: 2 / 1;
    justify-self: end;
    width: auto;
    margin: 0 8px 8px;
    padding: 2px 8px;
    border: 0;
    border-radius: 4px;
    background: #f3f6f8;
    color: #333333;
    font-size: 0.85rem;
    line-height: 1.4;
    text-align: inherit;
}

.chef-mention-field > .chef-mention-add::before {
    content: '@ ';
}

.chef-mention-field > .chef-mention-add:hover,
.chef-mention-field > .chef-mention-add:focus-visible {
    background: #e6ebef;
    border-color: transparent;
    color: #333333;
}

.chef-mention-field > .chef-mention-error {
    grid-area: 3 / 1;
}

.chef-mention-menu {
    position: fixed;
    z-index: 80;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    max-height: 240px;
    overflow: auto;
    min-width: 12rem;
}

.chef-mention-menu button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    margin: 0;
    padding: 6px 10px;
    border: 0;
    background: transparent;
    text-align: inherit;
    cursor: pointer;
    line-height: 1.3;
}

.chef-mention-menu button[aria-selected="true"],
.chef-mention-menu button:hover {
    background: #f3f6f8;
}

.chef-mention-kind {
    color: #666666;
    font-size: 0.75rem;
}

/* Class-based hide: CSP blocks jQuery .hide() inline styles. */
.ZL_repeater_template,
.ZL-nested-template {
    display: none !important;
}

