/* ═══════════════════════════════════════════════════════════
   Zhaz Design System — Reusable Components (zh- prefix)
   Self-scoped: no parent wrapper needed.
   Uses tokens from tokens.css
   ═══════════════════════════════════════════════════════════ */

/* ─── 0. Layout Container ─── */

html:has(.lab-modern),
html:has(.lab-modern) body {
  overflow: hidden;
  height: 100vh;
}

.lab-modern {
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
}

.lab-modern .lab-grid {
  padding: var(--sp-2) var(--sp-3) 40px;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  height: calc(100vh - 70px);
  overflow: hidden;
}

/* ─── 1. Kanban Card ─── */

.zh-kanban-card {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  align-items: stretch;
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  min-height: 60px;
  flex-shrink: 0;
  background: var(--bg-card);
}

.zh-kanban-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.zh-kanban-badge {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  min-height: 56px;
}

.zh-kanban-badge.badge-success { background: var(--sla-success); }
.zh-kanban-badge.badge-warning { background: var(--sla-warning); }
.zh-kanban-badge.badge-danger  { background: var(--sla-danger); }

.zh-kanban-main {
  padding: 8px 14px;
  min-width: 0;
}

.zh-kanban-line1 {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.zh-kanban-client {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.zh-kanban-line2 {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.zh-kanban-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}

.zh-kanban-tag--tech {
  background: var(--primary);
  color: #fff;
}

.zh-kanban-date {
  font-size: 11px;
  color: var(--text-muted);
}

.zh-kanban-corte {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}

.zh-kanban-corte.badge-success   { background: #dcfce7; color: #166534; }
.zh-kanban-corte.badge-warning   { background: #fef3c7; color: #92400e; }
.zh-kanban-corte.badge-danger    { background: #fee2e2; color: #991b1b; }
.zh-kanban-corte.badge-secondary { background: #f1f5f9; color: #64748b; }

.zh-kanban-metrics {
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  border-left: 1px solid var(--border);
  min-width: 100px;
}

.zh-kanban-metric {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zh-kanban-metric-label {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  min-width: 35px;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.zh-kanban-metric-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 55px;
  text-align: right;
}

.zh-kanban-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  font-size: 14px;
}

/* ─── 2. Modal ─── */

.zh-modal .modal-dialog {
  max-width: 1050px;
  width: 90vw;
}

.zh-modal .modal-content {
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 22px 56px rgba(15, 23, 42, 0.24);
}

.zh-modal .modal-header {
  background: linear-gradient(90deg, #226cc9 0%, #177d95 48%, #2e9d32 100%);
  color: #ffffff;
  border-bottom: 0;
  padding: 14px 20px;
}

.zh-modal .modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.zh-modal .modal-body {
  padding: 0;
  max-height: 55vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-page);
}

/* Modal body scrollbar */
.zh-modal .modal-body::-webkit-scrollbar {
  width: 4px;
}
.zh-modal .modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.zh-modal .modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}
.zh-modal .modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.zh-modal-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
}

.zh-modal-btn-close {
  padding: 8px 20px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}

.zh-modal-btn-close:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--text-primary);
}

.zh-modal-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── 3. Metric Card ─── */

.zh-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  margin: 0;
  flex-shrink: 0;
}

.zh-metric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: box-shadow 150ms, transform 150ms;
}

.zh-metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.zh-metric-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zh-metric-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.zh-metric-value {
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-primary);
}

.zh-metric-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.zh-metric-sub span {
  font-weight: 600;
  color: var(--sla-success);
}

.zh-metric-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 150ms, color 150ms;
}

.zh-metric-icon:hover {
  background: #e2e8f0;
  color: var(--brand-blue);
  text-decoration: none;
}

.zh-metric-icon .material-icons {
  font-size: 20px;
}

/* ─── 4. Summary Card ─── */

.zh-summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
  margin: 0;
  flex-shrink: 0;
}

.zh-summary-card {
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  overflow: hidden;
  position: relative;
  transition: box-shadow 200ms;
}

.zh-summary-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.zh-summary-body {
  position: relative;
  z-index: 2;
}

.zh-summary-header {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin-bottom: 4px;
}

.zh-summary-title {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.85;
  color: #ffffff;
}

.zh-summary-total {
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  color: #ffffff;
}

.zh-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.zh-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  backdrop-filter: blur(2px);
  transition: background 150ms;
}

.zh-chip:hover {
  background: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  text-decoration: none;
}

.zh-chip-count {
  font-weight: 700;
  font-size: 14px;
  min-width: 16px;
}

/* ─── 5. Table Card ─── */

.zh-tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  gap: var(--sp-3);
  margin: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.zh-tables-row--full {
  grid-template-columns: 1fr;
}

.zh-table-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  position: relative;
  transition: box-shadow 150ms;
}

.zh-table-card:hover {
  box-shadow: var(--shadow-md);
}

.zh-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-table-header);
  color: #ffffff;
}

.zh-table-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.zh-table-count {
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 10px;
  border-radius: 999px;
}

.zh-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  flex: 1 1 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.zh-cards-stack::-webkit-scrollbar {
  display: none;
}

/* ─── 6. Custom Scrollbar ─── */

.zh-custom-scrollbar {
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.zh-custom-scrollbar-thumb {
  position: absolute;
  right: 0;
  width: 4px;
  min-height: 20px;
  background: #cbd5e1;
  border-radius: 2px;
  pointer-events: auto;
  cursor: pointer;
  transition: background 150ms;
}

.zh-custom-scrollbar-thumb:hover,
.zh-custom-scrollbar-thumb.is-dragging {
  background: #94a3b8;
}

/* ─── 7. Badge & SLA Colors ─── */

.badge-success { background: var(--sla-success); }
.badge-warning { background: var(--sla-warning); }
.badge-danger  { background: var(--sla-danger); }

.sla-success { color: var(--sla-success); }
.sla-warning { color: var(--sla-warning); }
.sla-danger  { color: var(--sla-danger); }

/* ═══════════════════════════════════════════════════════════
   Responsive — TV (min-width: 1600px)
   ═══════════════════════════════════════════════════════════ */

@media (min-width: 1600px) {
  .zh-kanban-client { font-size: 15px; }
  .zh-kanban-badge { font-size: 16px; min-height: 64px; }
  .zh-kanban-metric-value { font-size: 16px; }
  .zh-kanban-equip { font-size: 13px; }
  .zh-kanban-metrics { min-width: 120px; }
  .zh-cards-stack { flex: 1 1 0; }

  .zh-metric-value { font-size: 34px; }
  .zh-summary-total { font-size: 36px; }
  .zh-table-title { font-size: 13px; }
  .zh-table-count { font-size: 15px; }
  .zh-chip { font-size: 13px; padding: 5px 12px; }
  .zh-chip-count { font-size: 15px; }
}

/* ═══════════════════════════════════════════════════════════
   Responsive — Compact (max-width: 1200px)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  .zh-kanban-card {
    grid-template-columns: 54px 1fr auto;
  }
  .zh-kanban-badge { font-size: 12px; }
  .zh-kanban-client { font-size: 13px; }
  .zh-kanban-metrics { min-width: 80px; padding: 6px 10px; }
  .zh-kanban-metric-value { font-size: 12px; }

  .zh-metrics-row { grid-template-columns: repeat(2, 1fr); }
  .zh-metric-value { font-size: 22px; }
  .zh-metric-card { padding: 4px var(--sp-2); }
  .zh-metric-label { font-size: 9px; }
  .zh-metric-sub { font-size: 9px; }

  .zh-summary-row { grid-template-columns: 1fr; }
  .zh-summary-total { font-size: 24px; }
  .zh-summary-title { font-size: 11px; }

  .zh-tables-row { grid-template-columns: 1fr; }
  .zh-table-header { padding: 4px var(--sp-2); }
  .zh-table-title { font-size: 10px; }
  .zh-table-count { font-size: 12px; padding: 1px 8px; }

  .zh-chip { font-size: 10px; padding: 2px 6px; }
  .zh-chip-count { font-size: 12px; }
}

/* ─── 7. Footer Ticker ─── */

.zh-footer {
  background: #1e293b;
  border-top: 1px solid #334155;
  padding: 0;
  z-index: 100;
}

.zh-footer-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  max-width: 100%;
  overflow: hidden;
}

.zh-footer-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
  flex-shrink: 0;
}

.zh-footer-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.zh-footer-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: #ffffff;
  text-decoration: none;
}

.zh-footer-badge--blue { background: var(--brand-blue); }
.zh-footer-badge--red { background: var(--sla-danger); }

.zh-footer-ticker {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
}

.zh-footer-ticker-track {
  display: flex;
  gap: var(--sp-4);
  animation: zh-ticker var(--ticker-duration, 60s) linear infinite;
  width: max-content;
}

.zh-footer-ticker-track:hover {
  animation-play-state: paused;
}

@keyframes zh-ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.zh-footer-os {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 150ms;
}

.zh-footer-os:hover {
  background: rgba(255, 255, 255, 0.12);
}

.zh-footer-os-id {
  font-size: 12px;
  font-weight: 700;
  color: #4ade80;
}

.zh-footer-os-date {
  font-size: 10px;
  color: #94a3b8;
}

/* ─── 8. Custom Scrollbar ─── */

.zh-custom-scrollbar {
  position: absolute;
  right: 4px;
  width: 6px;
  pointer-events: auto;
  z-index: 5;
}

.zh-custom-scrollbar-thumb {
  position: absolute;
  width: 100%;
  border-radius: 3px;
  background: rgba(100, 116, 139, 0.35);
  transition: background 150ms;
  cursor: pointer;
}

.zh-custom-scrollbar-thumb:hover,
.zh-custom-scrollbar-thumb.is-dragging {
  background: rgba(100, 116, 139, 0.6);
}

/* ─── Reduced Motion ─── */

@media (prefers-reduced-motion: reduce) {
  .zh-metric-card,
  .zh-summary-card,
  .zh-table-card,
  .zh-kanban-card {
    transition: none;
  }

  .zh-footer-ticker-track {
    animation: none;
  }
}

/* ─── SLA Countdown Transition ─── */
.zh-kanban-metric-value[data-sla-countdown] {
  transition: opacity 0.3s ease;
}
.zh-kanban-metric-value[data-sla-countdown].sla-switching {
  opacity: 0;
}
