/* Rezeptrechner — Bavaria Entertainment Style
   Tinte-Design-System (BENT-1396): Palette/Typografie/Chrome/Flash/Felder
   kommen aus css/bavaria-theme.css + css/tinte-base.css.
   Hier nur noch tool-spezifische Komponenten. */

/* ===== Login-Seite ===== */
.login-body {
    background: var(--t-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-frame {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-wordmark {
    font-family: var(--f-serif);
    font-size: 20px;
    font-weight: 600;
    color: var(--t-ink);
    line-height: 1.1;
}

.login-card {
    background: var(--t-card);
    border: 1px solid var(--t-rule);
    border-radius: 12px;
    padding: 1.5rem;
}

.login-headline {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.login-sub {
    color: var(--t-muted);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.login-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--t-ink);
    margin-bottom: 0.3rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--t-muted);
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.login-footer a {
    color: var(--t-muted);
    text-decoration: none;
}

.login-footer a:hover {
    color: var(--t-teal);
}

/* ===== Cards (article) ===== */
article header h1 {
    font-size: 1.5rem;
}

/* ===== Tables ===== */
table {
    border-collapse: collapse;
}

th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.05em;
}

/* Geschätzte Mengen gelb markieren */
tr.estimated {
    background-color: rgba(255, 193, 7, 0.1);
}

small.warning {
    color: var(--t-amber);
    font-weight: 600;
}

/* ===== Konfidenz-Badge ===== */
.confidence {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.confidence-high {
    background-color: var(--t-green-tint);
    color: var(--t-green);
}

.confidence-mid {
    background-color: var(--t-amber-tint);
    color: var(--t-amber);
}

.confidence-low {
    background-color: var(--t-red-tint);
    color: var(--t-red);
}

/* ===== BLS-Suche ===== */
.bls-search-container {
    position: relative;
    margin-top: 4px;
}

.bls-search {
    font-size: 0.85em !important;
    padding: 4px 8px !important;
    margin-bottom: 0 !important;
}

.bls-results {
    position: absolute;
    z-index: 100;
    background: var(--t-card);
    border: 1px solid var(--t-rule);
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    display: none;
}

.bls-results.show {
    display: block;
}

.bls-result-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.85em;
    border-bottom: 1px solid var(--t-rule);
}

.bls-result-item:hover {
    background-color: var(--t-teal-tint);
    color: var(--t-teal);
}

.bls-result-item:last-child {
    border-bottom: none;
}

/* ===== Ignorierte Zutaten ===== */
tr.skipped {
    opacity: 0.4;
}

/* ===== Nährwerttabelle ===== */
.nutrition-table {
    max-width: 600px;
}

.nutrition-table td:nth-child(2),
.nutrition-table td:nth-child(3),
.nutrition-table td:nth-child(4),
.nutrition-table th:nth-child(2),
.nutrition-table th:nth-child(3),
.nutrition-table th:nth-child(4) {
    text-align: right;
}

tr.sub-row td:first-child {
    padding-left: 1.5em;
    font-size: 0.9em;
}

/* ===== Nährwert-Ampel ===== */
.ampel {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.ampel-green {
    background-color: var(--t-green-tint);
    color: var(--t-green);
}

.ampel-yellow {
    background-color: var(--t-amber-tint);
    color: var(--t-amber);
}

.ampel-red {
    background-color: var(--t-red-tint);
    color: var(--t-red);
}

/* ===== BLS-Select in Review ===== */
.bls-select {
    font-size: 0.85em !important;
    padding: 4px 8px !important;
    margin-bottom: 4px !important;
}

/* ===== Details / Summary (aufklappbar) ===== */
details {
    border: 1px solid var(--t-rule);
    border-radius: var(--be-radius);
    margin-top: 1rem;
    padding: 0;
    background-color: var(--t-card);
}

details summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--t-teal);
    font-weight: 600;
}

details summary:hover {
    color: var(--t-teal-light);
}

details[open] summary {
    border-bottom: 1px solid var(--t-rule);
    margin-bottom: 0;
}

details figure {
    margin: 0;
    padding: 0.5rem;
}

/* ===== Ampel-Legende ===== */
.ampel-legend {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    color: var(--t-muted);
}

.ampel-legend .ampel {
    font-size: 0.75em;
    vertical-align: middle;
}

/* ===== Portions-Slider ===== */
.portions-slider {
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.portions-slider input[type="range"] {
    width: 100%;
    accent-color: var(--t-teal);
}

.portions-input-label {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.portions-input {
    width: 6rem;
    display: inline-block;
}

.portions-reset {
    margin-left: 0.5rem;
    width: auto;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

/* ===== Optimization Comparison ===== */
.optimization-comparison {
    margin-bottom: 1.5rem;
}

.comparison-cards {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.comparison-card {
    background: var(--t-bg);
    border: 1px solid var(--t-rule);
    border-radius: var(--be-radius);
    padding: 0.75rem 1.25rem;
    text-align: center;
}

.comparison-card-result {
    border-color: var(--t-teal);
}

.comparison-card-savings {
    border-color: var(--t-green);
    background: var(--t-green-tint);
}

.comparison-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--t-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.comparison-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.comparison-arrow {
    font-size: 1.5rem;
    color: var(--t-muted);
}

/* ===== Macro Donut Chart ===== */
.macro-donut-section {
    margin-bottom: 1.5rem;
}

.macro-donut-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.macro-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.macro-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.macro-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== Optimierung ===== */
.warning-text {
    color: var(--t-amber);
    font-weight: 600;
}

.success-text {
    color: var(--t-green);
    font-weight: 600;
}

.savings {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    background-color: var(--t-green-tint);
    color: var(--t-green);
    white-space: nowrap;
}

.action-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
}

.action-substitute { background-color: #e3f2fd; color: #1565c0; }
.action-reduce { background-color: var(--t-amber-tint); color: var(--t-amber); }

tr.invalid-suggestion {
    opacity: 0.5;
}

/* ===== Loading state ===== */
#loading, #calc-loading {
    color: var(--t-teal);
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    figure {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    figure table {
        min-width: 600px;
    }

    .nutrition-table {
        min-width: auto;
    }

    .comparison-cards {
        flex-direction: column;
        align-items: stretch;
    }

    .comparison-arrow {
        text-align: center;
        transform: rotate(90deg);
    }

    .macro-donut-container {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Zweispaltiges Eingabe-Layout: kommt jetzt kanonisch aus tinte-base.css
   (.split-layout, BENT-1399); tool-lokales Grid entfernt (BENT-1406).
   Die History-Card unten bleibt auf gleicher Breite/Zentrierung wie das Grid. */

/* ===== Recipe History ===== */
.recipe-history-card {
    margin: 2rem auto 0;
    max-width: 1040px;
}

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

.recipe-history li {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--t-rule);
}

.recipe-history li:last-child {
    border-bottom: none;
}

.recipe-history a {
    text-decoration: none;
    font-weight: 500;
}

/* ===== Utility ===== */
.estimated-row { background: var(--t-amber-tint); }
.badge-small { font-size: 0.7rem; padding: 0.1rem 0.4rem; }
.mt-1 { margin-top: 1rem; }
/* BENT-1549: vormals inline style="margin-top: ...", jetzt CSS-Klassen (CSP ohne 'unsafe-inline'). */
.mt-sm { margin-top: 0.5rem; }
.actions--spaced { margin-top: 1.5rem; }
.review-meta-card { margin-bottom: 1.5rem; max-width: 720px; margin-left: auto; margin-right: auto; }
.amount-input { width: 120px; }
.macro-dot--fat { background: #e65100; }
.macro-dot--cho { background: #1565c0; }
.macro-dot--prot { background: #2e7d32; }
.details-body { padding: 1rem; }
.history-heading { margin-top: 0; border: none; }

/* ===== Print ===== */
@media print {
    .site-header, .site-footer, .bls-search-container, button, details summary {
        display: none !important;
    }
    details[open] {
        display: block !important;
    }
}
