/* =============================================================================
 * HOME.CSS — v7.0.0
 * Dashboard Kachel-UI · Premium Kaufland Design
 *
 * Abhängig von: style.css (Design-Tokens)
 *
 * ÄNDERUNGEN v7.0.0:
 *   - Komplett überarbeitetes Design (professionell, modern, Kaufland-CI)
 *   - Kein Status-Dot / kein farbiger Top-Rand (kein künstlicher Zustand)
 *   - Kategorie-Header als Trennlinie mit Label + Kachelanzahl
 *   - Staggered fadeUp-Animation für Kacheln
 *   - Neue Badge-Klassen: .home-badge-multi (rot) / .home-badge-single (neutral)
 *   - Neue Pill-Klassen: .home-pill-pal / -akz / -wgv-in / -wgv-ex / -sort
 *   - VZ-Tag als eigenes Element: .home-vz-tag
 *   - Ghost-Icon-Buttons + roter Primary-Button im Footer
 *   - Alle hardcodierten Farben durch CSS-Variablen ersetzt
 *   - Dark-Mode-kompatibel
 * ============================================================================= */


/* ─────────────────────────── ANIMATION ─────────────────────────── */

@keyframes homeCardFadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ─────────────────────────── PAGE ─────────────────────────── */

.home-page {
  font-family: var(--font-sans);
  background: var(--bg-page);
  min-height: calc(100vh - 64px);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

.home-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px 48px;
}

@media (max-width: 768px) {
  .home-main { padding: 16px 14px 32px; }
}


/* ─────────────────────────── TOOLBAR ─────────────────────────── */

.home-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.home-search-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.home-search-input input {
  background: var(--bg-input) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-inner) !important;
  font-size: 13px !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.home-search-input input:focus {
  border-color: var(--kf-red) !important;
  box-shadow: 0 0 0 3px var(--kf-red-light) !important;
}


.home-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.home-vt-group {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-inner);
  overflow: hidden;
}

.home-vt-btn {
  background: transparent;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.home-vt-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.home-vt-btn.home-vt-active {
  color: var(--kf-red);
  background: var(--kf-red-light);
}


/* ─────────────────────────── CATEGORY SECTIONS ─────────────────────────── */

.home-category {
  margin-bottom: 32px;
}

.home-cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.home-cat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  white-space: nowrap;
}

.home-cat-line {
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.home-cat-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}


/* ─────────────────────────── GRID LAYOUT ─────────────────────────── */

.home-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  align-items: start; /* Kacheln wachsen unabhängig — keine erzwungene Gleichhöhe */
}

@media (max-width: 480px) {
  .home-card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}


/* ─────────────────────────── SKELETON LOADER ─────────────────────────── */

@keyframes homeSkeleton {
  0%   { opacity: 1; }
  50%  { opacity: 0.4; }
  100% { opacity: 1; }
}

.home-skeleton-card {
  animation: homeSkeleton 1.4s ease-in-out infinite !important;
  pointer-events: none;
}

.home-skeleton-card-0 { animation-delay: 0.00s !important; }
.home-skeleton-card-1 { animation-delay: 0.15s !important; }
.home-skeleton-card-2 { animation-delay: 0.30s !important; }
.home-skeleton-card-3 { animation-delay: 0.45s !important; }

.home-skeleton-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-skeleton-title {
  flex: 1;
  height: 14px;
  border-radius: 6px;
  background: var(--bg-subtle);
  max-width: 60%;
}

.home-skeleton-badge {
  width: 80px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg-subtle);
}

.home-skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: var(--bg-subtle);
  margin: 6px 8px;
}

.home-skeleton-line--long   { width: 75%; }
.home-skeleton-line--medium { width: 55%; }
.home-skeleton-line--short  { width: 40%; }

.home-skeleton-pills {
  height: 20px;
  width: 50%;
  border-radius: 6px;
  background: var(--bg-subtle);
  margin: 4px 8px 6px;
}

.home-skeleton-foot {
  height: 36px;
}

.home-skeleton-cat-label {
  width: 80px;
  height: 12px;
  border-radius: 6px;
  background: var(--bg-subtle);
}




.home-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: homeCardFadeUp 0.35s ease-out both;
  transition: transform 0.2s cubic-bezier(0.22, 0.68, 0, 1.2),
              box-shadow 0.2s ease,
              border-color 0.2s ease;
}

/* Staggered animation delays */
.home-card-0  { animation-delay: 0.04s; }
.home-card-1  { animation-delay: 0.08s; }
.home-card-2  { animation-delay: 0.12s; }
.home-card-3  { animation-delay: 0.16s; }
.home-card-4  { animation-delay: 0.20s; }
.home-card-5  { animation-delay: 0.24s; }
.home-card-6  { animation-delay: 0.28s; }
.home-card-7  { animation-delay: 0.32s; }
.home-card-8  { animation-delay: 0.36s; }
.home-card-9  { animation-delay: 0.40s; }
.home-card-10 { animation-delay: 0.44s; }
.home-card-11 { animation-delay: 0.48s; }

/* Hover nur auf Geräten mit Maus */
@media (hover: hover) and (pointer: fine) {
  .home-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.09), 0 2px 8px rgba(0, 0, 0, 0.05);
    border-color: var(--border-card);
  }
}


/* ─────────────────────────── CARD → HEADER ─────────────────────────── */

.home-card-head {
  padding: 16px 16px 14px;
  border-bottom: 0.5px solid var(--border-light);
}

.home-card-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-card-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

/* Badge: einheitlich neutral — kein Rot, Rot ist nur für Aktionen (Live Monitor) */
.home-badge-multi,
.home-badge-single {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}


/* ─────────────────────────── CARD → BODY ─────────────────────────── */

.home-card-body {
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.home-card-body-scroll {
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

/* Seiten-Trenner innerhalb der Kachel */
.home-page-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 4px;
}

.home-page-sep-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.home-page-sep-line {
  flex: 1;
  height: 0.5px;
  background: var(--border-light);
}

/* Diagramm-Zeile */
.home-diag-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-inner);
  transition: background 0.12s;
}

.home-diag-row:hover {
  background: var(--bg-hover);
}

.home-diag-idx {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 14px;
  padding-top: 3px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.home-diag-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.home-diag-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.home-diag-name {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* VZ-Nummer als eigenes Tag */
.home-vz-tag {
  font-size: 10px;
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

[data-mantine-color-scheme="dark"] .home-vz-tag {
  background: var(--bg-subtle) !important;
  color: var(--text-muted) !important;
  border-color: var(--border-light) !important;
}


/* ─────────────────────────── PILLS ─────────────────────────── */

.home-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.home-pill {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
  display: inline-block;
  letter-spacing: 0.01em;
}

.home-pill-pal {
  background: #E6F1FB;
  color: #0C447C;
}

.home-pill-akz {
  background: #E0F4F1;
  color: #0A5249;
}

.home-pill-wgv-in {
  background: #E8F5EC;
  color: #1B5E2E;
}

.home-pill-wgv-ex {
  background: #FDECEC;
  color: #8B1A1A;
}

.home-pill-sort {
  background: #EEF0FD;
  color: #2D3580;
}

/* Dark-Mode: dunkle Fills, helle Texte — gleiche Semantik, augenschonend */
[data-mantine-color-scheme="dark"] .home-pill-pal    { background: #0C2E52 !important; color: #85B7EB !important; }
[data-mantine-color-scheme="dark"] .home-pill-akz    { background: #0A2E2A !important; color: #5DCAA5 !important; }
[data-mantine-color-scheme="dark"] .home-pill-wgv-in { background: #0F2E17 !important; color: #97C459 !important; }
[data-mantine-color-scheme="dark"] .home-pill-wgv-ex { background: #2E0E0E !important; color: #F09595 !important; }
[data-mantine-color-scheme="dark"] .home-pill-sort   { background: #1A1E4A !important; color: #AFA9EC !important; }


/* ─────────────────────────── CARD → EMPTY STATE ─────────────────────────── */

.home-card-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 18px;
  flex: 1;
}

.home-empty-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}


/* ─────────────────────────── CARD → FOOTER ─────────────────────────── */

.home-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 0.5px solid var(--border-light);
  margin-top: auto;
  background: var(--bg-subtle);
}

/* Ghost-Icon-Button (Historie, Stundenleistung) */
.home-ghost-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-inner);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  transition: all 0.15s;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
}

.home-ghost-icon:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border-color: var(--text-muted);
}

/* Primary-Button (Live Monitor) — volle Breite, ausreichend Höhe */
.home-ghost-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  height: 36px;
  min-width: 0;
  border-radius: var(--radius-inner);
  background: var(--kf-red);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  border: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  padding: 0 16px;
}

.home-ghost-primary:hover {
  background: var(--kf-red-hover);
  box-shadow: 0 4px 14px var(--kf-red-glow);
}

.home-ghost-primary-arrow {
  display: inline-block;
  transition: transform 0.2s;
}

.home-ghost-primary:hover .home-ghost-primary-arrow {
  transform: translateX(3px);
}


/* ─────────────────────────── LIST VIEW ─────────────────────────── */

.home-list-container {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.home-list-head {
  display: grid;
  grid-template-columns: 1fr 60px 140px 140px;
  gap: 12px;
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--table-header-bg);
  border-bottom: 1px solid var(--border-light);
}

.home-list-row {
  display: grid;
  grid-template-columns: 1fr 60px 140px 140px;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  transition: background 0.15s;
  border-bottom: 0.5px solid var(--border-light);
  animation: homeCardFadeUp 0.3s ease-out both;
}

.home-list-row:last-child { border-bottom: none; }
.home-list-row:hover { background: var(--bg-hover); }

.home-list-row:nth-child(even) { background: var(--table-stripe); }
.home-list-row:nth-child(even):hover { background: var(--table-hover); }

/* Staggered delays */
.home-list-row-0 { animation-delay: 0.00s; }
.home-list-row-1 { animation-delay: 0.03s; }
.home-list-row-2 { animation-delay: 0.06s; }
.home-list-row-3 { animation-delay: 0.09s; }
.home-list-row-4 { animation-delay: 0.12s; }
.home-list-row-5 { animation-delay: 0.15s; }

.home-list-col-info { overflow: hidden; }

.home-list-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-list-sub {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.home-list-count {
  font-size: 16px;
  font-weight: 500;
  font-family: var(--font-mono);
  text-align: center;
  color: var(--text-primary);
}

.home-spark-wrap { display: flex; align-items: center; gap: 8px; }

.home-spark-bg {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.home-spark-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease-out;
}

.home-spark-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: right;
  font-family: var(--font-mono);
}

.home-list-col-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.home-list-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.home-list-btn:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.home-list-btn-primary {
  background: var(--kf-red);
  border-color: var(--kf-red);
  color: #ffffff;
}

.home-list-btn-primary:hover {
  background: var(--kf-red-hover);
  border-color: var(--kf-red-hover);
  box-shadow: 0 2px 8px var(--kf-red-glow);
}

@media (max-width: 768px) {
  .home-list-head, .home-list-row {
    grid-template-columns: 1fr 44px;
    gap: 8px;
    padding: 10px 12px;
  }
  .home-spark-wrap { display: none; }
  .home-list-col-actions { display: none; }
}


/* ─────────────────────────── PRINT ─────────────────────────── */

@media print {
  .home-toolbar, .home-card-foot, .home-list-col-actions {
    display: none;
  }
  .home-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
    animation: none;
  }
}