/* Zutatenverwaltung */

.article-page {
    --article-category-filter-color: #6b6592;
}

html[data-theme="dark"] .article-page {
    --article-category-filter-color: #beb6e8;
}

.article-page .search-filter-chip[data-filter-kind="category"] {
    border-color: color-mix(
        in srgb,
        var(--article-category-filter-color) 58%,
        var(--border)
    );
    background: color-mix(
        in srgb,
        var(--article-category-filter-color) 12%,
        var(--surface)
    );
    color: var(--article-category-filter-color);
}

.article-page .search-filter-suggestion[data-filter-kind] small {
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 0.12rem 0.38rem;
}

.article-page .search-filter-suggestion[data-filter-kind="category"] small {
    color: var(--article-category-filter-color);
}

.data-table-wrapper {
    overflow-x: auto;

    border: 1px solid var(--border);
    border-radius: 0.9rem;

    background: var(--surface);
}

.data-table {
    width: 100%;
    min-width: 58rem;

    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;

    border-bottom: 1px solid var(--border);

    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--text-muted);

    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: var(--surface-raised);
}

.table-note {
    display: block;

    max-width: 22rem;
    margin-top: 0.35rem;

    color: var(--text-muted);

    font-size: 0.82rem;
    line-height: 1.45;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;

    white-space: nowrap;
}

.table-actions a {
    color: var(--accent);

    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.table-actions a:hover {
    color: var(--accent-hover);
}

.table-actions .danger-link {
    color: var(--danger);
}

.table-actions .danger-link:hover {
    color: var(--danger-hover);
}

.status-badge {
    display: inline-flex;

    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.25rem 0.55rem;

    background: var(--surface-soft);
    color: var(--text-muted);

    font-size: 0.78rem;
    white-space: nowrap;
}

.form-help {
    max-width: 48rem;
    margin: -0.35rem 0 1.5rem;

    color: var(--text-muted);

    font-size: 0.92rem;
    line-height: 1.6;
}

.form-grid-three {
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
}

@media (max-width: 780px) {.form-grid-three {
        grid-template-columns: 1fr;
    }
}

.article-package-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.article-recipe-meta {
    max-width: 34rem;
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
    .article-package-grid {
        grid-template-columns: 1fr;
    }
}

/* Zutaten-Autocomplete und mobiler Erstellungsdialog */

.ingredient-autocomplete {
    position: relative;
}

.ingredient-autocomplete > label {
    display: contents;
}

.autocomplete-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% - 1.1rem);
    right: 0;
    left: 0;

    max-height: 20rem;
    overflow-y: auto;

    border: 1px solid var(--border-strong);
    border-radius: 0.75rem;
    padding: 0.35rem;

    background: var(--surface-raised);
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.38);
}

.autocomplete-option {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    border: 0;
    border-radius: 0.55rem;
    padding: 0.8rem 0.85rem;

    background: transparent;
    color: var(--text);

    text-align: left;
}

.autocomplete-option:hover,
.autocomplete-option:focus-visible {
    background: rgba(215, 164, 82, 0.13);
    outline: none;
}

.autocomplete-option-name {
    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.autocomplete-option-meta {
    flex: 0 0 auto;

    color: var(--text-muted);

    font-size: 0.78rem;
}

.autocomplete-create-option {
    border-top: 1px solid var(--border);
    border-radius: 0 0 0.55rem 0.55rem;

    color: var(--accent);
}

.autocomplete-create-symbol {
    flex: 0 0 auto;

    font-size: 1.35rem;
    line-height: 1;
}

.field-message {
    min-height: 1.15rem;
    margin: 0;

    color: var(--text-muted);

    font-size: 0.76rem;
}

.field-message.is-selected {
    color: var(--success);
}

.ingredient-editor-row.has-selection-error {
    border-color: var(--danger);
}

.ingredient-editor-row.has-selection-error .field-message {
    color: var(--danger);
}

.ingredient-dialog,
.premix-dialog,
.catalog-dialog {
    width: min(42rem, calc(100% - 2rem));
    max-height: min(48rem, calc(100dvh - 2rem));

    border: 1px solid var(--border-strong);
    border-radius: 1rem;
    padding: 0;

    background: var(--surface);
    color: var(--text);

    box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.55);
}

.ingredient-dialog::backdrop,
.premix-dialog::backdrop,
.catalog-dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.dialog-form {
    max-height: inherit;

    display: flex;
    flex-direction: column;
}

.dialog-header,
.dialog-actions {
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    padding: 1.25rem;

    background: var(--surface);
}

.dialog-header {
    border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
    margin: 0;
}

.dialog-close {
    width: 2.75rem;
    height: 2.75rem;

    border: 1px solid var(--border);
    border-radius: 999px;

    background: var(--surface-soft);
    color: var(--text-muted);

    font-size: 1.5rem;
    line-height: 1;
}

.dialog-close:hover {
    color: var(--text);
}

.dialog-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;

    display: grid;
    gap: 1rem;

    padding: 1.25rem;
}

.dialog-actions {
    border-top: 1px solid var(--border);

    justify-content: flex-end;
}

.dialog-help {
    margin: 0;
}

.dialog-errors {
    border: 1px solid rgba(223, 107, 107, 0.55);
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;

    background: var(--danger-background);
    color: var(--danger);
}

.dialog-errors ul {
    margin: 0;
    padding-left: 1.2rem;
}

@media (max-width: 600px) {.ingredient-dialog,
.premix-dialog,
.catalog-dialog {
        width: 100%;
        max-width: none;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;

        border: 0;
        border-radius: 0;
    }

    .dialog-header,
    .dialog-body,
    .dialog-actions {
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-left: max(1rem, env(safe-area-inset-left));
    }

    .dialog-header {
        padding-top: max(1rem, env(safe-area-inset-top));
    }

    .dialog-actions {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .dialog-actions > * {
        min-height: 3rem;
    }

    .autocomplete-menu {
        position: fixed;
        z-index: 40;
        top: auto;
        right: 0.75rem;
        bottom: max(0.75rem, env(safe-area-inset-bottom));
        left: 0.75rem;

        max-height: min(18rem, 42dvh);
    }
}

.card-meta {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.form-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.recipe-meta-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    border-bottom: 1px solid var(--border);
    background: var(--border);
}

.recipe-meta-grid > div {
    display: grid;
    gap: 0.35rem;
    padding: 1.1rem 1.25rem;
    background: var(--surface-soft);
}

.recipe-meta-grid span {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.recipe-step-list {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding-left: 1.5rem;
    color: var(--text-muted);
    line-height: 1.65;
}

.recipe-step-list li::marker {
    color: var(--accent);
    font-weight: 800;
}

.step-editor-list {
    display: grid;
    gap: 1rem;
}

.step-editor-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 1rem;
    background: var(--surface-soft);
}

.step-number {
    width: 2.25rem;
    height: 2.25rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(215, 164, 82, 0.15);
    color: var(--accent);
    font-weight: 800;
}

.inventory-entry-list {
    display: grid;
    gap: 1rem;
}

.inventory-entry-row {
    display: grid;
    grid-template-columns: minmax(14rem, 2fr) 1fr 0.65fr auto;
    align-items: end;
    gap: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 1rem;
    background: var(--surface-soft);
}

.result-card {
    margin-top: 1.5rem;
}

@media (max-width: 980px) {.form-grid-four,
    .recipe-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .inventory-entry-row {
        grid-template-columns: minmax(12rem, 2fr) 1fr 0.7fr;
    }

    .inventory-entry-row .remove-row-button {
        grid-column: 1 / -1;
        justify-self: end;
    }
}

@media (max-width: 720px) {.form-grid-four,
    .recipe-meta-grid,
    .inventory-entry-row {
        grid-template-columns: 1fr;
    }

    .step-editor-row {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .step-editor-row .remove-row-button {
        grid-column: 2;
        justify-self: end;
    }
}

/* Freigegebener Artikelkatalog: Kachelansicht, Detail und Formular. */

.article-group-panel {
    max-height: min(50vh, 24rem);
    overflow-y: auto;
    display: grid;
    gap: 0.15rem;
    margin-top: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.4rem;
    background: var(--surface-soft);
}

.article-group-panel[hidden],
.article-tile[hidden],
.article-page [data-article-empty][hidden],
[data-purchased-fields][hidden],
[data-manufacturable-fields][hidden] {
    display: none;
}


.article-filter-section {
    display: grid;
    gap: 0.35rem;
}

.article-filter-section + .article-filter-section {
    margin-top: 0.5rem;
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
}

.article-filter-section > strong {
    padding: 0.25rem 0.45rem 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.article-filter-options {
    display: grid;
    gap: 0.15rem;
}

.article-group-option input {
    margin: 0;
}

.article-group-option small {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.68rem;
}

.article-status-option {
    margin-top: 0.45rem;
    border-top: 1px solid var(--border);
}

.article-group-option {
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    border-radius: 0.55rem;
    padding: 0.45rem 0.65rem;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
}

.article-group-option.is-current {
    color: var(--accent);
    font-weight: 800;
}

.article-active-filter {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.45rem;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
    border-radius: 999px;
    padding: 0.25rem 0.35rem 0.25rem 0.65rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
}

.article-active-filter a {
    width: 1.35rem;
    height: 1.35rem;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 13%, transparent);
    color: inherit;
    text-decoration: none;
}

.article-tile-copy {
    min-width: 0;
}

.article-tile-meta {
    display: none;
}

.ingredient-picture,
.ingredient-image {
    width: 100%;
    height: 100%;
    display: block;
}

.ingredient-image {
    object-fit: cover;
}

.ingredient-placeholder {
    display: grid;
    place-items: center;
    align-content: center;
    justify-content: center;
    background: color-mix(in srgb, var(--accent) 7%, var(--surface-soft));
    color: var(--accent);
}

.ingredient-placeholder-illustration {
    width: 62%;
    height: 62%;
    margin: auto;
    opacity: 0.82;
}

.ingredient-placeholder-illustration .navigation-illustration-source {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.article-detail {
    position: relative;
    display: grid;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--surface);
}

.article-detail-header {
    display: grid;
    grid-template-columns: minmax(9rem, 18rem) minmax(0, 1fr);
    gap: clamp(1.25rem, 4vw, 4rem);
    align-items: center;
    padding: clamp(1rem, 4vw, 3rem);
}

.article-detail-image-link,
.article-detail-picture {
    width: 100%;
    aspect-ratio: 1;
    display: block;
    overflow: hidden;
    border-radius: 0.75rem;
}

.article-detail-image-link {
    border: 1px solid var(--border);
}

.article-detail-summary h1 {
    margin: 0.4rem 0 1.25rem;
    font-size: clamp(2rem, 6vw, 4.5rem);
}

.article-facts {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

.article-facts div {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.75rem;
}

.article-facts dt {
    color: var(--text-muted);
}

.article-facts dd {
    margin: 0;
    font-weight: 750;
}

.article-detail-section {
    border-top: 1px solid var(--border);
    padding: clamp(1rem, 3vw, 2.5rem);
}

.article-detail-section h2 {
    margin-top: 0;
}

.article-yield {
    color: var(--text-muted);
}

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

.article-recipe-list li {
    display: grid;
    grid-template-columns: minmax(6.5rem, auto) 1fr;
    gap: 1rem;
    border-top: 1px solid var(--border);
    padding: 0.75rem 0;
}

.article-recipe-list li:first-child {
    border-top: 0;
}

.article-usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.8rem;
}

.article-usage-tile {
    display: grid;
    gap: 0.4rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 750;
}

.article-usage-visual {
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
}

.article-usage-visual > *,
.article-usage-visual :where(.cocktail-version-picture, .cocktail-version-image, .cocktail-card-visual, .cocktail-fallback-picture, .cocktail-fallback-image) {
    width: 100%;
    height: 100%;
}

.article-usage-visual :where(.cocktail-version-image, .cocktail-fallback-image) {
    object-fit: cover;
    object-position: center;
}

.article-taxonomy-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.8rem;
    gap: 0.4rem;
}

.article-taxonomy-add {
    min-width: 0;
    padding: 0;
    font-size: 1.35rem;
}

.article-grid[data-view-mode="list"] .article-tile-meta,
html[data-articles-catalog-view="list"] [data-article-page] .article-grid:not([data-view-initialized]) .article-tile-meta {
    display: block;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.article-grid[data-view-mode="grid"][data-view-initialized] .article-tile-meta {
    display: none;
}

.article-page .article-status-chip {
    text-decoration: none;
}

@media (max-width: 720px) {
    .article-detail-header {
        grid-template-columns: minmax(7.5rem, 38%) minmax(0, 1fr);
        gap: 1rem;
        align-items: start;
    }

    .article-detail-summary h1 {
        font-size: clamp(1.55rem, 7vw, 2.35rem);
    }

    .article-facts div {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }

    .article-usage-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Ausschankgrößen: Menge je Direktverkauf, getrennt vom Einkaufsgebinde. */
.article-servings-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

.article-servings-list {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.article-serving {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}

.article-serving.is-inactive .article-serving-amount {
    color: var(--text-muted);
}

.article-serving-actions {
    display: flex;
    gap: 0.35rem;
}

.article-serving-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
}

.article-serving-form label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
}

.article-serving-form .optional {
    color: var(--text-muted);
    font-weight: 400;
}
