/* Gráficos Styles */

canvas {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
}

canvas#graficoDinamico {
  background: #232b38 !important;
  border-radius: 8px;
  padding: 16px;
  border: 3px;
  width: auto !important;
  height: auto !important;
  max-width: 90%;
  max-height: 80%;
  margin: 0 auto;
  display: block;
}

@media (max-width: 800px) {
  canvas#graficoDinamico {
    max-width: 100%;
    padding: 8px;
  }
}

/* Estilos para seletor de gráficos */
.grafico-container {
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.grafico-container label {
  color: #a0aec0;
  font-size: 1rem;
  font-weight: 500;
  min-width: fit-content;
}

#tipo-grafico {
  background: #232b38;
  color: #fff;
  border: 2px solid #4a5568;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 200px;
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

#tipo-grafico:hover {
  border-color: #17acaf;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

#tipo-grafico:focus {
  outline: none;
  border-color: #17acaf;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

#tipo-grafico option {
  background: #232b38;
  color: #fff;
  padding: 10px;
}

@media (max-width: 800px) {
  .grafico-container {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .grafico-container label {
    margin-bottom: 4px;
  }
  
  #tipo-grafico {
    width: 100%;
    min-width: auto;
  }
}

/* Estilos para DRE */
.dre-report {
  background: #232b38;
  border-radius: 12px;
  padding: 24px;
  margin: 20px auto;
  max-width: 600px;
  border: 2px solid #17acaf;
  box-shadow: 0 4px 16px rgba(49, 130, 206, 0.1);
}

.dre-title {
  color: #17acaf;
  font-size: 1.4rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
}

.dre-period {
  color: #a0aec0;
  text-align: center;
  margin-bottom: 24px;
  font-size: 1rem;
}

.dre-section {
  margin-bottom: 20px;
}

.dre-section-title {
  color: #38a169;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 12px;
  padding-bottom: 4px;
  border-bottom: 2px solid #38a169;
}

.dre-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: #2d3748;
  border-radius: 6px;
  color: #e2e8f0;
}

.dre-total {
  background: #17acaf;
  color: #fff;
  font-weight: bold;
  margin-top: 8px;
  border: 2px solid #17acaf;
}

.dre-result {
  background: #38a169;
  color: #fff;
  font-weight: bold;
  font-size: 1.1rem;
  padding: 12px;
  border: 2px solid #38a169;
  margin-top: 16px;
}

.dre-result.negative {
  background: #e53e3e;
  border-color: #e53e3e;
}

@media (max-width: 600px) {
  .dre-report {
    margin: 20px 12px;
    padding: 16px;
  }
  
  .dre-title {
    font-size: 1.2rem;
  }
  
  .dre-line {
    padding: 6px 8px;
    font-size: 0.9rem;
  }
}

/* Estilos para DRE Detalhado */
.dre-detalhado {
  background: #232b38;
  border-radius: 12px;
  padding: 24px;
  margin: 20px auto;
  max-width: 100%;
  border: 2px solid #17acaf;
  box-shadow: 0 4px 16px rgba(49, 130, 206, 0.1);
  overflow-x: auto;
}

.dre-table-container {
  overflow-x: auto;
  border-radius: 8px;
}

.dre-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
  background: #2d3748;
}

.dre-table th,
.dre-table td {
  padding: 8px 6px;
  text-align: center;
  border: 1px solid #4a5568;
  font-size: 0.85rem;
}

.dre-header th {
  background: #3182ce;
  color: #fff;
  font-weight: bold;
  font-size: 0.8rem;
}

.dre-section-header td {
  font-weight: bold;
  text-align: center;
  padding: 10px;
}

.dre-section-header.receitas td {
  background: #38a169;
  color: #fff;
}

.dre-section-header.despesas td {
  background: #e53e3e;
  color: #fff;
}

.dre-row {
  background: #2d3748;
}

.dre-row:nth-child(even) {
  background: #232b38;
}

.dre-categoria {
  text-align: left !important;
  font-weight: 500;
  color: #e2e8f0;
  padding-left: 12px;
}

.dre-categoria-header td {
  background: #4a5568 !important;
  color: #fff;
  font-weight: bold;
  text-align: left;
  padding-left: 16px;
  font-size: 0.9rem;
}

.dre-categoria-nome {
  color: #3182ce;
  font-weight: bold;
}

.dre-subcategoria {
  text-align: left !important;
  font-weight: 400;
  color: #a0aec0;
  padding-left: 32px;
  font-style: italic;
}

.dre-receita {
  color: #38a169;
}

.dre-despesa {
  color: #e53e3e;
}

.dre-subtotal {
  background: #4a5568 !important;
  font-weight: bold;
}

.dre-subtotal td {
  color: #fff;
  font-weight: bold;
}

.dre-result-row {
  background: #38a169 !important;
}

.dre-result-row td {
  color: #fff;
  font-weight: bold;
}

.dre-resultado.positive {
  color: #38a169;
  font-weight: bold;
}

.dre-resultado.negative {
  color: #e53e3e;
  font-weight: bold;
}

.dre-total {
  font-weight: bold;
  background: #4a5568;
}

@media (max-width: 800px) {
  .dre-detalhado {
    margin: 20px 12px;
    padding: 16px;
  }
  
  .dre-table {
    font-size: 0.75rem;
  }
  
  .dre-table th,
  .dre-table td {
    padding: 6px 4px;
    font-size: 0.75rem;
  }
}

/* Estilos para KPI Dashboard */
.kpi-dashboard {
  background: #232b38;
  border-radius: 12px;
  padding: 24px;
  margin: 20px auto;
  max-width: 100%;
  border: 2px solid #17acaf;
  box-shadow: 0 4px 16px rgba(49, 130, 206, 0.1);
}

.kpi-title {
  color: #17acaf;
  font-size: 1.4rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 24px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.kpi-card {
  background: #2d3748;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 2px solid #4a5568;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(49, 130, 206, 0.15);
}

.kpi-card.receitas {
  border-color: #38a169;
}

.kpi-card.receitas:hover {
  border-color: #2f855a;
  box-shadow: 0 4px 16px rgba(56, 161, 105, 0.2);
}

.kpi-card.despesas {
  border-color: #e53e3e;
}

.kpi-card.despesas:hover {
  border-color: #c53030;
  box-shadow: 0 4px 16px rgba(229, 62, 62, 0.2);
}

.kpi-card.saldo {
  border-color: #3182ce;
}

.kpi-card.saldo:hover {
  border-color: #2c5282;
  box-shadow: 0 4px 16px rgba(49, 130, 206, 0.2);
}

.kpi-card.margem {
  border-color: #805ad5;
}

.kpi-card.margem:hover {
  border-color: #6b46c1;
  box-shadow: 0 4px 16px rgba(128, 90, 213, 0.2);
}

.kpi-card.vendas {
  border-color: #17acaf;
}

.kpi-card.vendas:hover {
  border-color: #2c5aa0;
  box-shadow: 0 4px 16px rgba(23, 172, 175, 0.2);
}

.kpi-card.ticket {
  border-color: #d69e2e;
}

.kpi-card.ticket:hover {
  border-color: #b7791f;
  box-shadow: 0 4px 16px rgba(214, 158, 46, 0.2);
}

.kpi-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.kpi-content {
  flex: 1;
}

.kpi-content h4 {
  color: #a0aec0;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  color: #e2e8f0;
  font-size: 1.8rem;
  font-weight: bold;
  margin: 0 0 4px 0;
  line-height: 1.2;
}

.kpi-value.positive {
  color: #38a169;
}

.kpi-value.negative {
  color: #e53e3e;
}

.kpi-change {
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-change.positive {
  color: #38a169;
}

.kpi-change.negative {
  color: #e53e3e;
}

.kpi-subtitle {
  color: #718096;
  font-size: 0.8rem;
  font-weight: 400;
}

@media (max-width: 800px) {
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .kpi-card {
    padding: 16px;
    gap: 12px;
  }
  
  .kpi-icon {
    font-size: 2rem;
  }
  
  .kpi-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .kpi-dashboard {
    margin: 20px 12px;
    padding: 16px;
  }
  
  .kpi-title {
    font-size: 1.2rem;
  }
  
  .kpi-card {
    flex-direction: column;
    text-align: center;
    padding: 16px 12px;
  }
  
  .kpi-icon {
    font-size: 2.2rem;
  }
  
  .kpi-content h4 {
    font-size: 0.85rem;
  }
  
  .kpi-value {
    font-size: 1.4rem;
  }
}