/* SYNC-GRUPPE portal-assets · Kanonische Quelle: partner-portal/assets/css/components.css
 * Aenderungen NUR in der Quelle vornehmen, dann: php tools/sync-portal-assets.php --apply
 * Kopien in den anderen Portalen werden dabei byte-genau ueberschrieben. */
/* Cards, Buttons, Forms, Tables, Badges, Dialogs, Toast, Tabs, Pagination, Empty/Loading-States */

/* --- Card ---------------------------------------------------------- */
.card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-6);
    transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.card--compact { padding: var(--space-4); }
.card--flush { padding: 0; }
/* dezent anhebbare Karten (opt-in via .card--lift) */
.card--lift:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-default); }
.card__header {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3); margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}
.card__title { font-family: var(--font-display); font-size: var(--text-md); font-weight: var(--weight-bold); letter-spacing: -0.01em; }
.card__subtitle { font-size: var(--text-xs); color: var(--text-muted); }
.card__actions { display: flex; gap: var(--space-2); }

/* --- Buttons ------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    font-family: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold);
    padding: var(--space-2) var(--space-4);
    min-height: 38px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
                color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }          /* taktiles Feedback (Emil) */
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .material-symbols-outlined { font-size: 18px; }

.btn--primary {
    background: var(--color-primary-600);
    background-image: var(--grad-brand);
    color: #fff; border-color: transparent;
    box-shadow: var(--shadow-brand);
}
.btn--primary:hover { filter: brightness(1.05); color: #fff; box-shadow: 0 16px 30px -12px rgba(0,129,137,.65); }
.btn--primary:active { filter: brightness(.98); }

.btn--secondary { background: var(--bg-surface); border-color: var(--border-default); color: var(--text-primary); }
.btn--secondary:hover { background: var(--bg-muted); border-color: var(--border-strong); }

.btn--ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn--ghost:hover { background: var(--bg-muted); color: var(--text-primary); }

.btn--danger { background: var(--color-danger-500); color: var(--text-inverse); border-color: var(--color-danger-500); }
.btn--danger:hover { background: var(--color-danger-700); border-color: var(--color-danger-700); color: var(--text-inverse); }

.btn--sm { padding: var(--space-1) var(--space-3); min-height: 30px; font-size: var(--text-xs); }
.btn--lg { padding: var(--space-3) var(--space-5); min-height: 46px; font-size: var(--text-md); }
.btn--icon { padding: var(--space-2); min-height: 38px; aspect-ratio: 1; }
.btn--block { display: flex; width: 100%; }

/* --- Forms --------------------------------------------------------- */
.form-field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.form-label { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-primary); }
.form-label__required { color: var(--color-danger-500); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
    font-family: inherit; font-size: var(--text-sm);
    padding: var(--space-2) var(--space-3);
    min-height: 38px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--border-strong); }
.form-input:focus-visible, .form-select:focus-visible, .form-textarea:focus-visible {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: var(--shadow-focus);
}
.form-textarea { min-height: 96px; resize: vertical; }

/* ── Formular-Modernisierung (2026-06): einheitliche Basis für UNklassierte Felder ──
   Gibt jedem rohen Textfeld im Content-Bereich denselben modernen Look wie .form-input
   (Fokusring, Fehlerstatus, Abstände, mobil). :where() hält die Spezifität bei 0 →
   explizite .form-*-Klassen + Inline-Styles gewinnen; Checkbox/Radio/File/Buttons außen vor. */
.content :where(
  input:is([type=text],[type=email],[type=password],[type=number],[type=search],[type=url],[type=tel],[type=date],[type=datetime-local],[type=month],[type=time],[type=week]),
  input:not([type]), textarea, select
) {
  font-family: inherit;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  min-height: 38px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  max-width: 100%;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.content :where(
  input:is([type=text],[type=email],[type=password],[type=number],[type=search],[type=url],[type=tel],[type=date],[type=datetime-local],[type=month],[type=time],[type=week]),
  input:not([type]), textarea, select
):focus-visible {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: var(--shadow-focus);
}
.content :where(input, textarea)::placeholder { color: var(--text-muted); }
.content :where(input, textarea, select)[aria-invalid="true"],
.content :where(input, textarea, select):user-invalid {
  border-color: var(--color-danger-500);
  box-shadow: 0 0 0 3px rgba(224,65,62,.18);
}
@media (max-width: 640px) {
  /* 16px verhindert das iOS-Auto-Zoom beim Fokussieren. */
  .content :where(input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select) { font-size: 16px; }
}

.form-help { font-size: var(--text-xs); color: var(--text-muted); }
.form-error { font-size: var(--text-xs); color: var(--color-danger-500); }
.form-field--invalid .form-input,
.form-field--invalid .form-select,
.form-field--invalid .form-textarea { border-color: var(--color-danger-500); box-shadow: 0 0 0 3px rgba(224,65,62,.18); }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.form-actions { display: flex; gap: var(--space-2); justify-content: flex-end; margin-top: var(--space-5); }

/* --- Table --------------------------------------------------------- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.table thead th {
    text-align: left;
    padding: var(--space-3);
    background: var(--bg-muted);
    color: var(--text-secondary);
    font-weight: var(--weight-bold);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border-default);
    white-space: nowrap;
}
.table thead th:first-child { border-top-left-radius: var(--radius-md); }
.table thead th:last-child  { border-top-right-radius: var(--radius-md); }
.table tbody td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table--hover tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.table--hover tbody tr:hover { background: var(--color-primary-50); }
.table--zebra tbody tr:nth-child(even) { background: var(--bg-muted); }
.table--compact tbody td, .table--compact thead th { padding: var(--space-2); }
.table-cell--right { text-align: right; }
.table-cell--center { text-align: center; }

.table-actions { display: flex; gap: var(--space-1); justify-content: flex-end; }

.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); background: var(--bg-surface); box-shadow: var(--shadow-sm); }

/* --- Status-Badges ------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: var(--space-1);
    padding: 3px var(--space-2);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    background: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge--success { background: var(--color-success-100); color: var(--color-success-700); }
.badge--warning { background: var(--color-warning-100); color: var(--color-warning-700); }
.badge--danger  { background: var(--color-danger-100);  color: var(--color-danger-700);  }
.badge--info    { background: var(--color-info-100);    color: var(--color-info-700);    }
.badge--neutral { background: var(--bg-muted);          color: var(--text-secondary);    }

/* --- Dialog (natives <dialog>) ------------------------------------- */
dialog.dialog {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    max-width: 560px; width: 90vw;
}
dialog.dialog::backdrop { background: rgba(10,37,64,.45); backdrop-filter: blur(2px); }
.dialog__header { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
.dialog__title { font-family: var(--font-display); font-size: var(--text-md); font-weight: var(--weight-bold); }
.dialog__body { padding: var(--space-5); }
.dialog__footer { padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: var(--space-2); }

/* Auftritt der Dialoge (origin = Mitte; Modals bleiben zentriert) */
dialog.dialog[open] { animation: noa-pop var(--dur-base) var(--ease-spring); }

/* --- Toast --------------------------------------------------------- */
.toast-container {
    position: fixed; top: calc(var(--topbar-h) + var(--space-3)); right: var(--space-5);
    z-index: var(--z-toast);
    display: flex; flex-direction: column; gap: var(--space-2);
    pointer-events: none;
}
.toast {
    display: flex; align-items: flex-start; gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    min-width: 280px; max-width: 420px;
    pointer-events: auto;
    transform: translateX(120%);
    transition: transform var(--dur-slow) var(--ease-out);
}
.toast.is-visible { transform: translateX(0); }
.toast--success { border-left: 4px solid var(--color-success-500); }
.toast--warning { border-left: 4px solid var(--color-warning-500); }
.toast--error   { border-left: 4px solid var(--color-danger-500); }
.toast--info    { border-left: 4px solid var(--color-info-500); }

/* --- Pagination ---------------------------------------------------- */
.pagination { display: flex; align-items: center; gap: var(--space-1); justify-content: center; margin-top: var(--space-5); flex-wrap: wrap; }
.pagination__item, .pagination__ellipsis {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.pagination__item:hover { background: var(--bg-muted); color: var(--text-primary); text-decoration: none; }
.pagination__item.is-active { background: var(--color-primary-600); background-image: var(--grad-brand); color: var(--text-inverse); box-shadow: var(--shadow-brand); }
.pagination__item.is-disabled { opacity: .4; pointer-events: none; }

/* --- Empty / Loading / Error --------------------------------------- */
.empty-state { padding: var(--space-12) var(--space-5); text-align: center; color: var(--text-muted); }
.empty-state__icon { font-size: 48px; color: var(--text-muted); margin-bottom: var(--space-3); }
.empty-state__title { font-size: var(--text-md); color: var(--text-primary); margin-bottom: var(--space-2); }
.empty-state__desc { font-size: var(--text-sm); margin-bottom: var(--space-4); }

.error-banner {
    display: flex; align-items: flex-start; gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--color-danger-500);
    background: var(--color-danger-50);
    color: var(--color-danger-700);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-muted) 0%, var(--color-neutral-200) 50%, var(--bg-muted) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite ease;
    border-radius: var(--radius-sm);
    height: 14px;
}
@keyframes shimmer { 0%{background-position:200% 0;} 100%{background-position:-200% 0;} }

/* --- KPI-Card (Komponenten-Variante .kpi / .kpi-strip) ------------- */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
@media (max-width: 1280px) { .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px)  { .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex; flex-direction: column; gap: var(--space-2);
    box-shadow: var(--shadow-sm);
}
.kpi__label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: var(--weight-semibold); }
.kpi__value { font-family: var(--font-display); font-size: var(--text-2xl); line-height: var(--leading-2xl); font-weight: var(--weight-extra); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.kpi__delta { font-size: var(--text-xs); display: flex; align-items: center; gap: var(--space-1); font-weight: var(--weight-semibold); }
.kpi__delta--up   { color: var(--color-success-700); }
.kpi__delta--down { color: var(--color-danger-700); }
.kpi__delta--flat { color: var(--text-muted); }
.kpi__spark { margin-top: auto; height: 32px; }

/* --- Filterbar ----------------------------------------------------- */
.filter-bar {
    display: flex; gap: var(--space-2); flex-wrap: wrap;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    align-items: center;
    box-shadow: var(--shadow-sm);
}
.filter-bar__search { flex: 1; min-width: 240px; }
.filter-bar__field { display: flex; flex-direction: column; gap: 2px; }
.filter-bar__field-label { font-size: var(--text-xs); color: var(--text-muted); }

/* --- Tabs ---------------------------------------------------------- */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--space-4); }
.tabs__item {
    padding: var(--space-2) var(--space-4);
    border-bottom: 2px solid transparent;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
}
.tabs__item:hover { color: var(--text-primary); text-decoration: none; }
.tabs__item.is-active { color: var(--color-primary-700); border-bottom-color: var(--color-primary-500); font-weight: var(--weight-semibold); }

/* --- Search-Palette (Ctrl+K) --------------------------------------- */
dialog.search-palette { max-width: 640px; padding: 0; }
.search-palette__input {
    width: 100%; border: none; padding: var(--space-4) var(--space-5);
    font-size: var(--text-md); font-family: inherit; color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    outline: none;
}
.search-palette__results { max-height: 320px; overflow-y: auto; }
.search-palette__item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
}
.search-palette__item:hover, .search-palette__item.is-focused { background: var(--color-primary-50); text-decoration: none; }
.search-palette__item-label { font-weight: var(--weight-semibold); }
.search-palette__item-path { font-size: var(--text-xs); color: var(--text-muted); margin-left: auto; }

/* --- Sparkline (legacy fuer Dashboard) ----------------------------- */
.sparkline { width: 100%; height: 100%; display: block; }


/* ===== DARK MODE · components.css (auto-generated aus CSS-Audit, gezielte Flächen/Text-Korrekturen) ===== */
[data-theme="dark"] .table--hover tbody tr:hover { background: var(--bg-elevated); }
[data-theme="dark"] .search-palette__item:hover, [data-theme="dark"] .search-palette__item.is-focused { background: var(--bg-elevated); }
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, var(--bg-muted) 0%, var(--bg-elevated) 50%, var(--bg-muted) 100%); }
