/*
 ============================================
   PROJETOINVEST — Design System Futurista
 ============================================
*/

:root {
  /* Paleta Dark Modern */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2332;
  --bg-card: rgba(26, 35, 50, 0.6);
  --bg-card-hover: rgba(30, 41, 59, 0.8);

  /* Acenos Neon/Gradientes */
  --accent-primary: #3b82f6; /* Azul vibrante */
  --accent-secondary: #8b5cf6; /* Roxo */
  --accent-success: #10b981; /* Verde neon */
  --accent-danger: #ef4444; /* Vermelho */
  --accent-warning: #f59e0b; /* Ambar */

  /* Gradientes */
  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);

  /*Texto */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Borders & Effects */
  --border-light: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
  --shadow-glow-purple: 0 0 20px rgba(139, 92, 246, 0.3);

  /* Espaçamento */
  --border-radius: 12px;
  --border-radius-lg: 16px;
}

/* ============================================
   RESET & BASE — OVERRIDE BOOTSTRAP DEFAULTS
   ============================================ */

body.modern-theme {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Acessibilidade estrutural e navegação por teclado */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2000;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #0a0e17 !important;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  transform: translateY(calc(-100% - 1rem));
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

#main-content:focus {
  outline: none;
}

body.modern-theme :where(
  a,
  button,
  input:not([type="hidden"]),
  select,
  textarea,
  [tabindex]:not([tabindex="-1"])
):focus-visible {
  outline: 3px solid #60a5fa !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--bg-primary) !important;
}

.table-responsive[tabindex="0"] {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

.table-responsive[tabindex="0"]:focus-visible {
  border-radius: var(--border-radius);
}

.data-list-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.85rem;
  align-items: end;
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.015);
}

.data-list-field {
  min-width: 0;
}

.data-list-field-wide {
  grid-column: span 2;
}

.data-list-field label,
.data-list-field > label:first-child {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 650;
}

.data-list-field .form-control,
.data-list-field .form-select,
.data-list-field input[type="search"] {
  width: 100% !important;
  margin-left: 0 !important;
}

.data-list-toolbar-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  min-height: 2.4rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.context-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1;
  vertical-align: middle;
}

.context-help:hover,
.context-help:focus-visible {
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
}

.session-expiry-warning {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1090;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(34rem, calc(100vw - 2rem));
  padding: 1rem;
  border: 1px solid rgba(255, 193, 7, 0.55);
  border-radius: var(--border-radius);
  background: #191b24;
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}

.session-expiry-warning strong,
.session-expiry-warning span {
  display: block;
}

.session-expiry-warning span {
  margin-top: 0.2rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

@media (max-width: 575.98px) {
  .session-expiry-warning {
    align-items: stretch;
    flex-direction: column;
  }
}

.context-help:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* --- Sobrescrever cores Bootstrap para o tema dark --- */
body.modern-theme .text-primary, body.modern-theme .fw-bold, body.modern-theme h1, body.modern-theme h2, body.modern-theme h3, body.modern-theme h4, body.modern-theme h5, body.modern-theme h6 {
  color: #fff !important;
}
body.modern-theme .text-success { color: var(--accent-success) !important; }
body.modern-theme .text-danger { color: var(--accent-danger) !important; }
body.modern-theme .text-warning { color: var(--accent-warning) !important; }
body.modern-theme .text-info { color: #0dcaf0 !important; }

body.modern-theme .text-muted {
  color: var(--text-muted) !important;
}

/* bg variants para botões e badges */
body.modern-theme .bg-primary {
  background: var(--gradient-primary) !important;
  color: white !important;
}
body.modern-theme .bg-success {
  background: var(--gradient-success) !important;
  color: white !important;
}
body.modern-theme .bg-danger {
  background: var(--gradient-danger) !important;
  color: white !important;
}
body.modern-theme .bg-warning {
  background: var(--accent-warning) !important;
  color: #0a0e17 !important; /* Texto escuro no ambar para contraste */
  font-weight: 600;
}
body.modern-theme .bg-info {
  background: rgba(13, 202, 240, 0.9) !important;
  color: #0a0e17 !important;
}

/* Link colors */
body.modern-theme a {
  color: var(--accent-primary);
}
body.modern-theme a:hover {
  color: var(--accent-secondary);
}

/* --- Backgrounds claros do Bootstrap — escurecer para dark theme --- */
body.modern-theme .bg-light,
body.modern-theme .bg-white {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

body.modern-theme .bg-dark {
  background: var(--bg-primary) !important;
}

/* --- Buttons default do Bootstrap --- */
body.modern-theme .btn-primary {
  background: var(--gradient-primary) !important;
  border-color: var(--accent-primary) !important;
  color: white !important;
}
body.modern-theme .btn-primary:hover {
  background: var(--gradient-primary) !important;
  color: white !important;
}

body.modern-theme .btn-secondary {
  background: var(--bg-tertiary) !important;
  border-color: var(--border-light) !important;
  color: var(--text-secondary) !important;
}
body.modern-theme .btn-secondary:hover {
  background: #374151 !important;
  color: var(--text-primary) !important;
}

body.modern-theme .btn-success {
  background: var(--gradient-success) !important;
  border-color: var(--accent-success) !important;
  color: white !important;
}
body.modern-theme .btn-danger {
  background: var(--gradient-danger) !important;
  border-color: var(--accent-danger) !important;
  color: white !important;
}
body.modern-theme .btn-warning {
  background: var(--accent-warning) !important;
  border-color: var(--accent-warning) !important;
  color: #0a0e17 !important;
}

/* Botões outline */
body.modern-theme .btn-outline-primary {
  color: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
}
body.modern-theme .btn-outline-primary:hover {
  background: rgba(59, 130, 246, 0.15) !important;
  color: var(--accent-primary) !important;
}

body.modern-theme .btn-outline-secondary {
  color: var(--text-secondary) !important;
  border-color: var(--border-light) !important;
}
body.modern-theme .btn-outline-secondary:hover {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

/* Outline Dark — botões de ticker não selecionados */
body.modern-theme .btn-outline-dark {
  color: var(--text-primary) !important;
  border-color: var(--border-light) !important;
  background: transparent !important;
}

body.modern-theme .btn-outline-dark:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-primary) !important;
  border-color: var(--text-secondary) !important;
}

/* Badge bg-secondary — contraste melhorado no dark theme */
body.modern-theme .badge.bg-secondary,
body.modern-theme .bg-secondary {
  background: rgba(255,255,255,0.08) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-light);
  font-weight: 600;
}

/* --- Badges (fora das classes .bg-*) --- */
body.modern-theme .badge {
  font-weight: 600;
  padding: 0.35em 0.65em;
  border-radius: 6px;
  font-size: 0.8em;
}

/* --- Form controls placeholders --- */
body.modern-theme .form-control::placeholder {
  color: var(--text-secondary) !important;
  opacity: 0.6;
}

/* Texto muted e text-muted-custom — mais visível no dark theme */
body.modern-theme .text-muted-custom,
body.modern-theme .text-muted {
  color: #f1f5f9 !important;
  opacity: 1;
}

/* --- Table stripes --- */
body.modern-theme .table-striped tbody tr:nth-of-type(odd) {
  background: rgba(255, 255, 255, 0.02);
}

/* --- Dropdown menu --- */
body.modern-theme .dropdown-menu {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--border-radius) !important;
  box-shadow: var(--shadow-md) !important;
  z-index: 1060 !important; /* Garante que dropdowns fiquem acima de outros elementos */
}

body.modern-theme .dropdown-item {
  color: var(--text-secondary) !important;
  padding: 0.6rem 1rem !important;
  transition: all 0.2s ease;
  border-radius: 6px;
  margin: 2px 0;
}

body.modern-theme .dropdown-item:hover {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  transform: translateX(4px);
}

body.modern-theme .dropdown-header {
  color: var(--text-muted) !important;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0.5rem 1rem 0.25rem !important;
  font-weight: 600;
}

body.modern-theme .dropdown-divider {
  border-color: var(--border-light) !important;
  margin: 0.5rem 0;
}

/* --- Modal header/footer borders --- */
body.modern-theme .modal-header,
body.modern-theme .modal-footer {
  border-color: var(--border-light) !important;
}
body.modern-theme .modal-content {
  background: var(--bg-secondary) !important;
  border-color: var(--border-light) !important;
}

/* --- List groups --- */
body.modern-theme .list-group-item {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text-secondary);
}
body.modern-theme .list-group-item-action:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* --- Navbar toggler icon --- */
body.modern-theme .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2894, 163, 184, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* --- Breadcrumb --- */
body.modern-theme .breadcrumb {
  --bs-breadcrumb-divider-color: var(--text-muted);
}
body.modern-theme .breadcrumb-item.active {
  color: var(--text-muted);
}

/* --- Pagination --- */
body.modern-theme .page-link {
  background: var(--bg-tertiary);
  border-color: var(--border-light);
  color: var(--text-secondary);
}
body.modern-theme .page-link:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}
body.modern-theme .page-item.active .page-link {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
}

/* Scrollbar custom */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* ============================================
   NAVBAR MODERNA (Glassmorphism)
   ============================================ */

.navbar-modern {
  background: rgba(10, 14, 23, 0.85) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1050; /* Garante que navbar e seus dropdowns fiquem acima do conteúdo */
}

.navbar-modern.scrolled {
  background: rgba(10, 14, 23, 0.95) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: -0.5px;
  background: transparent !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: var(--accent-primary) !important;
  background-clip: unset !important;
  font-size: 1.5rem;
}

/* Logo no navbar */
.navbar-brand img {
  height: 45px;
  width: auto;
  transition: transform 0.3s ease;
  animation: logoPulse 3s ease-in-out infinite;
}

.navbar-brand img:hover {
  animation: none;
  transform: scale(1.05);
}

@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

.nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
  margin: 0 2px;
}

.nav-link:hover {
  color: var(--text-primary) !important;
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.nav-link.active {
  color: var(--accent-primary) !important;
  background: rgba(59, 130, 246, 0.15);
}

/* Indicador visual no link ativo */
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

/* Dropdown */
.dropdown-menu {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  padding: 0.5rem;
  min-width: 220px;
  box-shadow: var(--shadow-md);
  margin-top: 0.5rem;
}

.dropdown-item {
  color: var(--text-secondary);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transform: translateX(4px);
}

.dropdown-header {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0.5rem 1rem 0.25rem;
  font-weight: 600;
}

.dropdown-divider {
  border-color: var(--border-light);
  margin: 0.5rem 0;
}

/* Toggle button mobile */
.navbar-toggler {
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.navbar-toggler:hover {
  color: var(--text-primary);
}

/* ============================================
   CARDS (GLASSMORPHISM)
   ============================================ */

.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  color: var(--text-primary);
  padding: 1rem 1.25rem;
}

.card-body {
  color: var(--text-secondary);
}

/* ============================================
   BUTTONS MODERNOS
   ============================================ */

.btn {
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.3px;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
  background: var(--gradient-primary);
  color: white;
}

.btn-modern-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
}

.btn-modern-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5);
  background: var(--gradient-primary);
  color: white;
}

/* Textos auxiliares dos formulários devem manter contraste no tema escuro. */
body.modern-theme .form-text {
  color: #cbd5e1 !important;
  opacity: 1;
}

.btn-outline-primary {
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
  background: transparent;
}

.btn-outline-primary:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background: var(--gradient-danger);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: #374151;
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--accent-warning) !important;
  border-color: var(--accent-warning) !important;
  color: #0a0e17 !important;
  font-weight: 700;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
  color: #0a0e17 !important;
}

/* Botão ícone */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

/* ============================================
   BADGES MODERNOS
   ============================================ */

.badge {
  font-weight: 600;
  padding: 0.35em 0.65em;
  border-radius: 6px;
  font-size: 0.8em;
}

.bg-success {
  background: var(--gradient-success) !important;
  color: white;
}

.bg-danger {
  background: var(--gradient-danger) !important;
  color: white;
}

.bg-primary {
  background: var(--gradient-primary) !important;
  color: white;
}

.bg-warning {
  background: var(--accent-warning) !important;
  color: #0a0e17; /* Texto escuro no ambar — alto contraste */
  font-weight: 600;
  text-shadow: 0 0 4px rgba(255,255,255,0.3);
}

/* ===================================
   TABLES (DataTables)
   ==================================== */

.dataTables_wrapper {
  color: var(--text-secondary);
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.5rem 1rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.table {
  color: var(--text-primary) !important;
}

.table thead {
  background: var(--bg-tertiary);
}

.table thead th {
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  color: var(--text-primary);
  padding: 1rem;
}

.table tbody tr {
  transition: background 0.2s ease;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ============================================
   ALERTS MODERNOS
   ============================================ */

.alert {
  border-radius: var(--border-radius) !important;
  border-left: 4px solid !important;
  background: var(--bg-card) !important;
  backdrop-filter: blur(10px);
  color: var(--text-primary) !important;
  border: none !important;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease;
}

.alert-success {
  border-left-color: var(--accent-success) !important;
  background: rgba(16, 185, 129, 0.2) !important;
  color: #6ee7b7 !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.alert-success strong,
.alert-success .text-success {
  color: #34d399 !important;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.alert-danger {
  border-left-color: var(--accent-danger) !important;
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
}

.alert-danger strong,
.alert-danger .text-danger {
  color: #f87171 !important;
}

.alert-warning {
  border-left-color: var(--accent-warning) !important;
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fcd34d !important;
}

.alert-warning strong,
.alert-warning .text-warning {
  color: #fbbf24 !important;
}

.alert-info {
  border-left-color: var(--accent-primary) !important;
  background: rgba(59, 130, 246, 0.15) !important;
  color: #93c5fd !important;
}

.alert-info strong,
.alert-info .text-info {
  color: #60a5fa !important;
}

/* Alertas do Telegram no dashboard - ajustar visibilidade */
#telegram-dashboard-feedback .alert {
  margin-bottom: 0;
}

/* ============================================
   FORMS MODERNOS
   ============================================ */

.form-control, .form-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.675rem 1rem;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
  color: var(--text-secondary) !important;
  opacity: 0.6;
}

.form-label {
  color: var(--text-secondary) !important;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.select2-container {
  width: 100% !important;
}

.select2-container--default .select2-selection--single {
  height: calc(2.25rem + 2px);
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text-primary);
  line-height: normal;
  padding-left: 0.75rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 0.5rem;
}

.select2-dropdown {
  background: #1f2937;
  border: 1px solid var(--border-light);
  z-index: 1065;
}

.invest-asset-select-dropdown {
  max-width: 100%;
}

.select2-search__field {
  background: #111827 !important;
  color: #fff !important;
}

.invest-asset-select-dropdown .select2-results__options {
  max-height: 260px !important;
  overflow-y: auto !important;
}

.select2-results__option {
  color: #e5e7eb;
}

/* ============================================
   MODAIS
   ============================================ */

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
}

.modal-header {
  border-bottom: 1px solid var(--border-light);
}

.modal-footer {
  border-top: 1px solid var(--border-light);
}

.btn-close {
  filter: invert(1);
  opacity: 0.6;
}

/* ============================================
   DASHBOARD CARDS
   ============================================ */

.border-start {
  border-left: 4px solid !important;
}

.border-primary { border-left-color: var(--accent-primary) !important; }
.border-success { border-left-color: var(--accent-success) !important; }
.border-info { border-left-color: var(--accent-primary) !important; }

/* ============================================
   ANIMAÇÕES
   ============================================ */

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.4s ease forwards;
}

.animate-slideUp {
  animation: slideUp 0.4s ease forwards;
}

/* Staggered animation for cards */
.card-stagger {
  opacity: 0;
  animation: slideUp 0.5s ease forwards;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (max-width: 768px) {
  .navbar-brand {
    font-size: 1.25rem;
  }

  .nav-link {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.9rem;
  }

  .container-fluid {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  h1,
  .h1 {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  .navbar-collapse {
    max-height: calc(100dvh - 4.5rem);
    overflow-y: auto;
    padding: 0.5rem 0 1rem;
  }

  .navbar-toggler,
  .btn-close {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }

  .navbar-modern .nav-link {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
    width: 100%;
  }

  .flash-messages {
    top: 4.25rem;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    max-width: none;
    padding-inline: 0 !important;
  }

  .dataTables_wrapper .row > div {
    width: 100%;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none;
    width: 100%;
    text-align: left !important;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100%;
    max-width: none;
    margin: 0.4rem 0 0;
  }

  .dataTables_wrapper .pagination {
    flex-wrap: wrap;
    justify-content: flex-start !important;
    gap: 0.25rem;
  }

  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }

  .data-list-toolbar {
    grid-template-columns: 1fr;
  }

  .data-list-field-wide {
    grid-column: auto;
  }

  .data-list-toolbar-status {
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

@media (pointer: coarse) {
  body.modern-theme :where(.btn, .nav-link, button:not(.btn-close)) {
    min-height: 2.75rem;
  }

  body.modern-theme .btn-close {
    min-width: 2.75rem;
    min-height: 2.75rem;
    background-size: 1rem;
  }

  body.modern-theme :where(.form-control:not(textarea), .form-select) {
    min-height: 2.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   UTILITÁRIOS — CORES DE TEXTO TEMÁTICAS
   ============================================ */

/* Textos com variações de cor — todas com bom contraste no fundo dark */
.text-primary-custom {
  color: var(--accent-primary) !important;
}
.text-secondary-custom {
  color: var(--text-secondary) !important;
}
.text-muted-custom {
  color: var(--text-secondary) !important; /* Mais visível que text-muted */
  opacity: 0.8;
}

/* Cores semânticas customizadas (ajustadas para dark theme) */
.text-success {
  color: var(--accent-success) !important;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}
.text-danger {
  color: var(--accent-danger) !important;
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
}
.text-warning {
  color: var(--accent-warning) !important;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.25);
}
.text-info {
  color: #0dcaf0 !important;
  text-shadow: 0 0 8px rgba(13, 202, 240, 0.25);
}

/* Texto gradiente */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glow effects */
.glow-blue {
  box-shadow: var(--shadow-glow-blue);
}
.glow-purple {
  box-shadow: var(--shadow-glow-purple);
}

/* Espaçamento utilitário */
.section {
  padding: 2rem 0;
}

/* Fundos temáticos com contraste garantido */
.bg-card {
  background: var(--bg-card) !important;
}
.bg-tertiary {
  background: var(--bg-tertiary) !important;
}

/* Utilitário de fonte */
.fw-extra {
  font-weight: 800;
}
.fw-bold-custom {
  font-weight: 700;
}

/* ============================================
   FLASH MESSAGES
   ============================================ */

.flash-messages {
  position: fixed;
  top: 70px;
  right: 1rem;
  z-index: 1060;
  max-width: 400px;
}

.flash-messages .alert {
  margin-bottom: 0.5rem;
  animation: slideDown 0.3s ease;
}

/* ============================================
   LOADING & SPINNERS
   ============================================ */

.spinner-glow {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   TABELAS MODERNAS
   ============================================ */

.table-modern {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border-light);
}

.table-modern thead {
  background: var(--bg-tertiary);
}

.table-modern thead th {
  border-bottom: 2px solid var(--border-light);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1rem;
}

.table-modern tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.table-modern tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

.table-modern tbody td {
  padding: 1rem;
  vertical-align: middle;
}

.table-modern .badge {
  font-weight: 600;
  padding: 0.35em 0.75em;
  border-radius: 6px;
}

/* DataTables custom */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--text-muted);
  margin-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  color: var(--text-secondary) !important;
  background: var(--bg-tertiary) !important;
  border: 1px solid var(--border-light) !important;
  margin: 0 2px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--accent-primary) !important;
  color: white !important;
  border-color: var(--accent-primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--gradient-primary) !important;
  color: white !important;
  border-color: transparent !important;
}

/* ============================================
   TABELAS — FORÇAR CORES NO ESCURO
   ============================================ */

body.modern-theme .table {
  color: var(--text-primary) !important;
}

body.modern-theme .table thead th {
  color: var(--text-primary) !important;
  background: var(--bg-tertiary) !important;
  border-bottom-color: var(--border-light) !important;
}

body.modern-theme .table tbody td {
  color: var(--text-primary) !important;
  padding: 1rem !important;
  vertical-align: middle !important;
}

/* Cores condicionais em células da tabela — sobrescrevem o color padrão do td */
body.modern-theme .table tbody td.text-success {
  color: var(--accent-success) !important;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}
body.modern-theme .table tbody td.text-danger {
  color: var(--accent-danger) !important;
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
}
body.modern-theme .table tbody td.text-warning {
  color: var(--accent-warning) !important;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.25);
}
body.modern-theme .table tbody td.text-info {
  color: #0dcaf0 !important;
  text-shadow: 0 0 8px rgba(13, 202, 240, 0.25);
}

body.modern-theme .table-striped tbody tr:nth-of-type(odd) {
  background: rgba(255, 255, 255, 0.02) !important;
}

body.modern-theme .table-hover tbody tr:hover {
  background: rgba(59, 130, 246, 0.05) !important;
}

/* Tabelas sem classes especiais */
body.modern-theme table.table {
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border-light);
  --bs-table-color: var(--text-primary);
}

body.modern-theme table.table thead {
  background: var(--bg-tertiary);
}

body.modern-theme table.table tbody tr {
  border-bottom-color: var(--border-light);
}

/* Sobrescrever table-light (Bootstrap) para tema dark */
body.modern-theme .table-light {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-light) !important;
}

body.modern-theme .table-light th,
body.modern-theme .table-light td {
  color: var(--text-primary) !important;
  border-color: var(--border-light) !important;
}

/* Força cor em células de tabela */
body.modern-theme td,
body.modern-theme th {
  color: inherit;
}

body.modern-theme .table-sm td,
body.modern-theme .table-sm th {
  padding: 0.5rem;
}


/* ============================================
   CORREÇÃO: ESTADO DISABLED E READONLY NO TEMA DARK
   ============================================ */
body.modern-theme .form-control:disabled,
body.modern-theme .form-select:disabled,
body.modern-theme .form-control[readonly] {
  background: rgba(255, 255, 255, 0.03) !important;
  color: var(--text-muted) !important;
  border-color: var(--border-light) !important;
  opacity: 0.6;
  cursor: not-allowed;
}
