/* Estilos específicos de páginas */
/* Placeholder — será expandido nas sprints seguintes */

/* Charts wrapper */
.chart-container {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

.chart-container canvas {
  max-height: 400px;
}

/* Grid 2 colunas para charts */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* Seção com título */
.section-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

/* Comparison table (simulador) */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .comparison-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== TABELA DE EDIÇÃO (PLANILHA) ===== */
.edit-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 200px);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.edit-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--font-mono), monospace;
}

.edit-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.edit-table th {
  padding: 8px 10px;
  text-align: center;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-table-header);
  color: var(--text-secondary);
}

.edit-table td {
  padding: 6px 10px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  vertical-align: middle;
  height: 36px;
}

.edit-table tbody tr:nth-child(even) {
  background: var(--bg-table-row-alt);
}

.edit-table tbody tr:hover {
  background: var(--color-primary-light);
}

/* Tipos de célula */
.td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.td-id {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 11px;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.td-bold { font-weight: 700; }

/* Célula EDITÁVEL */
.td-edit {
  cursor: pointer;
  background: rgba(59, 111, 237, 0.03);
  border-left: 2px solid rgba(59, 111, 237, 0.15);
  transition: background 0.1s;
}

.td-edit:hover {
  background: rgba(59, 111, 237, 0.08);
}

/* Célula CALCULADA */
.td-calc {
  color: var(--text-muted);
  font-style: italic;
  background: rgba(0, 0, 0, 0.015);
}

/* Célula ALTERADA */
.td-changed {
  background: rgba(59, 111, 237, 0.12) !important;
  border-left: 2px solid var(--color-primary) !important;
  font-weight: 700;
}

/* Modo edição */
.td-edit.editing {
  padding: 2px;
  background: #fff;
}

.td-edit.editing input {
  width: 100%;
  padding: 4px 6px;
  border: 2px solid var(--color-primary);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
  outline: none;
  background: #fff;
}

/* Linhas por margem */
.row-danger { background: rgba(227, 50, 45, 0.06) !important; }
.row-danger:hover { background: rgba(227, 50, 45, 0.1) !important; }
.row-warning { background: rgba(237, 171, 0, 0.06) !important; }
.row-warning:hover { background: rgba(237, 171, 0, 0.1) !important; }

/* Coluna fixa — MUST be opaque to hide scrolled content */
.th-freeze,
.td-freeze {
  position: sticky;
  left: 0;
  z-index: 5;
  box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}

.th-freeze { background: #eef0f4 !important; }
.td-freeze { background: #ffffff !important; }

/* Even rows */
.edit-table tbody tr:nth-child(even) .td-freeze { background: #f8f9fb !important; }

/* Hover */
.edit-table tbody tr:hover .td-freeze { background: #edf2fe !important; }

/* Margem negativa */
.row-danger .td-freeze { background: #fdf0f0 !important; }
.row-danger:hover .td-freeze { background: #fbe4e4 !important; }

/* Margem apertada */
.row-warning .td-freeze { background: #fdf8ec !important; }
.row-warning:hover .td-freeze { background: #faf1d8 !important; }

/* Legenda */
.edit-legend {
  display: flex;
  gap: var(--space-5);
  padding: var(--space-3) 0;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 4px;
}

.legend-dot-edit {
  background: rgba(59, 111, 237, 0.08);
  border-left: 2px solid rgba(59, 111, 237, 0.4);
}

.legend-dot-calc {
  background: rgba(0, 0, 0, 0.04);
  border: 1px dashed var(--text-muted);
}

.legend-dot-changed {
  background: rgba(59, 111, 237, 0.15);
  border-left: 2px solid var(--color-primary);
}
