/* ==========================================
   SISTEMA DE TEMAS - CLARO E ESCURO
   Variáveis CSS com contraste adequado
   ========================================== */

:root {
    /* Tema Claro (padrão) */
    --theme-bg-primary: #f8f9fa;
    --theme-bg-secondary: #ffffff;
    --theme-bg-tertiary: #e9ecef;
    --theme-bg-hover: #f1f5f9;
    --theme-bg-active: #e3f2fd;
    
    --theme-text-primary: #2c3e50;
    --theme-text-secondary: #5a6c7d;
    --theme-text-muted: #6c757d;
    --theme-text-inverted: #ffffff;
    --theme-primary-contrast: #ffffff; /* Texto que contrasta com --theme-primary */
    
    --theme-border-color: #e3e6f0;
    --theme-border-light: #dee2e6;
    
    --theme-sidebar-bg: #ffffff;
    --theme-sidebar-header-bg: #f8f9fa;
    --theme-sidebar-text: #2c3e50;
    --theme-sidebar-text-secondary: #5a6c7d;
    --theme-sidebar-hover: #f1f5f9;
    --theme-sidebar-active: #e3f2fd;
    --theme-sidebar-footer-bg: #f8f9fa;
    
    --theme-topbar-bg: #ffffff;
    --theme-topbar-text: #2c3e50;
    --theme-topbar-text-secondary: #6c757d;
    
    --theme-card-bg: #ffffff;
    --theme-card-header-bg: #f8f9fa;
    --theme-card-border: transparent;
    
    --theme-input-bg: #ffffff;
    --theme-input-border: #e9ecef;
    --theme-input-text: #2c3e50;
    --theme-input-placeholder: #6c757d;
    
    --theme-table-header-bg: #f8f9fa;
    --theme-table-text: #2c3e50;
    --theme-table-hover: rgba(102, 126, 234, 0.05);
    
    --theme-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
    --theme-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --theme-shadow-lg: 0 0 20px rgba(0, 0, 0, 0.05);
    
    /* Cores de ação (mantém em ambos os temas) */
    --theme-primary: #13375a;
    --theme-primary-light: #1a4a75;
    --theme-primary-hover: #0f2844;
    
    /* Cores de status (mantém em ambos os temas) */
    --theme-success: #28a745;
    --theme-warning: #ffc107;
    --theme-danger: #dc3545;
    --theme-info: #17a2b8;
    
    /* Gradientes */
    --theme-gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Tema Escuro */
[data-theme="dark"] {
    --theme-bg-primary: #1a1d23;
    --theme-bg-secondary: #242831;
    --theme-bg-tertiary: #2d3139;
    --theme-bg-hover: #2f3541;
    --theme-bg-active: #1e3a52;
    
    --theme-text-primary: #e9ecef;
    --theme-text-secondary: #b8bcc4;
    --theme-text-muted: #8b92a0;
    --theme-text-inverted: #ffffff;
    --theme-primary-contrast: #0f172a; /* Texto escuro que contrasta com primary claro */
    
    --theme-border-color: #3a3f4b;
    --theme-border-light: #2f3541;
    
    --theme-sidebar-bg: #242831;
    --theme-sidebar-header-bg: #1f2229;
    --theme-sidebar-text: #e9ecef;
    --theme-sidebar-text-secondary: #b8bcc4;
    --theme-sidebar-hover: #2f3541;
    --theme-sidebar-active: #1e3a52;
    --theme-sidebar-footer-bg: #1f2229;
    
    --theme-topbar-bg: #242831;
    --theme-topbar-text: #e9ecef;
    --theme-topbar-text-secondary: #b8bcc4;
    
    --theme-card-bg: #242831;
    --theme-card-header-bg: #1f2229;
    --theme-card-border: #3a3f4b;
    
    --theme-input-bg: #2d3139;
    --theme-input-border: #3a3f4b;
    --theme-input-text: #e9ecef;
    --theme-input-placeholder: #8b92a0;
    
    --theme-table-header-bg: #1f2229;
    --theme-table-text: #e9ecef;
    --theme-table-hover: rgba(102, 126, 234, 0.15);
    
    --theme-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
    --theme-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    --theme-shadow-lg: 0 0 20px rgba(0, 0, 0, 0.3);
    
    /* Ajuste de cores de status para melhor contraste no escuro */
    --theme-success: #34d058;
    --theme-warning: #ffd93d;
    --theme-danger: #f85149;
    --theme-info: #3fb5c8;
    
    /* Override de cores primárias para melhor contraste no escuro */
    --theme-primary: #5ba3ff;
    --theme-primary-light: #7bb8ff;
    --theme-primary-hover: #4a9eff;
    
    /* Gradientes para tema escuro */
    --theme-gradient-primary: linear-gradient(135deg, #1e3a52 0%, #2d3139 100%);
}

/* ==========================================
   APLICAÇÃO DO TEMA
   ========================================== */

body {
    background-color: var(--theme-bg-primary);
    color: var(--theme-text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Sidebar */
.sidebar {
    background-color: var(--theme-sidebar-bg);
    color: var(--theme-sidebar-text);
    border-right-color: var(--theme-border-color);
    box-shadow: var(--theme-shadow-lg);
}

.sidebar-header {
    background-color: var(--theme-sidebar-header-bg);
    border-bottom-color: var(--theme-border-color);
}

.sidebar-brand {
    color: var(--theme-primary);
}

.nav-section-title {
    color: var(--theme-text-muted);
}

.nav-item,
.nav-group-header {
    color: var(--theme-sidebar-text-secondary);
}

.nav-item:hover,
.nav-group-header:hover {
    background-color: var(--theme-sidebar-hover);
    color: var(--theme-primary);
}

.nav-item.active,
.nav-subitem.active {
    background-color: var(--theme-sidebar-active);
    color: var(--theme-primary);
}

.nav-item.active::before {
    background: var(--theme-primary);
}

.nav-subitem {
    color: var(--theme-text-muted);
}

.nav-subitem:hover {
    background-color: var(--theme-sidebar-hover);
    color: var(--theme-primary);
}

.sidebar-footer {
    background-color: var(--theme-sidebar-footer-bg);
    border-top-color: var(--theme-border-color);
}

.user-name {
    color: var(--theme-text-primary);
}

.user-role {
    color: var(--theme-text-muted);
}

/* Topbar */
.topbar {
    background-color: var(--theme-topbar-bg);
    color: var(--theme-topbar-text);
    box-shadow: var(--theme-shadow);
}

.page-title {
    color: var(--theme-primary);
}

.current-time {
    color: var(--theme-primary);
}

.current-date {
    color: var(--theme-text-secondary);
}

.sidebar-collapse {
    color: var(--theme-primary);
}

.sidebar-collapse:hover {
    background-color: var(--theme-bg-hover);
}

/* Cards */
.card {
    background-color: var(--theme-card-bg);
    color: var(--theme-text-primary);
    box-shadow: var(--theme-shadow-sm);
    border-color: var(--theme-card-border);
}

.card:hover {
    box-shadow: var(--theme-shadow);
}

.card-body {
    background-color: var(--theme-card-bg);
    color: var(--theme-text-primary);
}

.card-header {
    background-color: var(--theme-card-header-bg);
    color: var(--theme-text-primary);
    border-bottom-color: var(--theme-border-color);
}

.card-body {
    background-color: var(--theme-card-bg);
    color: var(--theme-text-primary);
}

/* Forms */
.form-control,
.form-select {
    background-color: var(--theme-input-bg) !important;
    color: var(--theme-input-text) !important;
    border-color: var(--theme-input-border);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--theme-input-bg) !important;
    color: var(--theme-input-text) !important;
    border-color: var(--theme-primary);
}

.form-control::placeholder {
    color: var(--theme-input-placeholder) !important;
}

.form-label {
    color: var(--theme-text-primary);
}

/* Tables */
.table {
    color: var(--theme-table-text);
}

.table thead th {
    background-color: var(--theme-table-header-bg);
    color: var(--theme-text-primary);
    border-bottom-color: var(--theme-border-color);
}

.table tbody tr {
    border-bottom-color: var(--theme-border-light);
}

.table tbody tr:hover {
    background-color: var(--theme-table-hover);
}

.table td {
    color: var(--theme-table-text);
}

/* Buttons - mantém cores vibrantes */
.btn-primary {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
    color: var(--theme-primary-contrast);
}

.btn-primary:hover {
    background: var(--theme-primary-hover);
    border-color: var(--theme-primary-hover);
    color: white;
}

.logout-btn {
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}

.logout-btn:hover {
    background-color: var(--theme-primary);
    color: var(--theme-primary-contrast);
}

/* Badges - mantém cores de status */
.badge.bg-success {
    background-color: var(--theme-success) !important;
    color: white;
}

.badge.bg-warning {
    background-color: var(--theme-warning) !important;
    color: #1a1d23;
}

.badge.bg-danger {
    background-color: var(--theme-danger) !important;
    color: white;
}

.badge.bg-info {
    background-color: var(--theme-info) !important;
    color: white;
}

/* Modals */
.modal-content {
    background-color: var(--theme-card-bg);
    color: var(--theme-text-primary);
    border-color: var(--theme-border-color);
}

.modal-header {
    background-color: var(--theme-card-header-bg);
    border-bottom-color: var(--theme-border-color);
}

.modal-footer {
    border-top-color: var(--theme-border-color);
}

.modal-title {
    color: var(--theme-text-primary);
}

.btn-close {
    filter: var(--theme-text-primary) == #e9ecef ? invert(1) : invert(0);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Dropdowns */
.dropdown-menu {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-border-color);
    box-shadow: var(--theme-shadow);
}

.dropdown-item {
    color: var(--theme-text-primary);
}

.dropdown-item:hover {
    background-color: var(--theme-bg-hover);
    color: var(--theme-primary);
}

/* Alerts */
.alert {
    border-color: var(--theme-border-color);
}

/* Scrollbar - Tema Escuro */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1f2229;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #3a3f4b;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #4a4f5b;
}

/* ==========================================
   BOTÃO DE TOGGLE DE TEMA
   ========================================== */

.theme-toggle {
    background: none;
    border: 2px solid var(--theme-border-color);
    color: var(--theme-text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background-color: var(--theme-bg-hover);
    border-color: var(--theme-primary);
    transform: scale(1.05);
}

.theme-toggle i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(20deg);
}

.theme-toggle-text {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Animação de transição suave do tema */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Exceções para não animar */
.btn, .nav-item, .nav-group-header, .nav-subitem, .card:hover {
    transition: all 0.3s ease;
}

/* Responsivo - ocultar texto em mobile */
@media (max-width: 768px) {
    .theme-toggle-text {
        display: none;
    }
    
    .theme-toggle {
        padding: 0.5rem;
    }
}

/* ==========================================
   CLASSES UTILITÁRIAS DE TEXTO
   ========================================== */

/* Substitui Bootstrap text-muted para suportar temas */
.theme-text-muted {
    color: var(--theme-text-muted) !important;
}

/* Texto secundário com suporte a temas */
.theme-text-secondary {
    color: var(--theme-text-secondary) !important;
}

/* Texto primário com suporte a temas */
.theme-text-primary {
    color: var(--theme-text-primary) !important;
}

/* ==========================================
   CORREÇÕES ADICIONAIS PARA TEMA ESCURO
   ========================================== */

/* Stats Cards - Labels e Valores - aplicar para ambos os temas */
.stats-label {
    color: var(--theme-text-muted) !important;
}

.stats-value {
    color: var(--theme-text-primary) !important;
}

/* Small text - aplicar para ambos os temas */
.small, small {
    color: var(--theme-text-secondary) !important;
}

/* Input Group Text - aplicar para ambos os temas */
.input-group-text {
    background-color: var(--theme-bg-tertiary) !important;
    border-color: var(--theme-input-border) !important;
    color: var(--theme-text-secondary) !important;
}

/* Bootstrap text-muted override - aplicar para ambos os temas */
.text-muted {
    color: var(--theme-text-muted) !important;
}

/* Ícones com text-muted */
i.text-muted,
.text-muted.fas,
.text-muted.far,
.text-muted.fab {
    color: var(--theme-text-muted) !important;
}

/* Override Bootstrap text-muted no tema escuro */
[data-theme="dark"] .text-muted {
    color: var(--theme-text-muted) !important;
}

/* Garantir que os ícones com text-muted fiquem visíveis no escuro */
[data-theme="dark"] .text-muted.fas,
[data-theme="dark"] .text-muted.far,
[data-theme="dark"] .text-muted.fab,
[data-theme="dark"] i.text-muted {
    color: var(--theme-text-muted) !important;
}

/* Table headers no tema escuro */
[data-theme="dark"] .table th {
    background-color: var(--theme-table-header-bg);
    color: var(--theme-text-primary);
}

/* Card headers no tema escuro - garantir fundo correto */
[data-theme="dark"] .card-header.bg-white {
    background-color: var(--theme-card-header-bg) !important;
}

/* Webhook URL Card no tema escuro */
[data-theme="dark"] .webhook-url-card {
    background: linear-gradient(135deg, var(--theme-bg-secondary) 0%, var(--theme-bg-tertiary) 100%);
}

/* ==========================================
   PERMISSION GROUPS - Tema Escuro
   ========================================== */

.permission-group {
    background-color: var(--theme-card-bg);
    border: 1px solid var(--theme-border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
}

[data-theme="dark"] .permission-group {
    background-color: #242831;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .permission-group:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: #242831;
}

/* Form checks no tema escuro */
[data-theme="dark"] .form-check {
    display: flex;
    align-items: center;
}

[data-theme="dark"] .form-check-label {
    color: var(--theme-text-primary);
    margin-bottom: 0;
    cursor: pointer;
}

[data-theme="dark"] .form-check-input {
    background-color: var(--theme-input-bg);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .form-check-input:checked {
    background-color: #5ba3ff;
    border-color: #5ba3ff;
}

[data-theme="dark"] .form-check-input:focus {
    border-color: #5ba3ff;
    box-shadow: 0 0 0 0.2rem rgba(91, 163, 255, 0.25);
}

/* Permission group checkboxes - melhor espaçamento */
.permission-group .form-check {
    gap: 0.75rem;
    display: flex;
    align-items: center;
}

.permission-group .form-check-input {
    margin-right: 0.5rem;
    margin-top: 0;
}

.permission-group .form-check-label {
    margin-bottom: 0;
    padding-top: 0.25rem;
}

[data-theme="dark"] .permission-group .form-check-label {
    color: var(--theme-text-primary);
}

[data-theme="dark"] .webhook-url-input {
    background-color: var(--theme-input-bg) !important;
    border-color: var(--theme-input-border);
    color: var(--theme-input-text) !important;
}

[data-theme="dark"] .webhook-url-input:focus {
    background-color: var(--theme-bg-tertiary) !important;
}

/* Phone row hover no tema escuro */
[data-theme="dark"] .phone-row:hover {
    background-color: var(--theme-bg-hover);
}

/* bg-white no tema escuro - override geral */
[data-theme="dark"] .bg-white {
    background-color: var(--theme-card-header-bg) !important;
}

/* bg-white dentro de modais e alerts no tema escuro */
[data-theme="dark"] .modal-body .bg-white,
[data-theme="dark"] .alert .bg-white {
    background-color: var(--theme-bg-tertiary) !important;
}

/* bg-light no tema escuro */
[data-theme="dark"] .bg-light {
    background-color: var(--theme-bg-secondary) !important;
}

/* Garantir que table-light funcione no tema escuro */
[data-theme="dark"] .table-light,
[data-theme="dark"] .table-light > th,
[data-theme="dark"] .table-light > td {
    background-color: var(--theme-table-header-bg) !important;
    color: var(--theme-text-primary) !important;
}

/* Corrigir background das células das tabelas para usar cor específica */
[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: #242831 !important;
}

/* Corrigir cores inline hardcoded no tema escuro */
[data-theme="dark"] .stats-label {
    color: var(--theme-text-muted) !important;
}

[data-theme="dark"] .stats-value {
    color: var(--theme-text-primary) !important;
}

/* ========================================
   CORREÇÕES ESPECÍFICAS PARA PÁGINAS
   ========================================== */

/* Document cards - adicionar bordas visíveis no tema escuro */
[data-theme="dark"] .document-item {
    border: 1px solid var(--theme-border-color) !important;
}

/* Integration cards - nomes dos colaboradores em cor clara */
/* Usar seletor mais específico para não sobrescrever classes de utilidade */
[data-theme="dark"] .card-title:not([class*="text-"]) {
    color: var(--theme-text-primary);
}

/* Garantir que textos hardcoded em tabelas sejam claros no tema escuro */
[data-theme="dark"] .table td small:not([class*="text-"]),
[data-theme="dark"] .table td .text-muted {
    color: var(--theme-text-secondary) !important;
}

/* Pre tags (JSON/code displays) no tema escuro */
[data-theme="dark"] pre {
    background-color: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-primary) !important;
    border: 1px solid var(--theme-border-color);
}

/* Modal headers no tema escuro */
[data-theme="dark"] .modal-header {
    background-color: var(--theme-card-header-bg) !important;
    border-bottom-color: var(--theme-border-color);
}

[data-theme="dark"] .modal-header.bg-primary {
    background-color: var(--theme-primary) !important;
}

[data-theme="dark"] .modal-body {
    background-color: var(--theme-card-bg) !important;
}

[data-theme="dark"] .modal-footer {
    background-color: var(--theme-card-bg) !important;
    border-top-color: var(--theme-border-color);
}

[data-theme="dark"] .modal-content {
    background-color: var(--theme-card-bg) !important;
}

/* Corrigir classes de cor do Bootstrap no tema escuro */
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-dark {
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .text-gray-600 {
    color: var(--theme-text-secondary) !important;
}

/* Border classes do Bootstrap */
[data-theme="dark"] .border-left-primary,
[data-theme="dark"] .border-left-success,
[data-theme="dark"] .border-left-info,
[data-theme="dark"] .border-left-warning,
[data-theme="dark"] .border-left-danger {
    border-left-width: 4px;
}

/* Garantir contraste em alerts no tema escuro */
[data-theme="dark"] .alert {
    background-color: var(--theme-bg-secondary);
    color: var(--theme-text-primary);
    border-color: var(--theme-border-color);
}

/* Corrigir botões de paginação no tema escuro */
[data-theme="dark"] .pagination-btn {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border-color) !important;
}

[data-theme="dark"] .pagination-btn:hover {
    background-color: var(--theme-bg-hover) !important;
    color: var(--theme-primary) !important;
}

[data-theme="dark"] .pagination-btn.active {
    background-color: var(--theme-primary) !important;
    color: white !important;
    border-color: var(--theme-primary) !important;
}

/* Corrigir status badges para melhor contraste no tema escuro */
[data-theme="dark"] .status-valido,
[data-theme="dark"] .status-valida,
[data-theme="dark"] .status-ok {
    background-color: rgba(40, 167, 69, 0.2) !important;
    color: var(--theme-success) !important;
    border: 1px solid var(--theme-success);
}

[data-theme="dark"] .status-vencendo {
    background-color: rgba(255, 193, 7, 0.2) !important;
    color: var(--theme-warning) !important;
    border: 1px solid var(--theme-warning);
}

[data-theme="dark"] .status-vencido,
[data-theme="dark"] .status-vencida {
    background-color: rgba(220, 53, 69, 0.2) !important;
    color: var(--theme-danger) !important;
    border: 1px solid var(--theme-danger);
}

[data-theme="dark"] .status-nao-informado,
[data-theme="dark"] .status-sem-documentos,
[data-theme="dark"] .status-inativa {
    background-color: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-muted) !important;
    border: 1px solid var(--theme-border-color);
}

[data-theme="dark"] .status-pendente {
    background-color: rgba(255, 193, 7, 0.2) !important;
    color: var(--theme-warning) !important;
    border: 1px solid var(--theme-warning);
}

/* ==========================================
   SELECT2 - SUPORTE AO TEMA
   ========================================== */

/* Select2 - Tema Claro */
.select2-container--default .select2-selection--single {
    background-color: var(--theme-input-bg) !important;
    border-color: var(--theme-input-border) !important;
    color: var(--theme-input-text) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--theme-input-text) !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--theme-input-placeholder) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--theme-text-muted) transparent transparent transparent !important;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--theme-text-muted) transparent !important;
}

.select2-dropdown {
    background-color: var(--theme-input-bg) !important;
    border-color: var(--theme-input-border) !important;
}

.select2-search--dropdown .select2-search__field {
    background-color: var(--theme-input-bg) !important;
    border-color: var(--theme-input-border) !important;
    color: var(--theme-input-text) !important;
}

.select2-results__option {
    background-color: var(--theme-input-bg) !important;
    color: var(--theme-input-text) !important;
}

.select2-results__option--highlighted {
    background-color: var(--theme-bg-hover) !important;
    color: var(--theme-primary) !important;
}

.select2-results__option--selected {
    background-color: var(--theme-bg-active) !important;
    color: var(--theme-primary) !important;
}

/* Select2 - Focus */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Select2 - Tema Escuro - Overrides específicos */
[data-theme="dark"] .select2-container--default .select2-selection--single {
    background-color: var(--theme-input-bg) !important;
    border-color: var(--theme-input-border) !important;
}

/* ==========================================
   ACCORDION - SUPORTE AO TEMA ESCURO
   ========================================== */

/* Accordion button - tema escuro */
[data-theme="dark"] .accordion-button {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border-color) !important;
}

[data-theme="dark"] .accordion-button:hover {
    background-color: var(--theme-bg-hover) !important;
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: var(--theme-bg-hover) !important;
    color: var(--theme-primary) !important;
    box-shadow: inset 0 -1px 0 var(--theme-border-color);
}

[data-theme="dark"] .accordion-button:not(.collapsed)::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%235ba3ff'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e") !important;
}

/* Accordion body - tema escuro */
[data-theme="dark"] .accordion-body {
    background-color: var(--theme-card-bg) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border-color) !important;
}

/* Accordion item - tema escuro */
[data-theme="dark"] .accordion-item {
    background-color: var(--theme-card-bg) !important;
    border-color: var(--theme-border-color) !important;
}

[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--theme-input-text) !important;
}

[data-theme="dark"] .select2-dropdown {
    background-color: var(--theme-input-bg) !important;
    border-color: var(--theme-input-border) !important;
}

[data-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: var(--theme-bg-tertiary) !important;
    border-color: var(--theme-input-border) !important;
    color: var(--theme-input-text) !important;
}

[data-theme="dark"] .select2-results__option {
    background-color: var(--theme-input-bg) !important;
    color: var(--theme-input-text) !important;
}

[data-theme="dark"] .select2-results__option--highlighted {
    background-color: var(--theme-bg-hover) !important;
    color: var(--theme-primary) !important;
}

[data-theme="dark"] .select2-container--default.select2-container--focus .select2-selection--single,
[data-theme="dark"] .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--theme-primary) !important;
}

/* ==========================================
   DOCUMENTOS SELECIONADOS (NR Selection)
   ========================================== */

/* Item de documento selecionado */
.selected-nr-item {
    background: var(--theme-bg-tertiary);
    border: 1px solid var(--theme-border-light);
    border-radius: 0.375rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--theme-text-primary);
}

/* Botão de remover */
.selected-nr-item .remove-btn {
    background: none;
    border: none;
    color: var(--theme-danger);
    cursor: pointer;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.selected-nr-item .remove-btn:hover {
    color: #a71e2a;
}

/* Card de NR (usado na seleção) */
.nr-card.selected {
    background: var(--theme-bg-active);
    border-color: var(--theme-primary) !important;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

/* Tema escuro - ajustes específicos */
[data-theme="dark"] .selected-nr-item {
    background: var(--theme-bg-tertiary);
    border-color: var(--theme-border-color);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .nr-card.selected {
    background: var(--theme-bg-active);
    border-color: var(--theme-primary) !important;
    box-shadow: 0 4px 15px rgba(19, 55, 90, 0.5);
}
