:root {
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-950: #020617;
  --blue-800: #1e40af;
  --blue-400: #60a5fa;
}

/* ===================== BASE ===================== */
body {
  margin: 0;
  font-family: sans-serif;
  overflow: hidden;
  background-color: var(--slate-900);
  color: white;
}

body.bg-dark {
  background-color: var(--slate-900) !important;
}

.hidden {
  display: none !important;
}

/* ===================== LAYOUT PRINCIPAL ===================== */
/* Container raiz do app: ocupa a tela inteira em coluna */
.app-main {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===================== HEADER ===================== */
.app-header {
  background-color: var(--slate-800);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  position: relative;
  flex-shrink: 0; /* impede que o header encolha com o flex da main */
}

/* Lado esquerdo: ícone + nome do agrupamento */
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0; /* permite que o título seja truncado com ellipsis */
  flex: 1;
  padding-right: 72px;
}

/* Título do agrupamento — trunca se for longo demais */
.header-title {
  color: white;
  font-size: 1.5rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 42vw;
}

.coletas-andamento {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  order: 3;
  width: 100%;
  min-width: 0;
  max-width: calc(100% - 140px);
  padding: 6px 10px;
  border: 1px solid #475569;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.42);
  color: #e2e8f0;
  font-size: 0.9rem;
  line-height: 1.2;
  box-sizing: border-box;
}

.coletas-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: #94a3b8;
  flex-shrink: 0;
}

.coletas-icon svg {
  width: 100%;
  height: 100%;
}

.coletas-viewport {
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.coletas-track {
  display: flex;
  width: max-content;
  max-width: 100%;
}

.coletas-text {
  display: inline-block;
  padding-right: 28px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Lado direito: botão fullscreen + total em atraso */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Bloco "Total em Atraso" */
.header-total {
  text-align: right;
}

.total-label {
  color: #cbd5e1;
  font-size: 0.75rem;
  margin: 0;
}

.total-value {
  font-weight: bold;
  line-height: 1;
  margin: 0;
}

/* Número grande de unidades atrasadas */
.total-number {
  font-size: 2.25rem;
}

/* "un." ao lado do número */
.total-unit {
  font-size: 1.125rem;
}

/* Bolinhas de paginação */
.pagination-dots-bar {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  justify-content: flex-end;
}

/* ===================== TICKER ===================== */
.ticker-container {
  overflow: hidden;
  white-space: nowrap;
  padding: 10px 0;
  background-color: var(--slate-950);
  border-top: 1px solid var(--slate-700);
  border-bottom: 1px solid var(--slate-700);
  flex-shrink: 0;
}

/* Grid Dinâmico — ocupa todo o espaço restante abaixo do header e ticker */
.grid-layout {
  --grid-gap: 8px;
  display: grid;
  gap: var(--grid-gap);
  flex: 1; /* equivalente ao Tailwind flex-1 */
  min-height: 0; /* necessário para o flex-1 funcionar corretamente em column */
  will-change: opacity, transform;
}

/* Cada linha dimensiona suas próprias colunas e sempre ocupa toda a largura. */
.kanban-row {
  display: grid;
  gap: var(--grid-gap);
  min-width: 0;
  min-height: 0;
}

/* Card Kanban — padding 0 no topo para o bloco de código colar na borda */
.kanban-card {
  background-color: var(--blue-800);
  border-radius: 16px;
  border: 0;
  padding: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  text-align: center;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  container-type: size;
  container-name: kanban-card;
}

.kanban-code {
  background: white;
  color: #111;
  width: 100%;
  font-weight: bold;
  font-size: 22px;
  line-height: 1.05;
  padding: 5px 4px;
  margin: 0;
  border: 0;
  border-radius: 8px 8px 0 0; /* topo arredondado, base reta — cola com o azul do card */
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-current {
  width: 100%;
  background: #facc15;
  color: #111;
  font-weight: 900;
  line-height: 1;
  font-size: 18px;
  padding: 4px;
  box-sizing: border-box;
  overflow: hidden;
}

.kanban-qty {
  color: #ef4444;
  font-size: 41px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  line-height: 0.95;
  overflow: hidden;
}

.kanban-line {
  color: white;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 17px;
  line-height: 1.05;
  padding: 3px 4px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  box-sizing: border-box;
}

/* A tipografia acompanha a célula real, evitando sobreposição em grades densas. */
@supports (font-size: 1cqh) {
  .kanban-code {
    font-size: clamp(16px, min(13cqw, 12.3cqh), 76px);
    padding-block: clamp(3px, 1.8cqh, 14px);
  }

  .kanban-current {
    font-size: clamp(15px, min(10.8cqw, 9.8cqh), 63px);
    padding-block: clamp(2px, 1.4cqh, 12px);
  }

  .kanban-qty {
    font-size: clamp(24px, min(24cqw, 30cqh), 154px);
  }

  .kanban-line {
    font-size: clamp(14px, min(9.7cqw, 9.8cqh), 59px);
    padding-bottom: clamp(4px, 2cqh, 14px);
  }
}

/* Ticker Animation */
.ticker-container {
  overflow: hidden;
  white-space: nowrap;
  padding: 10px 0;
}
.ticker-wrapper {
  display: block;
  overflow: hidden;
  width: 100%;
}
.ticker-content {
  display: inline-flex;
  white-space: nowrap;
  animation: scroll 25s linear infinite;
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  margin: 0 40px;
  font-size: 1.5rem;
}
.ticker-line {
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ticker-sep {
  color: #64748b;
  margin: 0 12px;
}
.ticker-count {
  color: white;
  letter-spacing: 0.03em;
}

@keyframes scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-33.333%);
  }
}

.overlay {
  position: fixed;
  inset: 0;
  background: var(--slate-900);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

/* Fullscreen button */
#fullscreen-btn {
  padding: 8px;
  cursor: pointer;
  background: #334155;
  color: white;
  border: 1px solid #475569;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
#fullscreen-btn:hover {
  background: #475569;
}

/* Timer circular centralizado no header */
.timer-svg {
  width: 44px;
  height: 44px;
  display: block;
}
#timer-arc {
  transition: stroke-dashoffset 0.9s linear;
}

#countdown-timer {
  top: 50px;
  transform: translate(-50%, -50%) !important;
}

/* Header icon — responsive */
.header-icon {
  height: 48px;
  width: auto;
  object-fit: contain;
}
@media (min-width: 768px) {
  .app-header {
    padding: 8px 32px;
  }
  .header-left {
    gap: 16px;
  }
  .header-right {
    gap: 24px;
  }
  .header-title {
    font-size: 2.25rem;
  }
  .total-label {
    font-size: 1rem;
  }
  .total-number {
    font-size: 3.75rem;
  }
  .total-unit {
    font-size: 1.5rem;
  }
  .header-icon {
    height: 80px;
  }
  #fullscreen-btn {
    padding: 10px;
  }
  .ticker-item {
    font-size: 1.5rem;
  }
  .kanban-card {
    border-radius: 16px;
  }
  .timer-svg {
    width: 56px;
    height: 56px;
  }
  #countdown-timer {
    top: 56px;
  }
  .coletas-andamento {
    justify-content: center;
    max-width: 100%;
    padding: 0 120px;
    border: 0;
    background: transparent;
    font-size: 1.05rem;
  }
  .coletas-text {
    text-align: center;
    padding-right: 0;
  }
  .coletas-viewport {
    display: flex;
    justify-content: center;
  }
  .coletas-track {
    justify-content: center;
  }
  .coletas-text:nth-child(n + 2) {
    display: none;
  }
}

/* Mobile overrides */
@media (max-width: 767px) {
  .app-header {
    padding: 8px 10px;
  }
  #countdown-timer {
    top: 45px;
  }
  .header-left {
    gap: 8px;
    padding-right: 52px;
    flex-wrap: wrap;
  }
  .header-title {
    font-size: 1.35rem;
    max-width: calc(100vw - 180px);
  }
  .coletas-andamento {
    order: 3;
    width: 100%;
    max-width: calc(100vw - 20px);
    font-size: 0.75rem;
    padding: 4px 8px;
  }
  .coletas-icon {
    width: 14px;
    height: 14px;
  }
  .coletas-viewport {
    display: block;
    flex: 1;
  }
  .coletas-track {
    max-width: none;
    animation: scroll 14s linear infinite;
  }
  .coletas-text {
    overflow: visible;
    text-overflow: clip;
    padding-right: 24px;
  }
  .grid-layout {
    --grid-gap: 6px;
    margin: 4px !important;
  }
  .ticker-item {
    font-size: 1rem;
    margin: 0 20px;
  }
  .ticker-container {
    padding: 6px 0;
  }
  .kanban-card {
    border-radius: 10px;
  }
  .kanban-code {
    border-radius: 8px 8px 0 0;
    padding: 4px 0;
  }
  .kanban-current {
    padding: 5px 0;
  }
  .kanban-line {
    padding-bottom: 6px;
  }
}

/* Pagination dots */
.pagination-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #475569;
}
.pagination-dot.active {
  background: #60a5fa;
}
