/*
 * dashboard.css — Estilos Específicos do Dashboard
 *
 * Complementa os componentes genéricos com layouts
 * exclusivos da tela de monitoramento (dashboard principal):
 * - Grid do dashboard (gráfico + controles)
 * - Cards de temperatura e luminosidade
 * - Indicadores de estado dos atuadores
 */

/* ============================================================
   GRID DO DASHBOARD — divide em gráfico (2/3) e controles (1/3)
   ============================================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Em telas menores, empilha as colunas */
@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   CARDS DE ATUADORES — estado visual de temperatura e luz
   ============================================================ */

/* Card do estado da iluminação */
.lighting-card .kpi-value {
  font-size: 1.4rem;
}

/* Indicador de estado de iluminação */
.light-state {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.2rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

/* Acesa — fundo verde claro */
.light-state.on {
  background: #e1f0c4;
  color: #3f5e00;
}

/* Apagada — fundo cinza */
.light-state.off {
  background: #f0f0f0;
  color: #6c757d;
}

/* Queimada — fundo vermelho claro */
.light-state.burned {
  background: #fde8ea;
  color: #c0392b;
}

/* ============================================================
   SEÇÃO DE ALERTAS ATIVOS — acima dos KPIs quando há alertas
   ============================================================ */

.alerts-banner {
  margin-bottom: 1.5rem;
}

/* Item de alerta individual */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.alert-item i {
  font-size: 1.25rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

/* Alerta informativo — azul suave */
.alert-item.info {
  background: #e8f4fd;
  color: #0c5460;
  border-left: 4px solid #17a2b8;
}

/* Alerta de aviso — amarelo */
.alert-item.warning {
  background: #fef0c7;
  color: #856404;
  border-left: 4px solid var(--warning-yellow);
}

/* Alerta crítico — vermelho */
.alert-item.critical {
  background: #fde8ea;
  color: #842029;
  border-left: 4px solid var(--primary-pink);
}

.alert-item .alert-time {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

/* ============================================================
   CONTROLES RÁPIDOS — panel com ações manuais
   ============================================================ */

/* Destaque escuro para o item de ajuste de pH */
.control-item-highlight {
  background: var(--bg-ink-black) !important;
  color: var(--text-white);
}

.control-item-highlight h4 {
  color: var(--text-white) !important;
}

.control-item-highlight p {
  color: #aaa !important;
}

/* ============================================================
   INSUMOS — lista de estoque
   ============================================================ */

/* Ações à direita de cada item de insumo */
.item-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Botão compacto usado dentro de list-items */
.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

/* ============================================================
   SAFRAS — progresso do ciclo
   ============================================================ */

/* Container da informação da safra (ocupa espaço flexível) */
.harvest-info {
  flex: 1;
}

/* Barra de fundo (trilha) do progresso */
.progress-track {
  margin-top: 0.5rem;
  background: #e8ece7;
  border-radius: 6px;
  height: 6px;
  overflow: hidden;
}

/* Barra de preenchimento — largura definida via JS com CSS variable */
.progress-bar {
  height: 100%;
  background: var(--secondary-green);
  border-radius: 6px;
  transition: width 0.4s ease;
}

/* Texto do progresso (Dia X de Y) */
.progress-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Ações à direita de cada safra */
.harvest-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  margin-left: 1rem;
  min-width: 100px;
}

/* Status text compacto dentro de list-item */
.harvest-status {
  font-size: 0.85rem;
}

/* ============================================================
   FORMULÁRIOS DENTRO DE MODAIS
   ============================================================ */

/* Container geral do formulário */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Linha com duas colunas */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Grupo de campo: label + input */
.form-field {
  display: flex;
  flex-direction: column;
}

/* Label do campo */
.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-metal);
  margin-bottom: 0.35rem;
}

/* Input e select padrão dos formulários */
.form-input,
.form-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: var(--font-main);
  background: #fff;
  color: var(--text-black);
}

.form-input:focus,
.form-select:focus {
  outline: 2px solid var(--secondary-green);
  border-color: var(--secondary-green);
}

/* ============================================================
   LOG DE ENTRADAS — na aba de Logs
   ============================================================ */

/* Coloração do timestamp */
.log-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Badge de tipo do log */
.log-type-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.log-type-badge.info     { background: #e8f4fd; color: #0c5460; }
.log-type-badge.warning  { background: #fef0c7; color: #856404; }
.log-type-badge.critical { background: #fde8ea; color: #842029; }
.log-type-badge.success  { background: #e1f0c4; color: #3f5e00; }

@media (max-width: 768px) {
  .dashboard-grid {
    gap: 1rem;
  }

  .alerts-banner {
    margin-bottom: 1rem;
  }

  .alert-item {
    flex-direction: column;
    padding: 1rem;
  }

  .light-state {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
  }

  .item-actions,
  .harvest-actions {
    width: 100%;
    margin-left: 0;
    min-width: 0;
  }

  .item-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .harvest-actions {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .progress-track {
    width: 100%;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }

  .log-timestamp {
    white-space: normal;
    align-self: flex-start;
  }
}

@media (max-width: 480px) {
  .item-actions .badge-status,
  .harvest-actions .harvest-status {
    width: 100%;
  }

  .btn-sm {
    flex: 1 1 calc(50% - 0.375rem);
  }

  .log-type-badge {
    display: inline-flex;
    margin-bottom: 0.35rem;
  }
}
