/* Data dos logs: visível em ambos os temas */
.log-date {
  font-weight: 500;
  color: var(--log-date-color, #222);
}

[data-theme="dark"] .log-date {
  --log-date-color: #e0e0e0;
}
[data-theme="light"] .log-date {
  --log-date-color: #222;
}
/* Global theme overrides for Bootstrap components */

/* Prevent flash of unstyled content */
html {
  background-color: #0a0e1a;
}

html[data-theme="light"] {
  background-color: #f0f4f8;
}

/* Remove all underlines from links */
a {
  text-decoration: none !important;
}

a:hover {
  text-decoration: none !important;
}

/* Ensure smooth transitions */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Light theme - strong borders and shadows */
[data-theme="light"] {
  /* Typography emphasis */
  --bs-body-color: #1a202c;
  --bs-body-bg: #f0f4f8;
  --bs-border-color: #cbd5e0;
}

[data-theme="dark"] {
  --bs-body-color: #d6e0ea;
  --bs-body-bg: #0a0e1a;
  --bs-border-color: #374151;
}

/* Enhanced card styling for light theme */
[data-theme="light"] .card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Stronger input borders in light theme */
[data-theme="light"] input.form-control,
[data-theme="light"] select.form-select,
[data-theme="light"] textarea.form-control {
  border-width: 2px !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] input.form-control::placeholder,
[data-theme="light"] textarea.form-control::placeholder {
  color: #a0aec0;
}

/* Button emphasis in light theme */
[data-theme="light"] .btn {
  font-weight: 600;
  border-width: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

[data-theme="light"] .btn:active {
  transform: translateY(0);
}

/* Secondary button styling */
[data-theme="light"] .btn-secondary {
  background-color: #e2e8f0;
  border-color: #cbd5e0;
  color: #2d3748;
}

[data-theme="light"] .btn-secondary:hover {
  background-color: #cbd5e0;
  border-color: #a0aec0;
}

/* Table row hover effect */
[data-theme="light"] .table tbody tr:hover {
  background-color: rgba(11, 110, 79, 0.08);
  cursor: pointer;
}

[data-theme="light"] .table-bordered {
  border: 2px solid var(--border-color);
}

[data-theme="light"] .table-bordered th,
[data-theme="light"] .table-bordered td {
  border: 1px solid var(--border-color);
}

/* Badge strong styling */
[data-theme="light"] .badge {
  padding: 0.35em 0.65em;
  font-weight: 700;
  border: 2px solid transparent;
}

[data-theme="light"] .badge.bg-success {
  background-color: #10b981 !important;
  border-color: #059669;
}

[data-theme="light"] .badge.bg-danger {
  background-color: #ef4444 !important;
  border-color: #dc2626;
}

[data-theme="light"] .badge.bg-warning {
  background-color: #f59e0b !important;
  border-color: #d97706;
  color: #78350f !important;
}

[data-theme="light"] .badge.bg-info {
  background-color: #3b82f6 !important;
  border-color: #2563eb;
}

[data-theme="light"] .badge.bg-primary {
  background-color: #0b6e4f !important;
  border-color: #095940;
}

/* Dark theme buttons */
[data-theme="dark"] .btn {
  border-width: 1px;
}

/* Enhanced badge styling for dark theme */
[data-theme="dark"] .badge {
  font-weight: 600;
  padding: 0.35em 0.65em;
}

[data-theme="dark"] .badge.bg-warning {
  background-color: #f59e0b !important;
  color: #000000 !important;
}

[data-theme="dark"] .badge.bg-success {
  background-color: #10b981 !important;
  color: #ffffff !important;
}

[data-theme="dark"] .badge.bg-danger {
  background-color: #ef4444 !important;
  color: #ffffff !important;
}

[data-theme="dark"] .badge.bg-info {
  background-color: #0ea5e9 !important;
  color: #ffffff !important;
}

[data-theme="dark"] .badge.bg-primary {
  background-color: #0b6e4f !important;
  color: #ffffff !important;
}

[data-theme="dark"] .badge.bg-secondary {
  background-color: #6b7280 !important;
  color: #ffffff !important;
}

/* Links - using neutral colors */
[data-theme="light"] a {
  color: #2563eb;
  font-weight: 500;
}

[data-theme="light"] a:hover {
  color: #1d4ed8;
}

[data-theme="dark"] a {
  color: #60a5fa;
}

[data-theme="dark"] a:hover {
  color: #93c5fd;
}

/* Links within cards and content - ensure visibility */
[data-theme="light"] .card a:not(.btn),
[data-theme="light"] .container a:not(.btn) {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

[data-theme="light"] .card a:not(.btn):hover,
[data-theme="light"] .container a:not(.btn):hover {
  color: #1d4ed8;
}

[data-theme="dark"] .card a:not(.btn),
[data-theme="dark"] .container a:not(.btn) {
  color: #60a5fa;
  font-weight: 500;
  text-decoration: none;
}

[data-theme="dark"] .card a:not(.btn):hover,
[data-theme="dark"] .container a:not(.btn):hover {
  color: #93c5fd;
  text-decoration: underline;
}

/* Ensure all text within cards is visible */
[data-theme="dark"] .card,
[data-theme="dark"] .card-body,
[data-theme="dark"] .card-title,
[data-theme="dark"] .card-text {
  color: var(--text-primary) !important;
}

[data-theme="light"] .card,
[data-theme="light"] .card-body,
[data-theme="light"] .card-title,
[data-theme="light"] .card-text {
  color: var(--text-primary) !important;
}

/* HR dividers */
[data-theme="light"] hr {
  border-color: var(--border-color);
  opacity: 1;
  border-width: 2px;
}

[data-theme="dark"] hr {
  border-color: var(--border-color);
  opacity: 0.3;
}

/* Scrollbar styling */
[data-theme="light"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f1f5f9;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 5px;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

[data-theme="dark"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #1f2937;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 5px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Text selection */
[data-theme="light"] ::selection {
  background-color: rgba(11, 110, 79, 0.2);
  color: #1a202c;
}

[data-theme="dark"] ::selection {
  background-color: rgba(11, 110, 79, 0.4);
  color: #e5e7eb;
}

/* Ensure all text is visible in both themes */
[data-theme="dark"] p,
[data-theme="dark"] span:not(.badge),
[data-theme="dark"] div,
[data-theme="dark"] label,
[data-theme="dark"] small {
  color: var(--text-secondary);
}

[data-theme="light"] p,
[data-theme="light"] span:not(.badge),
[data-theme="light"] div,
[data-theme="light"] label,
[data-theme="light"] small {
  color: var(--text-primary);
}

/* Main titles strong visibility */
[data-theme="dark"] h1 {
  color: #ffffff !important;
}

[data-theme="light"] h1 {
  color: #1a202c !important;
}

[data-theme="dark"] h2, 
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: #e5e7eb !important;
}

[data-theme="light"] h2, 
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] h5,
[data-theme="light"] h6 {
  color: #2d3748 !important;
}

/* Module cards (dashboard home page) */
[data-theme="dark"] .card .card-title,
[data-theme="dark"] .card h3,
[data-theme="dark"] .card h4,
[data-theme="dark"] .card h5 {
  color: #ffffff !important;
}

[data-theme="light"] .card .card-title,
[data-theme="light"] .card h3,
[data-theme="light"] .card h4,
[data-theme="light"] .card h5 {
  color: #1a202c !important;
  font-weight: 700;
}

/* Card descriptions */
[data-theme="dark"] .card .card-text,
[data-theme="dark"] .card p {
  color: #d1d5db !important;
}

[data-theme="light"] .card .card-text,
[data-theme="light"] .card p {
  color: #4a5568 !important;
}

/* Fix input visibility in dark theme */
[data-theme="dark"] input.form-control,
[data-theme="dark"] textarea.form-control,
[data-theme="dark"] select.form-select {
  background-color: #1f2937 !important;
  border: 1px solid #4b5563 !important;
  color: #e5e7eb !important;
}

[data-theme="dark"] input.form-control::placeholder,
[data-theme="dark"] textarea.form-control::placeholder {
  color: #9ca3af !important;
  opacity: 1;
}

[data-theme="dark"] input.form-control:focus,
[data-theme="dark"] textarea.form-control:focus,
[data-theme="dark"] select.form-select:focus {
  background-color: #1f2937 !important;
  border-color: #0b6e4f !important;
  color: #e5e7eb !important;
  box-shadow: 0 0 0 0.2rem rgba(11,110,79,0.25) !important;
}

/* Date/time inputs specific fix */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="month"],
[data-theme="dark"] input[type="week"] {
  color-scheme: dark;
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
}

[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="datetime-local"],
[data-theme="light"] input[type="time"],
[data-theme="light"] input[type="month"],
[data-theme="light"] input[type="week"] {
  color-scheme: light;
}

/* File input visibility */
[data-theme="dark"] input[type="file"] {
  color: #e5e7eb !important;
}

[data-theme="dark"] input[type="file"]::file-selector-button {
  background-color: #374151;
  border: 1px solid #4b5563;
  color: #e5e7eb;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
}

[data-theme="dark"] input[type="file"]::file-selector-button:hover {
  background-color: #4b5563;
}

/* User card buttons visibility */
[data-theme="dark"] .user-card .btn,
[data-theme="dark"] .user-actions-row .btn {
  color: #fff !important;
}

[data-theme="light"] .user-card .btn-outline-light {
  border-color: #cbd5e0 !important;
  color: #2d3748 !important;
  background-color: transparent;
}

[data-theme="light"] .user-card .btn-outline-light:hover {
  background-color: #e2e8f0 !important;
  border-color: #a0aec0 !important;
  color: #1a202c !important;
}

[data-theme="dark"] .user-card .btn-outline-light {
  border-color: rgba(255,255,255,0.2) !important;
  color: #e5e7eb !important;
}

[data-theme="dark"] .user-card .btn-outline-light:hover {
  background-color: rgba(255,255,255,0.1) !important;
  border-color: rgba(255,255,255,0.3) !important;
  color: #ffffff !important;
}

/* Table action buttons */
[data-theme="dark"] .table .btn-info,
[data-theme="dark"] .btn-info {
  background-color: #0ea5e9;
  border-color: #0ea5e9;
  color: #ffffff;
}

[data-theme="dark"] .table .btn-info:hover,
[data-theme="dark"] .btn-info:hover {
  background-color: #0284c7;
  border-color: #0284c7;
}

[data-theme="dark"] .table .btn-warning,
[data-theme="dark"] .btn-warning {
  background-color: #f59e0b;
  border-color: #f59e0b;
  color: #ffffff;
}

[data-theme="dark"] .table .btn-warning:hover,
[data-theme="dark"] .btn-warning:hover {
  background-color: #d97706;
  border-color: #d97706;
}

[data-theme="dark"] .table .btn-danger,
[data-theme="dark"] .btn-danger {
  background-color: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

[data-theme="dark"] .table .btn-danger:hover,
[data-theme="dark"] .btn-danger:hover {
  background-color: #dc2626;
  border-color: #dc2626;
}

[data-theme="dark"] .table .btn-success,
[data-theme="dark"] .btn-success {
  background-color: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

[data-theme="dark"] .table .btn-success:hover,
[data-theme="dark"] .btn-success:hover {
  background-color: #059669;
  border-color: #059669;
}

/* Light theme button enhancements */
[data-theme="light"] .btn-info {
  background-color: #0ea5e9;
  border-color: #0ea5e9;
  color: #ffffff;
  font-weight: 600;
}

[data-theme="light"] .btn-info:hover {
  background-color: #0284c7;
  border-color: #0284c7;
  box-shadow: 0 2px 6px rgba(14,165,233,0.3);
}

[data-theme="light"] .btn-warning {
  background-color: #f59e0b;
  border-color: #f59e0b;
  color: #ffffff;
  font-weight: 600;
}

[data-theme="light"] .btn-warning:hover {
  background-color: #d97706;
  border-color: #d97706;
  box-shadow: 0 2px 6px rgba(245,158,11,0.3);
}

[data-theme="light"] .btn-danger {
  background-color: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  font-weight: 600;
}

[data-theme="light"] .btn-danger:hover {
  background-color: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 2px 6px rgba(239,68,68,0.3);
}

[data-theme="light"] .btn-success {
  background-color: #10b981;
  border-color: #10b981;
  color: #ffffff;
  font-weight: 600;
}

[data-theme="light"] .btn-success:hover {
  background-color: #059669;
  border-color: #059669;
  box-shadow: 0 2px 6px rgba(16,185,129,0.3);
}

/* Small buttons in tables */
[data-theme="dark"] .btn-sm,
[data-theme="light"] .btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.375rem;
}

/* Card list items (cotações, etc.) */
[data-theme="dark"] .card.bg-secondary,
[data-theme="dark"] .card.bg-dark {
  background-color: #1f2937 !important;
  border: 1px solid #374151;
}

[data-theme="dark"] .card.bg-warning {
  background-color: #78350f !important;
  border: 1px solid #f59e0b;
}

[data-theme="dark"] .card .card-header {
  background-color: rgba(255,255,255,0.03);
  border-bottom: 1px solid #374151;
  color: #ffffff;
  font-weight: 600;
}

[data-theme="light"] .card .card-header {
  background-color: #f7fafc;
  border-bottom: 2px solid #e2e8f0;
  color: #1a202c;
  font-weight: 700;
}

/* Info text in cards */
[data-theme="dark"] .card small,
[data-theme="dark"] .card .text-muted {
  color: #9ca3af !important;
}

[data-theme="light"] .card small,
[data-theme="light"] .card .text-muted {
  color: #64748b !important;
}

/* Modal improvements */
[data-theme="dark"] .modal-content {
  background-color: #1f2937;
  color: #e5e7eb;
}

[data-theme="light"] .modal-content {
  background-color: #ffffff;
  color: #1a202c;
}

[data-theme="dark"] .modal-header {
  background-color: transparent;
  border-bottom: 1px solid #374151;
}

[data-theme="dark"] .modal-title {
  color: #ffffff;
  font-weight: 600;
}

[data-theme="dark"] .modal-body {
  background-color: transparent;
  color: #e5e7eb;
}

[data-theme="dark"] .modal-footer {
  background-color: transparent;
  border-top: 1px solid #374151;
}

[data-theme="light"] .modal-header {
  background-color: transparent;
  border-bottom: 1px solid #cbd5e0;
}

[data-theme="light"] .modal-title {
  color: #1a202c;
  font-weight: 700;
}

/* Table text visibility - ensure all text is visible */
[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="dark"] .table thead th,
[data-theme="dark"] .table tbody td,
[data-theme="dark"] .table a:not(.btn) {
  color: #e5e7eb !important;
}

[data-theme="light"] .table td,
[data-theme="light"] .table th,
[data-theme="light"] .table thead th,
[data-theme="light"] .table tbody td,
[data-theme="light"] .table a:not(.btn) {
  color: #2d3748 !important;
}

/* Override Bootstrap table-light class for dark theme */
[data-theme="dark"] .table-light,
[data-theme="dark"] .table thead.table-light,
[data-theme="dark"] .table-light th {
  background-color: #1f2937 !important;
  color: #e5e7eb !important;
  border-color: #4b5563 !important;
}

/* Override Bootstrap table-light class for light theme */
[data-theme="light"] .table-light,
[data-theme="light"] .table thead.table-light,
[data-theme="light"] .table-light th {
  background-color: #f7fafc !important;
  color: #1a202c !important;
  border-color: #cbd5e0 !important;
}

/* Table links */
[data-theme="dark"] .table a:not(.btn) {
  color: #60a5fa !important;
}

[data-theme="dark"] .table a:not(.btn):hover {
  color: #93c5fd !important;
}

[data-theme="light"] .table a:not(.btn) {
  color: #2563eb !important;
}

[data-theme="light"] .table a:not(.btn):hover {
  color: #1d4ed8 !important;
}

/* Navbar styling for admin pages */
[data-theme="dark"] .navbar {
  background-color: #1f2937 !important;
  border-bottom: 1px solid #374151 !important;
}

[data-theme="light"] .navbar {
  background-color: #ffffff !important;
  border-bottom: 2px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Card styling consistency */
[data-theme="dark"] .card {
  background-color: #1f2937;
  border: 1px solid #374151;
  color: #e5e7eb;
}

[data-theme="dark"] .card-header {
  background-color: rgba(255,255,255,0.03);
  border-bottom: 1px solid #374151;
  color: #ffffff;
}

[data-theme="light"] .card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
}

[data-theme="light"] .card-header {
  background-color: #f7fafc;
  border-bottom: 2px solid #e2e8f0;
}

/* List group items */
[data-theme="dark"] .list-group-item {
  background-color: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}

[data-theme="dark"] .list-group-item:hover {
  background-color: #374151;
}

[data-theme="light"] .list-group-item {
  background-color: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .list-group-item:hover {
  background-color: #f7fafc;
}

/* Form check labels */
[data-theme="dark"] .form-check-label {
  color: #e5e7eb;
}

[data-theme="light"] .form-check-label {
  color: #2d3748;
}

/* Border utilities */
[data-theme="dark"] .border-bottom {
  border-bottom-color: #4b5563 !important;
}

[data-theme="light"] .border-bottom {
  border-bottom-color: #cbd5e0 !important;
}

[data-theme="dark"] .border-top {
  border-top-color: #4b5563 !important;
}

[data-theme="light"] .border-top {
  border-top-color: #cbd5e0 !important;
}

/* bg-light override for dark theme — makes Bootstrap bg-light adaptive */
[data-theme="dark"] .bg-light {
  background-color: var(--card-bg, #1f2937) !important;
  color: var(--text-primary, #e5e7eb) !important;
}

/* Outline buttons - neutral colors for all outline buttons */
[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-secondary {
  color: #e5e7eb !important;
  border-color: #4b5563 !important;
  background-color: transparent !important;
}

[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-secondary:hover {
  background-color: #374151 !important;
  border-color: #6b7280 !important;
  color: #ffffff !important;
}

[data-theme="light"] .btn-outline-primary,
[data-theme="light"] .btn-outline-secondary {
  color: #374151 !important;
  border-color: #cbd5e0 !important;
  background-color: transparent !important;
}

[data-theme="light"] .btn-outline-primary:hover,
[data-theme="light"] .btn-outline-secondary:hover {
  background-color: #f7fafc !important;
  border-color: #a0aec0 !important;
  color: #1a202c !important;
}

/* Persistent financial approval limit panel. Not a Bootstrap alert:
   flash auto-hide targets .alert globally. */
.limite-aprovacao-inline {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--bs-border-color, #cbd5e0);
  border-left: 4px solid #198754;
  border-radius: 0.375rem;
  color: var(--text-primary, var(--bs-body-color, #1a202c));
  padding: 0.75rem 1rem;
}

.limite-aprovacao-inline.is-estourado {
  border-left-color: #dc3545;
}

.limite-aprovacao-inline__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem 1rem;
}

.limite-aprovacao-inline__label {
  display: block;
  color: var(--text-secondary, #6c757d);
  font-size: 0.75rem;
  line-height: 1.2;
}

.limite-aprovacao-inline__value {
  font-weight: 600;
}

.limite-aprovacao-inline__detail {
  border-left: 1px solid rgba(108, 117, 125, 0.35);
  color: var(--text-secondary, #6c757d);
  font-size: 0.8rem;
  margin-top: 0.35rem;
  padding-left: 0.75rem;
}

@media (max-width: 767.98px) {
  .limite-aprovacao-inline__grid {
    grid-template-columns: 1fr;
  }
}
