/*
 * Cocktail-Datenbank: verbindliches Stylesheet
 *
 * Bisherige Kaskadenreihenfolge:
 * 1. ursprüngliche Anwendungsregeln
 * 2. botanische Gestaltung und responsive Ergänzungen
 *
 * Die Zusammenführung bewahrt diese Reihenfolge.
 */

/* ========================================================================== */
/* Foundation: ursprüngliche Anwendungsregeln                                 */
/* ========================================================================== */

:root {
    color-scheme: light;

    --background: #f4f0e7;
    --surface: #fffdf8;
    --surface-raised: #eee9df;
    --surface-soft: #f8f5ee;

    --border: #d8d1c5;
    --border-strong: #9aa69c;

    --text: #26362c;
    --text-muted: #687169;

    --accent: #557158;
    --accent-hover: #6f8d72;
    --accent-text: #fffdf8;

    --danger: #b85757;
    --danger-hover: #cc6868;
    --danger-background: rgba(184, 87, 87, 0.1);

    --success: #4e8762;
    --success-background: rgba(78, 135, 98, 0.1);

    --sidebar-background: #ebe9df;
    --sidebar-surface: #f6f3eb;
    --sidebar-surface-active: #dfe8dd;
    --sidebar-border: #d4cec1;
    --sidebar-text: #26362c;
    --sidebar-muted: #70776f;
    --sidebar-accent: #557158;

    --shadow-soft: 0 0.8rem 2.2rem rgba(52, 61, 54, 0.08);

    --max-width: 1440px;
    --sidebar-width: 18rem;
    --sidebar-collapsed-width: 5.25rem;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --background: #101612;
    --surface: #182019;
    --surface-raised: #222c24;
    --surface-soft: #141b16;

    --border: #344138;
    --border-strong: #56645a;

    --text: #eef0e8;
    --text-muted: #aab3aa;

    --accent: #9fbd92;
    --accent-hover: #b6d0aa;
    --accent-text: #142017;

    --danger: #df7777;
    --danger-hover: #ef8b8b;
    --danger-background: rgba(223, 119, 119, 0.12);

    --success: #7ac291;
    --success-background: rgba(122, 194, 145, 0.12);

    --sidebar-background: #121a15;
    --sidebar-surface: #19231c;
    --sidebar-surface-active: #27372b;
    --sidebar-border: #324136;
    --sidebar-text: #eef0e8;
    --sidebar-muted: #a1aca2;
    --sidebar-accent: #9fbd92;

    --shadow-soft: 0 0.8rem 2.4rem rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

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

body {
    min-height: 100vh;
    margin: 0;

    background:
        radial-gradient(
            circle at top left,
            color-mix(in srgb, var(--accent) 10%, transparent),
            transparent 34rem
        ),
        var(--background);

    transition:
        background-color 180ms ease,
        color 180ms ease;
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.container {
    width: min(
        calc(100% - 2rem),
        var(--max-width)
    );

    margin-inline: auto;
}

.site-header {
    position: sticky;
    z-index: 10;
    top: 0;

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

    background: rgba(16, 18, 20, 0.9);
    backdrop-filter: blur(12px);
}

.brand {
    color: var(--text);

    font-size: 1.15rem;
    font-weight: 750;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.main-content {
    padding-block: 3rem 5rem;
}

.page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;

    margin-bottom: 2rem;
}

.page-header-actions {
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-page-header {
    margin-bottom: 2rem;
}

.eyebrow {
    margin: 0 0 0.5rem;

    color: var(--accent);

    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.section-number {
    margin: 0 0 0.35rem;

    color: var(--accent);

    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

h1 {
    margin: 0;

    font-size: clamp(2.4rem, 7vw, 4.8rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
}

h2 {
    margin-top: 0;

    font-size: 1.25rem;
}

h3 {
    margin: 0;

    font-size: 1rem;
}

.page-description {
    max-width: 44rem;
    margin: 1.25rem 0 0;

    color: var(--text-muted);

    line-height: 1.65;
}

.result-count {
    color: var(--text-muted);

    font-size: 0.9rem;
}

.button-primary,
.button-secondary,
.button-danger,
.button-danger-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 2.8rem;

    border-radius: 0.65rem;
    padding: 0.75rem 1.1rem;

    font-weight: 720;
    text-decoration: none;

    transition:
        background 140ms ease,
        border-color 140ms ease,
        color 140ms ease,
        transform 140ms ease;
}

.button-primary {
    border: 1px solid var(--accent);

    background: var(--accent);
    color: var(--accent-text);
}

.button-primary:hover {
    border-color: var(--accent-hover);

    background: var(--accent-hover);

    transform: translateY(-1px);
}

.button-secondary {
    border: 1px solid var(--border);

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

.button-secondary:hover {
    border-color: var(--border-strong);

    background: var(--surface-raised);
}

.button-danger {
    border: 1px solid var(--danger);

    background: var(--danger);
    color: #1a0c0c;
}

.button-danger:hover {
    border-color: var(--danger-hover);

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

.button-danger-secondary {
    border: 1px solid rgba(223, 107, 107, 0.55);

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

.button-danger-secondary:hover {
    border-color: var(--danger);

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

.button-small {
    min-height: 2.3rem;
    padding: 0.5rem 0.8rem;

    font-size: 0.85rem;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.action-row-centered {
    justify-content: center;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) auto auto;
    gap: 0.75rem;

    margin-bottom: 1.5rem;
}

.search-form input {
    min-width: 0;

    border: 1px solid var(--border);
    border-radius: 0.65rem;
    padding: 0.85rem 1rem;

    background: var(--surface);
    color: var(--text);
    outline: none;
}

.search-form input:focus {
    border-color: var(--accent);

    box-shadow:
        0 0 0 3px rgba(215, 164, 82, 0.14);
}

.search-summary {
    margin: 0 0 1.5rem;

    color: var(--text-muted);
}

.cocktail-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
}

.cocktail-card {
    min-height: 10rem;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;

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

    background: var(--surface);

    text-decoration: none;

    transition:
        transform 140ms ease,
        border-color 140ms ease,
        background 140ms ease;
}

.cocktail-card:hover {
    transform: translateY(-3px);

    border-color: var(--accent);

    background: var(--surface-raised);
}

.cocktail-card-name {
    font-size: 1.3rem;
    font-weight: 720;
    line-height: 1.2;
}

.cocktail-card-link {
    color: var(--accent);

    font-size: 0.85rem;
    font-weight: 700;
}

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 0.9rem;
    padding: 3rem 1.5rem;

    background: var(--surface);

    text-align: center;
}

.empty-state p {
    margin-bottom: 1.5rem;

    color: var(--text-muted);
}

.empty-state h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
}

.back-link {
    display: inline-block;

    color: var(--text-muted);

    text-decoration: none;
}

.back-link:hover {
    color: var(--accent);
}

.detail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    margin-bottom: 2rem;
}

.recipe {
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;

    background: var(--surface);
}

.recipe-header {
    padding: clamp(1.5rem, 5vw, 3.5rem);

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

    background:
        linear-gradient(
            135deg,
            rgba(215, 164, 82, 0.13),
            transparent 65%
        );
}

.recipe-header h1 {
    font-size: clamp(2.2rem, 6vw, 4rem);
}

.recipe-layout {
    display: grid;
    grid-template-columns:
        minmax(16rem, 0.8fr) 1.2fr;
}

.recipe-section {
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.recipe-section + .recipe-section {
    border-left: 1px solid var(--border);
}

.ingredient-list {
    display: grid;
    gap: 0.8rem;

    margin: 0;
    padding: 0;

    list-style: none;
}

.ingredient-list > li {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.8rem;

    line-height: 1.5;
}

.ingredient-list > li:last-child {
    border-bottom: 0;
}

.preparation {
    margin: 0;

    color: var(--text-muted);

    font-size: 1.05rem;
    line-height: 1.75;
    white-space: pre-wrap;
}

.flash-stack {
    display: grid;
    gap: 0.75rem;

    margin-bottom: 2rem;
}

.flash {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;

    background: var(--surface);
}

.flash-success {
    border-color: rgba(119, 200, 149, 0.55);

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

.flash-error {
    border-color: rgba(223, 107, 107, 0.55);

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

.error-summary {
    margin-bottom: 1.5rem;

    border: 1px solid rgba(223, 107, 107, 0.55);
    border-radius: 0.85rem;
    padding: 1.25rem;

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

.error-summary h2 {
    margin-bottom: 0.75rem;

    color: var(--danger);
}

.error-summary ul {
    display: grid;
    gap: 0.4rem;

    margin: 0;
    padding-left: 1.25rem;
}

.cocktail-form {
    display: grid;
    gap: 1.25rem;
}

.form-card {
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: clamp(1.25rem, 4vw, 2rem);

    background: var(--surface);
}

.form-section-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;

    margin-bottom: 1.5rem;
}

.form-section-heading h2 {
    margin: 0;
}

.form-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.ingredient-grid {
    grid-template-columns:
        minmax(12rem, 2fr)
        repeat(3, minmax(7rem, 1fr));
}

.field {
    display: grid;
    align-content: start;
    gap: 0.45rem;

    min-width: 0;
}

.field > span {
    color: var(--text-muted);

    font-size: 0.82rem;
    font-weight: 700;
}

.field-wide {
    grid-column: 1 / -1;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    min-width: 0;

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

    background: var(--surface-soft);
    color: var(--text);
    outline: none;
}

.field textarea {
    resize: vertical;

    line-height: 1.6;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: var(--accent);

    box-shadow:
        0 0 0 3px rgba(215, 164, 82, 0.14);
}

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

.ingredient-editor-row {
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 1rem;

    background: var(--surface-soft);
}

.ingredient-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    margin-bottom: 1rem;
}

.remove-row-button {
    border: 0;
    padding: 0.25rem;

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

    font-size: 0.8rem;
}

.remove-row-button:hover {
    color: var(--danger-hover);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;

    margin-top: 0.25rem;
}

.delete-card {
    max-width: 46rem;

    border: 1px solid rgba(223, 107, 107, 0.45);
    border-radius: 1rem;
    padding: clamp(1.5rem, 5vw, 3rem);

    background:
        linear-gradient(
            135deg,
            rgba(223, 107, 107, 0.09),
            transparent 70%
        ),
        var(--surface);
}

.delete-card h1 {
    font-size: clamp(2.2rem, 6vw, 4rem);
}

.delete-warning {
    margin: 2rem 0 0;

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

.delete-note {
    margin: 1rem 0 2rem;

    color: var(--text-muted);

    line-height: 1.6;
}

.visually-hidden,
.sr-only {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;

    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;

    border: 0 !important;
}

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

    .ingredient-name-field {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {.main-content {
        padding-top: 2rem;
    }

    .page-header {
        align-items: start;
        flex-direction: column;
        gap: 1rem;
    }

    .page-header-actions {
        width: 100%;

        justify-content: space-between;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .detail-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .recipe-layout {
        grid-template-columns: 1fr;
    }

    .recipe-section + .recipe-section {
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .form-grid,
    .ingredient-grid {
        grid-template-columns: 1fr;
    }

    .ingredient-name-field,
    .field-wide {
        grid-column: auto;
    }

    .form-section-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .form-actions > * {
        width: 100%;
    }
}
