/* ===== ESTILOS ESPECÍFICOS PARA MÓDULO FINANCEIRO ===== */

/*
 * Este arquivo contém estilos complementares específicos para as páginas financeiras.
 * O layout principal é herdado do style.css e Bootstrap.
 */

/* ===== ESTILOS DA TABELA (similar a pessoas.html) ===== */

/* Tabela de Contas a Pagar */
#contasTable {
  font-size: 0.85rem;
  min-width: 1400px; /* Largura mínima para acomodar todas as colunas */
  table-layout: fixed; /* Força o uso dos widths definidos */
  width: 100%;
}

.table-responsive {
  overflow-x: auto;
  overflow-y: auto;
}

#contasTable thead th {
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #dee2e6;
  position: sticky;
  top: 0;
  background: #f8f9fa;
  z-index: 10;
  padding: 12px 16px;
}

#contasTable tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

#contasTable tbody tr:hover {
  background-color: #f8f9fa;
}

#contasTable tbody td {
  vertical-align: middle;
  padding: 10px 12px;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Coluna de Ações */
#contasTable th:last-child,
#contasTable td:last-child {
  text-align: center;
  min-width: 130px;
  width: 130px;
  padding: 8px 4px !important;
}

/* Scrollbar customizada para a tabela */
.table-responsive::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #c6254e;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #a01e3f;
}

/* Barra de progresso */
#progressBar {
  transition: width 0.3s ease;
  background-color: #c6254e;
}

/* Responsividade */
@media (max-width: 768px) {
  #contasTable {
    font-size: 0.8rem;
  }

  #contasTable tbody td {
    padding: 8px 12px;
  }
}

/* Hover effect para cards clicáveis */
.hover-card {
  transition: all 0.3s ease;
  cursor: pointer;
}

.hover-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Status badges */
.badge-pendente {
  background-color: #ffc107;
  color: #000;
}

.badge-paga {
  background-color: #198754;
  color: #fff;
}

.badge-atrasada {
  background-color: #dc3545;
  color: #fff;
}

.badge-cancelada {
  background-color: #6c757d;
  color: #fff;
}

.badge-autorizada {
  background-color: #0dcaf0;
  color: #000;
}

.badge-processando {
  background-color: #fd7e14;
  color: #fff;
}

/* ===== MODAL DE VISUALIZAÇÃO DE CONTA ===== */

/* Modal de visualizar conta a pagar */
#viewContaModal .modal-dialog {
  max-width: 900px;
}

#viewContaModal .modal-header {
  border-bottom: 1px solid #dee2e6;
}

#viewContaModal .modal-body {
  padding: 0;
}

/* Sidebar do modal */
#viewContaModal .bg-light {
  background-color: #f8f9fa !important;
}

/* Labels dos campos */
#viewContaModal small.text-uppercase {
  font-weight: 600;
}

/* Tabela de parcelas */
#viewContaModal .table-sm {
  font-size: 0.875rem;
}

#viewContaModal .table-hover tbody tr:hover {
  background-color: #f8f9fa;
}

/* DataTable de parcelas relacionadas */
#parcelasRelacionadasTable {
  width: 100% !important;
}

#parcelasRelacionadasTable_wrapper {
  padding: 0;
}

#parcelasRelacionadasTable_wrapper .dataTables_length,
#parcelasRelacionadasTable_wrapper .dataTables_filter {
  padding: 0.5rem 0;
}

#parcelasRelacionadasTable_wrapper .dataTables_info,
#parcelasRelacionadasTable_wrapper .dataTables_paginate {
  padding: 0.5rem 0;
}

#parcelasRelacionadasTable thead th {
  background-color: #f8f9fa !important;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.75rem 0.5rem;
}

#parcelasRelacionadasTable tbody td {
  padding: 0.5rem;
  vertical-align: middle;
}

/* Melhorar espaçamento do DataTable dentro do modal */
#parcelasRelacionadasTable_wrapper .dataTables_length label,
#parcelasRelacionadasTable_wrapper .dataTables_filter label {
  font-size: 0.875rem;
  margin-bottom: 0;
}

#parcelasRelacionadasTable_wrapper .dataTables_length select {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

#parcelasRelacionadasTable_wrapper .dataTables_filter input {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

#parcelasRelacionadasTable_wrapper .dataTables_info {
  font-size: 0.875rem;
}

#parcelasRelacionadasTable_wrapper .dataTables_paginate {
  font-size: 0.875rem;
}

/* Histórico de pagamentos */
#viewContaModal .border-bottom:last-child {
  border-bottom: none !important;
}

/* Scrollbar customizada */
#viewContaModal .card-body {
  scrollbar-width: thin;
  scrollbar-color: #c6254e #f1f1f1;
}

#viewContaModal .card-body::-webkit-scrollbar {
  width: 6px;
}

#viewContaModal .card-body::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

#viewContaModal .card-body::-webkit-scrollbar-thumb {
  background: #c6254e;
  border-radius: 3px;
}

#viewContaModal .card-body::-webkit-scrollbar-thumb:hover {
  background: #a01e3f;
}

/* Responsividade do modal */
@media (max-width: 992px) {
  #viewContaModal .modal-dialog {
    max-width: 95%;
    margin: 1rem;
  }

  #viewContaModal .col-lg-8,
  #viewContaModal .col-lg-4 {
    border: none !important;
  }

  #viewContaModal .border-end {
    border-right: none !important;
  }
}

/* Tabelas responsivas */
@media (max-width: 768px) {
  .table-responsive table {
    font-size: 0.875rem;
  }

  .table-responsive th,
  .table-responsive td {
    padding: 0.5rem !important;
  }
}

/* Animações para valores monetários */
.valor-positivo {
  color: #198754;
  font-weight: 600;
}

.valor-negativo {
  color: #dc3545;
  font-weight: 600;
}

/* Cards de resumo */
.summary-card {
  border-left: 4px solid;
  transition: all 0.3s ease;
}

.summary-card.success {
  border-left-color: #198754;
}

.summary-card.warning {
  border-left-color: #ffc107;
}

.summary-card.danger {
  border-left-color: #dc3545;
}

.summary-card.primary {
  border-left-color: #c6254e;
}

.summary-card:hover {
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* Filtros */
#filtersPanel {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Botões de ação */
.btn-action {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

/* Estilos para botões de ação na tabela */
#contasTable .btn-outline-primary,
#contasTable .btn-outline-success,
#contasTable .btn-outline-warning,
#contasTable .btn-outline-secondary,
#contasTable .btn-outline-danger {
  transition: all 0.2s ease;
  border-width: 1.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

#contasTable .btn-outline-primary:not(:disabled):hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

#contasTable .btn-outline-success:not(:disabled):hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(25, 135, 84, 0.3);
}

#contasTable .btn-outline-warning:not(:disabled):hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

#contasTable .btn-outline-secondary:not(:disabled):hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

#contasTable .btn-outline-danger:not(:disabled):hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Botões desabilitados */
#contasTable button:disabled {
  cursor: not-allowed;
  border-color: #dee2e6 !important;
  color: #adb5bd !important;
}

/* Timeline para fluxo de caixa - Design Moderno */
.timeline {
  position: relative;
  padding-left: 60px;
  padding-top: 10px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
}

/* Linha vertical da timeline - elemento real para funcionar com scroll */
.timeline-line {
  position: absolute;
  left: 29px;
  top: 0;
  width: 3px;
  background: #dee2e6;
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
}

/* Scrollbar customizada para timeline */
.timeline::-webkit-scrollbar {
  width: 8px;
}

.timeline::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.timeline::-webkit-scrollbar-thumb {
  background: #c6254e;
  border-radius: 4px;
}

.timeline::-webkit-scrollbar-thumb:hover {
  background: #a01e3f;
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Marcador circular da timeline */
.timeline-marker {
  position: absolute;
  left: -47px;
  top: 40px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  z-index: 2;
}

.timeline-marker.bg-success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.timeline-marker.bg-danger {
  background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
}

.timeline-marker i {
  color: white;
  font-size: 16px;
}

.timeline-item:hover .timeline-marker {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px rgba(0, 0, 0, 0.15);
}

/* Card do conteúdo da timeline */
.timeline-content {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  position: relative;
}

.timeline-content::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 10px 8px 0;
  border-color: transparent #e9ecef transparent transparent;
}

.timeline-content::after {
  content: "";
  position: absolute;
  left: -9px;
  top: 50px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 9px 7px 0;
  border-color: transparent #fff transparent transparent;
}

.timeline-item:hover .timeline-content {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateX(4px);
  border-color: #dee2e6;
}

/* Elementos dentro do card da timeline */
.timeline-content h6 {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
  font-size: 1rem;
}

.timeline-content h5 {
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 0;
}

.timeline-content .text-muted {
  font-size: 0.85rem;
  color: #6c757d !important;
}

.timeline-content .badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  font-weight: 500;
  border-radius: 6px;
}

.timeline-content .btn-sm {
  padding: 6px 12px;
  transition: all 0.2s ease;
}

.timeline-content .btn-outline-primary:hover {
  background-color: #0d6efd;
  border-color: #0d6efd;
  transform: translateY(-1px);
}

.timeline-content .btn-outline-warning:hover {
  background-color: #ffc107;
  border-color: #ffc107;
  transform: translateY(-1px);
}

.timeline-content .btn-outline-danger:hover {
  background-color: #dc3545;
  border-color: #dc3545;
  transform: translateY(-1px);
}

/* Ícones dentro do conteúdo */
.timeline-content i.fa-calendar,
.timeline-content i.fa-tag,
.timeline-content i.fa-credit-card,
.timeline-content i.fa-comment {
  color: #6c757d;
  opacity: 0.7;
}

/* Mensagem de timeline vazia */
.timeline .alert {
  margin-left: 0;
  border-radius: 12px;
  border-left: 4px solid #0d6efd;
}

/* Responsividade da timeline */
@media (max-width: 768px) {
  .timeline {
    padding-left: 40px;
  }

  .timeline::before {
    left: 15px;
  }

  .timeline-marker {
    left: -35px;
    width: 32px;
    height: 32px;
  }

  .timeline-marker i {
    font-size: 14px;
  }

  .timeline-content {
    padding: 16px;
  }

  .timeline-content h6 {
    font-size: 0.9rem;
  }

  .timeline-content h5 {
    font-size: 1.25rem;
  }
}

/* Tabela de Lançamentos (Fluxo de Caixa) */
#lancamentosTable {
  font-size: 0.85rem;
  min-width: 1000px;
  table-layout: fixed;
  width: 100%;
}

#lancamentosTable thead th {
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #dee2e6;
  position: sticky;
  top: 0;
  background: #f8f9fa;
  z-index: 10;
  padding: 12px 16px;
}

#lancamentosTable tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

#lancamentosTable tbody tr:hover {
  background-color: #f8f9fa;
}

#lancamentosTable tbody td {
  vertical-align: middle;
  padding: 10px 12px;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Coluna de Ações da tabela de lançamentos */
#lancamentosTable th:last-child,
#lancamentosTable td:last-child {
  text-align: center;
  min-width: 130px;
  width: 130px;
  padding: 8px 4px !important;
}

/* Botões circulares da tabela */
#lancamentosTable .btn-outline-primary:not(:disabled):hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

#lancamentosTable .btn-outline-warning:not(:disabled):hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

#lancamentosTable .btn-outline-danger:not(:disabled):hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

#lancamentosTable button:disabled {
  cursor: not-allowed;
  border-color: #dee2e6 !important;
  color: #adb5bd !important;
}

/* Gráficos */
canvas {
  max-height: 400px;
}

/* Responsividade para gráficos */
@media (max-width: 992px) {
  canvas {
    max-height: 300px;
  }
}

/* Modais - Correção de Z-Index */
.modal {
  z-index: 1055 !important;
}

.modal-backdrop {
  z-index: 1050 !important;
}

.modal-dialog {
  z-index: 1056 !important;
}

.modal-body {
  max-height: 70vh;
  overflow-y: auto;
}

/* Breadcrumb customizado */
.breadcrumb {
  background-color: transparent;
  padding: 0;
  margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: #6c757d;
}

.breadcrumb-item a {
  color: #c6254e;
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

/* Alertas de vencimento */
.alert-vencimento {
  border-left: 4px solid #ffc107;
  background-color: #fff3cd;
}

.alert-atrasado {
  border-left: 4px solid #dc3545;
  background-color: #f8d7da;
}

/* Loading state */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #c6254e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
