/* ============================================================
   XRechnungen – Components: Flashes, Alerts, Summary, Scan-Result,
                              Pricing, FAQ, Toast
   ============================================================ */

/* ── Flash messages ──────────────────────────────────────── */
.flashes { list-style: none; padding: 0; margin: 0 0 16px; }
.flash { padding: 10px 14px; border-radius: 7px; margin-bottom: 8px; font-size: 0.92em; }
.flash-error   { background: var(--error-bg); color: var(--error); }
.flash-success { background: var(--ok-bg);    color: var(--ok); }
.flash-warning { background: var(--warn-bg);  color: var(--warn); }
.flash-info, .flash-message {
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
}

/* ── Alert boxes ─────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 7px; margin: 10px 0; font-weight: 500; }
.alert-ok    { background: var(--ok-bg);    color: var(--ok); }
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-warn  { background: var(--warn-bg);  color: var(--warn); }

/* ── Summary (key-value grid) ────────────────────────────── */
.summary {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 24px; margin: 0;
}
.summary dt { color: var(--muted); font-size: 0.9em; }
.summary dd { margin: 0; overflow-wrap: break-word; word-break: break-word; }

/* ── Issues table ────────────────────────────────────────── */
.issues td, .issues th { font-size: 0.9em; }
.issues .lvl-error   td { background: var(--error-bg); }
.issues .lvl-warning td { background: var(--warn-bg); }

/* ── Scan result: score / gauge ──────────────────────────── */
.score { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.gauge {
    width: 108px; height: 108px; border-radius: 50%;
    background: conic-gradient(var(--primary) 0%, var(--surface-alt) 0);
    display: grid; place-items: center; flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--border);
}
.gauge span {
    width: 80px; height: 80px; border-radius: 50%;
    background: var(--surface); display: grid; place-items: center;
    font-weight: 800; color: var(--primary); font-size: 1.15em;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.06);
}

/* ── Tag chips ───────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.tag-chip {
    padding: 4px 10px; border-radius: 999px; font-size: 0.82em;
    background: var(--surface-alt); color: var(--fg); border: 1px solid var(--border);
}
.tag-chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }

/* ── Warnings list ───────────────────────────────────────── */
.warnings { list-style: none; padding: 0; margin: 8px 0 0; }
.warnings li {
    padding: 6px 10px; background: var(--warn-bg); color: var(--warn);
    border-radius: 6px; margin-bottom: 4px; font-size: 0.9em;
}

/* ── Download card ───────────────────────────────────────── */
.download-card .dl-grid { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── Muted helper ────────────────────────────────────────── */
.muted { color: var(--muted); }

/* ── Checklist (required fields with BT codes) ───────────── */
.checklist {
    list-style: none; padding: 0; margin: 0; display: grid; gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
}
.checklist li {
    display: grid; grid-template-columns: auto 1fr; gap: 4px 10px;
    padding: 10px 14px; border-radius: 8px;
    background: var(--surface-alt); border: 1px solid var(--border);
    align-items: start;
}
.checklist li.ok      { border-color: transparent; background: var(--ok-bg); }
.checklist li.missing { border-color: var(--error); background: var(--error-bg); }
.checklist li.optional { opacity: 0.85; }
.checklist .ico {
    font-size: 1.1em; font-weight: 700; line-height: 1;
    width: 20px; text-align: center;
}
.checklist li.ok      .ico { color: var(--ok); }
.checklist li.missing .ico { color: var(--error); }
.checklist li.optional .ico { color: var(--muted); }
.checklist .label { font-weight: 600; }
.checklist .bt {
    display: inline-block; margin-left: 6px;
    font-size: 0.75em; font-weight: 500;
    color: var(--muted); background: var(--surface);
    padding: 1px 6px; border-radius: 4px;
    border: 1px solid var(--border); vertical-align: middle;
}
.checklist .value {
    grid-column: 2; font-size: 0.85em; color: var(--muted);
    overflow-wrap: break-word; word-break: break-word;
}

/* ── Pricing: interval switcher ──────────────────────────── */
.interval-switcher {
    display: inline-flex;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px; padding: 4px; gap: 4px;
    margin-top: .75rem;
}
.interval-btn {
    padding: 6px 20px; border: none; border-radius: 999px;
    cursor: pointer; font-weight: 600; font-size: .9rem;
    background: transparent; color: var(--fg);
    transition: background .15s, color .15s;
}
/* .interval-btn.active is in buttons.css (uses --btn-bg) */

/* ── Save badge ──────────────────────────────────────────── */
.save-badge {
    font-size: .72rem; background: var(--ok); color: #fff;
    padding: 2px 6px; border-radius: 999px; margin-left: 4px; font-weight: 700;
}

/* ── FAQ accordion ───────────────────────────────────────── */
.faq-item {
    border: 1px solid var(--border); border-radius: 8px;
    margin-bottom: .6rem; overflow: hidden; background: var(--surface);
}
.faq-item summary {
    cursor: pointer; font-weight: 600; font-size: .95em;
    padding: 14px 18px; list-style: none;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    background: var(--surface);
    transition: background .15s, color .15s;
    user-select: none; color: var(--fg); border-radius: 8px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+'; font-size: 1.35rem; font-weight: 300; color: var(--primary);
    flex-shrink: 0; line-height: 1; min-width: 20px; text-align: right;
    transition: transform .2s;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item summary:hover {
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
    color: var(--primary);
}
.faq-item[open] summary {
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid var(--border);
}
.faq-item p, .faq-item > div {
    padding: 13px 18px; margin: 0; color: var(--fg);
    background: var(--surface-alt); font-size: .92em;
    line-height: 1.65; border-radius: 0 0 8px 8px;
}

/* ── Form collapsible (kompakte <details>-Variante für Formulare) ──
   Referenz: DESIGN_SYSTEM §4/§13 — klickbarer Header, Chevron rechts
   (rotiert bei [open]), Inhalt klar getrennt auf --surface-alt.       */
.form-collapsible {
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); margin-top: .6rem; overflow: hidden;
}
.form-collapsible > summary {
    cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--fg);
    padding: 9px 14px; list-style: none; user-select: none;
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    transition: background .15s, color .15s;
}
.form-collapsible > summary::-webkit-details-marker { display: none; }
.form-collapsible > summary::after {
    content: '▾'; color: var(--primary); font-size: .8rem;
    flex-shrink: 0; line-height: 1; transition: transform .2s;
}
.form-collapsible[open] > summary::after { transform: rotate(180deg); }
.form-collapsible > summary:hover {
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
    color: var(--primary);
}
.form-collapsible[open] > summary { border-bottom: 1px solid var(--border); }
.form-collapsible > .fc-body {
    padding: 12px 14px; background: var(--surface-alt); margin: 0;
}

/* ── Gestylter Datei-Input (nativer Input versteckt, .btn-Label) ── */
.file-input-hidden {
    position: absolute; width: 1px; height: 1px;
    opacity: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.file-input-hidden:focus-visible + label.btn {
    outline: 2px solid var(--primary); outline-offset: 2px;
}
.file-input-name {
    font-size: .8rem; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}

/* ── Toast notification system ───────────────────────────── */
#toast-container {
    position: fixed; top: 72px; right: 16px;
    z-index: 9999; display: flex; flex-direction: column;
    gap: 8px; max-width: 380px; pointer-events: none;
}
.toast {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; border-radius: 9px;
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,.12); font-size: .875rem;
    line-height: 1.4; pointer-events: all;
    animation: toast-in .22s cubic-bezier(.25,.46,.45,.94);
    transition: opacity .3s, transform .3s; max-width: 100%;
}
.toast.toast-hiding { opacity: 0; transform: translateX(16px); }
@keyframes toast-in {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast-icon  { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.toast-body  { flex: 1; min-width: 0; word-break: break-word; }
.toast-close {
    background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: 1rem; line-height: 1;
    padding: 0 2px; flex-shrink: 0; margin-top: 1px;
    opacity: .6; transition: opacity .1s;
}
.toast-close:hover { opacity: 1; }
.toast-success { border-left: 3px solid var(--ok); }
.toast-success .toast-icon::before { content: '✓'; color: var(--ok); }
.toast-error   { border-left: 3px solid var(--error); }
.toast-error   .toast-icon::before { content: '✕'; color: var(--error); }
.toast-warning { border-left: 3px solid var(--warn); }
.toast-warning .toast-icon::before { content: '⚠'; color: var(--warn); }
.toast-info    { border-left: 3px solid var(--primary); }
.toast-info    .toast-icon::before { content: 'ℹ'; color: var(--primary); }
