/* assets/financial.css - Análise Financeira Premium Essenza (Fintech Level) */

.fin-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  box-sizing: border-box;
  animation: finFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ─── TOPO DO FINANCEIRO ─── */
.fin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: linear-gradient(135deg, #171f2e 0%, #121824 100%);
  border: 1.5px solid #28374d;
  border-radius: 18px;
  padding: 1.35rem 1.65rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.fin-title-box h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.02em;
}

.fin-title-box p {
  font-size: 0.86rem;
  color: #94a3b8;
  margin: 0.3rem 0 0 0;
}

.fin-actions-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-fin-quick {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.btn-fin-quick.receita {
  background: #064e3b;
  color: #6ee7b7;
  border-color: #059669;
}
.btn-fin-quick.receita:active {
  background: #059669;
  color: #ffffff;
  transform: scale(0.96);
}

.btn-fin-quick.despesa {
  background: #4c111a;
  color: #fca5a5;
  border-color: #dc2626;
}
.btn-fin-quick.despesa:active {
  background: #dc2626;
  color: #ffffff;
  transform: scale(0.96);
}

/* ─── BARRA DE FILTRO DE PERÍODO ─── */
.fin-period-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.fin-period-tabs {
  display: inline-flex;
  background: #141b27;
  border: 1.5px solid #233044;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.fin-period-tab {
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #8492a6;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fin-period-tab.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

/* ─── GRID DE CARDS KPI ─── */
.fin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 900px) {
  .fin-kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
  }
}

.fin-kpi-card {
  position: relative;
  background: linear-gradient(145deg, #192233 0%, #131a26 100%);
  border: 1.5px solid #27364b;
  border-radius: 16px;
  padding: 1.35rem 1.45rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: transform 0.15s ease;
}

.fin-kpi-card:hover {
  transform: translateY(-2px);
}

.fin-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.fin-kpi-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.fin-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.fin-kpi-val {
  font-size: 1.55rem;
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}

.fin-kpi-sub {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 0.45rem;
  font-weight: 600;
}

/* Variações de Cores dos KPIs */
.fin-kpi-card.receita {
  border-color: rgba(16, 185, 129, 0.35);
}
.fin-kpi-card.receita .fin-kpi-icon {
  background: #064e3b;
  color: #34d399;
}
.fin-kpi-card.receita .fin-kpi-val {
  color: #34d399;
}

.fin-kpi-card.pendente {
  border-color: rgba(245, 158, 11, 0.35);
}
.fin-kpi-card.pendente .fin-kpi-icon {
  background: #543108;
  color: #fbbf24;
}
.fin-kpi-card.pendente .fin-kpi-val {
  color: #fbbf24;
}

.fin-kpi-card.despesa {
  border-color: rgba(239, 68, 68, 0.35);
}
.fin-kpi-card.despesa .fin-kpi-icon {
  background: #5c141d;
  color: #f87171;
}
.fin-kpi-card.despesa .fin-kpi-val {
  color: #f87171;
}

.fin-kpi-card.saldo {
  border-color: rgba(56, 189, 248, 0.35);
}
.fin-kpi-card.saldo .fin-kpi-icon {
  background: #0c4a6e;
  color: #38bdf8;
}
.fin-kpi-card.saldo .fin-kpi-val {
  color: #38bdf8;
}

/* ─── LINHA DE ANÁLISE GRÁFICA & PRODUTOS ─── */
.fin-charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 820px) {
  .fin-charts-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.fin-panel-card {
  background: #151d2a;
  border: 1.5px solid #28374d;
  border-radius: 18px;
  padding: 1.4rem 1.6rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.fin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fin-panel-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.01em;
}

.fin-panel-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  background: #1e2838;
  color: #94a3b8;
}

/* GRÁFICO DONUT DE MIX DE VENDAS */
.fin-donut-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.fin-donut-box {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}

.fin-donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.fin-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}

.fin-donut-center-total {
  font-size: 1.15rem;
  font-weight: 900;
  color: #f8fafc;
  line-height: 1;
}

.fin-donut-center-lbl {
  font-size: 0.62rem;
  font-weight: 800;
  color: #8492a6;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 3px;
}

/* Legenda do Donut */
.fin-donut-legend {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fin-donut-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
}

.fin-donut-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 0.5rem;
}

/* EFICIÊNCIA E MÉTRICAS OPERACIONAIS */
.fin-efficiency-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.fin-eff-tile {
  background: #1a2333;
  border: 1.5px solid #2a384d;
  border-radius: 14px;
  padding: 1.15rem 1rem;
  text-align: center;
}

.fin-eff-num {
  font-size: 1.55rem;
  font-weight: 900;
  color: #38bdf8;
  line-height: 1.1;
}

.fin-eff-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 5px;
}

.fin-conversion-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.fin-mini-bar-bg {
  width: 100%;
  height: 8px;
  background: #232c3d;
  border-radius: 4px;
  overflow: hidden;
}

.fin-mini-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ─── HISTÓRICO DE LANÇAMENTOS E TRANSAÇÕES ─── */
.fin-table-panel {
  background: #151d2a;
  border: 1.5px solid #28374d;
  border-radius: 18px;
  padding: 1.4rem 1.6rem;
}

.fin-trans-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.fin-filter-tabs {
  display: inline-flex;
  gap: 6px;
  background: #141b27;
  border: 1px solid #233044;
  border-radius: 10px;
  padding: 3px;
}

.fin-filter-tab {
  padding: 0.4rem 0.85rem;
  border-radius: 7px;
  background: transparent;
  border: none;
  color: #8492a6;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}

.fin-filter-tab.active {
  background: #2563eb;
  color: #ffffff;
}

.fin-trans-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.fin-trans-card {
  background: #1a2232;
  border: 1.5px solid #27354a;
  border-radius: 12px;
  padding: 0.95rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: all 0.15s ease;
}

.fin-trans-card:hover {
  border-color: #3b82f6;
  background: #1d273a;
}

.fin-trans-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.fin-trans-badge-type {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fin-trans-badge-type.receita {
  background: #064e3b;
  color: #34d399;
}
.fin-trans-badge-type.despesa {
  background: #5c141d;
  color: #f87171;
}

.fin-trans-desc {
  font-size: 0.98rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.fin-trans-meta {
  font-size: 0.78rem;
  color: #8492a6;
  margin-top: 3px;
}

.fin-trans-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  text-align: right;
}

.fin-trans-amount {
  font-size: 1.1rem;
  font-weight: 800;
}
.fin-trans-amount.receita {
  color: #34d399;
}
.fin-trans-amount.despesa {
  color: #f87171;
}

.fin-trans-del {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.15s;
}
.fin-trans-del:hover {
  color: #f87171;
  background: rgba(239, 68, 68, 0.2);
}

/* ─── MODAL DE LANÇAMENTO TOUCH ─── */
.fin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
  box-sizing: border-box;
}

.fin-modal-content {
  background: #161b26;
  border: 2px solid #2a384d;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.65rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  box-sizing: border-box;
  animation: finPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes finPopIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.fin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid #28374d;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.fin-modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
}

.fin-modal-close {
  background: #232a38;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #8492a6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
}
.fin-modal-close:hover {
  color: #ffffff;
  background: #333f52;
}

.fin-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: #12151c;
  border: 1.5px solid #28374d;
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 1.25rem;
}

.fin-type-opt {
  padding: 0.85rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #8492a6;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.fin-type-opt.active.despesa {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.fin-type-opt.active.receita {
  background: #059669;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
}

.fin-form-group {
  margin-bottom: 1rem;
}

.fin-form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fin-form-input, .fin-form-select {
  width: 100%;
  background: #1a2333;
  border: 1.5px solid #2a384d;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  color: #f8fafc;
  font-size: 1rem;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.fin-form-input:focus, .fin-form-select:focus {
  border-color: #3b82f6;
  background: #202b3d;
}

.fin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.btn-fin-submit {
  width: 100%;
  padding: 1.15rem;
  background: #2563eb;
  border: 1px solid #3b82f6;
  border-radius: 12px;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 0.5rem;
  touch-action: manipulation;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transition: all 0.15s;
}

.btn-fin-submit:active {
  transform: scale(0.97);
  background: #1d4ed8;
}
