/**
 * Estilos globais do FinControl
 * Utiliza Bootstrap como base, com customizações
 */

:root {
  --primary-color: #0d6efd;
  --success-color: #198754;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --light-bg: #f8f9fa;
  --border-color: #dee2e6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--light-bg);
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===========================
   NAVBAR & LAYOUT
   ========================= */

.navbar-custom {
  background-color: white;
  border-bottom: 2px solid var(--border-color);
  flex-shrink: 0;
}

.navbar-custom .container-fluid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.sidebar {
  background-color: white;
  border-right: 2px solid var(--border-color);
  min-height: auto;
  min-width: 200px;
  padding: 20px 0;
  flex-shrink: 0;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

.footer {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-top: 1px solid var(--border-color);
  padding: 20px 20px;
  text-align: center;
  color: #666;
  flex-shrink: 0;
  margin-top: auto;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.04);
}

.footer-content {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer-main p {
  margin: 0;
  font-size: 12px;
  color: #555;
  font-weight: 500;
}

.footer-icon {
  color: var(--primary-color);
  font-weight: 700;
  margin-right: 2px;
}

.footer-divider {
  width: 1px;
  height: 12px;
  background: #dee2e6;
  margin: 0 0.25rem;
}

.footer-credits {
  margin-top: 0;
}

.footer-developed {
  margin: 0;
  font-size: 12px;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.footer-developed strong {
  color: var(--primary-color);
  font-weight: 600;
}

.footer-heart {
  animation: heartbeat 1.5s ease-in-out infinite;
  display: inline-block;
  font-size: 11px;
}

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.2);
  }
  50% {
    transform: scale(1);
  }
}

#alerts {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
  min-width: 300px;
}

#alerts .alert {
  margin-bottom: 10px;
  border-radius: 8px;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 15px 20px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

#alerts .alert.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
  border-color: #f5c6cb;
}

#alerts .alert.alert-success {
  background-color: #d4edda;
  color: #155724;
  border-color: #c3e6cb;
}

#alerts .alert.alert-warning {
  background-color: #fff3cd;
  color: #856404;
  border-color: #ffeeba;
}

/* ===========================
   LOGIN PAGE (index.html)
   ========================= */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color) 0%, #0099ff 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 40px;
}

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 30px;
  text-align: center;
}

.login-card .form-control {
  padding: 12px 15px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.login-card .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
  outline: none;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-login:hover {
  background-color: #0b5ed7;
}

.btn-login:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

.login-toggle {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
}

.login-toggle a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.login-toggle a:hover {
  text-decoration: underline;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ===========================
   DASHBOARD (dashboard.html)
   ========================= */

/* ── User Menu Dropdown ─────────────────────────────────────── */
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1.5px solid #dee2e6;
  border-radius: 20px;
  padding: 0.3rem 0.85rem;
  font-size: 0.875rem;
  color: #495057;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-btn:hover,
.user-menu-btn:focus {
  background: #f1f3f5;
  border-color: #adb5bd;
  color: #212529;
  box-shadow: none;
  outline: none;
}

.user-dropdown-menu {
  min-width: 190px;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
  padding: 0.4rem 0;
  margin-top: 0.35rem !important;
}
.user-dropdown-menu .dropdown-item {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  margin: 0 0.25rem;
  width: auto;
  transition: background 0.12s ease;
  cursor: pointer;
}
.user-dropdown-menu .dropdown-item:hover {
  background: #f1f3f5;
}
.user-dropdown-menu .dropdown-item.text-danger:hover {
  background: #fff5f5;
  color: #dc3545 !important;
}
.user-dropdown-menu .dropdown-divider {
  margin: 0.3rem 0;
}
/* ─────────────────────────────────────────────────────────────── */

.navbar-brand {
  font-weight: 700;
  color: var(--primary-color) !important;
  font-size: 20px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.navbar-brand:hover {
  color: #0b5ed7 !important;
  text-decoration: none;
}

.sidebar a {
  color: #333;
  text-decoration: none;
  padding: 12px 20px;
  border-left: 4px solid transparent;
  transition: all 0.3s ease;
  display: block;
}

.sidebar a:hover {
  background-color: var(--light-bg);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
}

.sidebar a.active {
  background-color: var(--light-bg);
  border-left-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

/* ===========================
   CARDS & CONTAINERS
   ========================= */

.card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card-header {
  background-color: var(--light-bg);
  border-bottom: 2px solid var(--border-color);
  border-radius: 12px 12px 0 0;
  padding: 20px;
  font-weight: 600;
  color: #333;
}

.card-body {
  padding: 20px;
}

/* ===========================
   RESUMO FINANCEIRO
   ========================= */

.summary-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.summary-card h6 {
  color: #666;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
}

.summary-card .amount {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 0;
}

.summary-card.entrada .amount {
  color: var(--success-color);
}

.summary-card.saida .amount {
  color: var(--danger-color);
}

.summary-card.saldo .amount {
  color: var(--primary-color);
}

.summary-card.status .amount {
  font-size: 24px;
  margin-top: 8px;
}

.summary-card.status.positivo .amount {
  color: var(--success-color);
}

.summary-card.status.negativo .amount {
  color: var(--danger-color);
}

.summary-card.status h6 {
  font-size: 12px;
}

.summary-card.comparativo .amount {
  font-size: 24px;
  margin-top: 8px;
}

.summary-card.comparativo.crescimento .amount {
  color: var(--success-color);
}

.summary-card.comparativo.queda .amount {
  color: var(--danger-color);
}

.summary-card.comparativo h6 {
  font-size: 12px;
}

.summary-card.maiorGasto .amount {
  font-size: 24px;
  margin-top: 8px;
  color: var(--danger-color);
}

.summary-card.maiorGasto h6 {
  font-size: 12px;
}

/* ===========================
   TABELA DE TRANSAÇÕES
   ========================= */

.table {
  background-color: white;
}

.table-responsive {
  overflow-y: auto;
  max-height: 380px;
}

/* Scrollbar customizado - Transações Recentes e Histórico de Faturas */
.table-responsive::-webkit-scrollbar {
  width: 6px;
}

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

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 3px;
}

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

.table-responsive {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) #f1f3f5;
}

.table thead {
  background-color: var(--light-bg);
  border-bottom: 2px solid var(--border-color);
}

.table thead th {
  color: #333;
  font-weight: 600;
  padding: 15px;
  border: none;
}

.table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

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

.table tbody td {
  padding: 15px;
  vertical-align: middle;
}

.badge-entrada {
  background-color: #d4edda;
  color: var(--success-color);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
}

.badge-saida {
  background-color: #f8d7da;
  color: var(--danger-color);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
}

.tab-content {
  display: block;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  display: block;
}

.form-control,
.form-select {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 15px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
  outline: none;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger-color);
}

.invalid-feedback {
  color: var(--danger-color);
  font-size: 12px;
  margin-top: 5px;
  display: block;
}

/* ===========================
   BOTÕES
   ========================= */

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: #0b5ed7;
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-success:hover {
  background-color: #157347;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background-color: #bb2d3b;
}

.btn-warning {
  background-color: var(--warning-color);
  color: #333;
}

.btn-warning:hover {
  background-color: #ffbb33;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===========================
   ALERTAS
   ========================= */

.alert {
  border: none;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  animation: slideInDown 0.3s ease;
}

.alert-success {
  background-color: #d4edda;
  color: var(--success-color);
  border-left: 4px solid var(--success-color);
}

.alert-danger {
  background-color: #f8d7da;
  color: var(--danger-color);
  border-left: 4px solid var(--danger-color);
}

.alert-warning {
  background-color: #fff3cd;
  color: #856404;
  border-left: 4px solid var(--warning-color);
}

.alert-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border-left: 4px solid #17a2b8;
}

.btn-close {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.btn-close:hover {
  opacity: 1;
}

/* ===========================
   MODAL
   ========================= */

.modal-content {
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  background-color: var(--light-bg);
  border-bottom: 2px solid var(--border-color);
  border-radius: 12px 12px 0 0;
}

/* ===========================
   ANIMAÇÕES E TRANSIÇÕES
   ========================= */

/* Animação de fade-in para cards */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animação de slide-in para modal */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Animação de loading spinner */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Animação de pulse (efeito de batida) */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
  }
}

/* Animação de shake (erro) */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* Animação de slide-down */
@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

/* Transições gerais */
.summary-card {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: fadeIn 0.6s ease-out;
}

.summary-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.card {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: fadeIn 0.6s ease-out;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Botões */
.btn {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(-1px);
}

.btn-success {
  transition: all 0.3s ease;
}

.btn-success:hover {
  background-color: #147a3d !important;
}

.btn-danger {
  transition: all 0.3s ease;
}

.btn-danger:hover {
  background-color: #b72d2d !important;
}

.btn-warning {
  transition: all 0.3s ease;
}

.btn-warning:hover {
  background-color: #e0a800 !important;
}

/* Inputs e Selects */
.form-control,
.form-select {
  transition: all 0.3s ease;
  border: 2px solid var(--border-color);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
  transform: scale(1.01);
}

/* Tabelas */
.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  background-color: #f9f9f9;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.05);
}

/* Modal com transição */
.modal.show .modal-content {
  animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.fade {
  transition: opacity 0.3s ease;
}

/* Navbar */
.navbar-custom {
  animation: slideDown 0.5s ease-out;
}

/* Alertas */
.alert {
  animation: slideDown 0.4s ease-out;
}

.alert-dismissible .btn-close {
  transition: all 0.2s ease;
}

.alert-dismissible .btn-close:hover {
  transform: rotate(90deg);
  opacity: 0.7;
}

/* Badges */
.badge {
  transition: all 0.2s ease;
  animation: fadeIn 0.3s ease-out;
}

.badge:hover {
  transform: scale(1.05);
}

/* Links */
a {
  transition: color 0.3s ease;
}

a:hover {
  color: var(--primary-color);
}

/* Spinner de loading */
.spinner-border {
  animation: spin 1s linear infinite;
}

/* Campo de Valor com Formatação */
#transacaoValor {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

#transacaoValor:not(:placeholder-shown) {
  box-shadow: inset 0 0 8px rgba(40, 167, 69, 0.1);
}

#transacaoValor:focus {
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25), inset 0 0 8px rgba(40, 167, 69, 0.1);
}

/* Texto de sugestão de formatação de moeda */
#valorFormatted {
  font-size: 0.9rem;
  letter-spacing: 0.3px;
  animation: slideDown 0.3s ease;
}

/* Seções */
section {
  animation: fadeIn 0.5s ease-out;
}

/* Transição de opacidade para elementos que mudam */
.d-none {
  transition: opacity 0.3s ease;
}

/* Progress bars */
.progress-bar {
  transition: width 0.6s ease;
  animation: slideIn 0.6s ease-out;
}

/* Transição suave para mudança de página/seção */
.main-content > section {
  transition: opacity 0.3s ease;
}

/* Efeito de foco em elementos interativos */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  transition: outline 0.2s ease;
}

/* Animação de sucesso */
.text-success {
  transition: color 0.3s ease;
}

/* Animação de erro */
.text-danger {
  animation-name: shake;
  animation-duration: 0.5s;
}

/* Suporte para preferência de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.modal-header .modal-title {
  font-weight: 700;
  color: #333;
}

.modal-body {
  padding: 30px;
}

.modal-footer {
  background-color: var(--light-bg);
  border-top: 2px solid var(--border-color);
  border-radius: 0 0 12px 12px;
}

/* ===========================
   LOADING & SPINNER
   ========================= */

.spinner-border {
  color: var(--primary-color);
}

.d-none {
  display: none !important;
}

/* ===========================
   RESPONSIVIDADE
   ========================= */

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    padding: 15px;
  }

  .login-card {
    margin: 20px;
    padding: 30px;
  }

  .summary-card .amount {
    font-size: 22px;
  }

  .table {
    font-size: 13px;
  }

  .table th,
  .table td {
    padding: 10px;
  }

  .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 20px;
  }

  .login-card h1 {
    font-size: 22px;
    margin-bottom: 20px;
  }
}

/* ===========================
   ANIMAÇÕES
   ========================= */

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* ===========================
   GRÁFICOS
   ========================= */

#chartEntradaSaida {
  max-height: 225px !important;
}

#chartCategorias {
  max-height: 350px !important;
}

/* ================================================================
   SEÇÃO: GERENCIAR ASSINATURA
   ================================================================ */

.sub-manage-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.sub-manage-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.25rem;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.sub-manage-icon {
  font-size: 1.1rem;
}

.sub-manage-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #212529;
}

.sub-manage-body {
  padding: 1.1rem 1.25rem;
}

.sub-manage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid #f1f3f5;
  gap: 1rem;
}

.sub-manage-row:last-child {
  border-bottom: none;
}

.sub-manage-label {
  font-size: 0.85rem;
  color: #6c757d;
  white-space: nowrap;
}

.sub-manage-value {
  font-size: 0.9rem;
  color: #212529;
  text-align: right;
}

/* Badge de dias restantes */
.sub-days-badge {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #d1e7dd;
  color: #0f5132;
}

.sub-days-badge--warning {
  background: #fff3cd;
  color: #664d03;
}

/* Histórico de faturas */
/* (renderizado como <table> - estilos herdados de .table)
   Max-height menor para forçar scroll com poucos itens */
.sub-faturas-table {
  max-height: 220px !important;
}
