/* =============================================================================
 * HOME.CSS — v6.0.0 Modernized
 * Dashboard Kachel-UI · Clean SaaS Look · Kaufland CI
 *
 * Ersetzt die bestehende home.css komplett.
 * Abhängig von: style.css (Design-Tokens)
 * ============================================================================= */


/* ─────────────────────────── 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;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.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-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding: 4px 10px 4px 8px;
  background: var(--bg-subtle);
  border-radius: 6px;
}


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

.home-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

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


/* ─────────────────────────── CARD BASE ─────────────────────────── */

.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-smooth),
              transform var(--transition-smooth),
              border-color var(--transition-smooth);
  animation: fadeInUp 0.4s ease-out both;
}

.home-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-color: rgba(225, 9, 21, 0.10);
}

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

/* Status Indicator Bar (Top) via :has() */
.home-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border-light);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  transition: background 0.3s;
}

.home-card:has(.home-dot-green)::before  { background: var(--status-ok); }
.home-card:has(.home-dot-yellow)::before { background: var(--status-warn); }
.home-card:has(.home-dot-red)::before    { background: var(--status-error); }


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

.home-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
}

.home-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.home-dot-green {
  background: var(--status-ok);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
  animation: livePulse 2.5s ease-in-out infinite;
}

.home-dot-yellow {
  background: var(--status-warn);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.home-dot-red {
  background: var(--status-error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.home-card-title {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-inner);
  background: var(--kf-red-light);
  color: var(--kf-red);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.home-rotation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #EFF6FF;
  color: #3B82F6;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}


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

.home-card-body {
  padding: 0 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

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

.home-diag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-inner);
  transition: background 0.15s;
}

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

.home-diag-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

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

.home-seite-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.home-seite-sep {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}


/* ─────────────────────────── 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 → TAGS ─────────────────────────── */

.home-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 18px 10px;
}

.home-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  white-space: nowrap;
}


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

.home-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
  background: var(--table-stripe);
}

.home-ghost-icon {
  width: 34px;
  height: 34px;
  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.2s;
  cursor: pointer;
}

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

.home-ghost-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 34px;
  border-radius: var(--radius-inner);
  background: var(--kf-red);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  border: none;
  white-space: nowrap;
}

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

.home-ghost-primary svg {
  transition: transform 0.25s;
}

.home-ghost-primary:hover svg {
  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: 36px 1fr 60px 140px 140px;
  gap: 12px;
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--table-header-bg);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  margin-bottom: 4px;
}

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

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

/* Zebra striping for list rows */
.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-dot { display: flex; align-items: center; justify-content: center; }
.home-list-col-info { overflow: hidden; }

.home-list-title {
  font-size: 14px;
  font-weight: 600;
  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: 700;
  font-family: var(--font-mono);
  text-align: center;
}

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

.home-spark-bg {
  flex: 1;
  height: 6px;
  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: 600;
  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.2s;
}

.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: 28px 1fr 44px 100px;
    gap: 8px;
    padding: 10px 12px;
  }
  .home-spark-wrap { display: none; }
  .home-list-col-actions { display: none; }
}


/* ─────────────────────────── FOOTER LEGEND ─────────────────────────── */

.home-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-inner);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.home-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.home-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.home-legend-sep {
  width: 1px;
  height: 16px;
  background: var(--border-light);
}

.home-legend-mono {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .home-legend { gap: 8px 12px; padding: 10px 14px; }
  .home-legend-sep { display: none; }
}


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

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