/* Melhorias para tabelas do Filament */

/* Garantir quebra de linha em colunas de texto com melhor aproveitamento do espaço */
.fi-ta-text {
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal !important;
    max-width: 500px;
    min-width: 200px;
}

/* Melhorar exibição de colunas com wrap */
.fi-ta-text-item-wrap {
    white-space: normal !important;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.5;
}

/* Seletores mais específicos para tabelas de relação */
.fi-ta-table .fi-ta-text,
[data-field-wrapper] .fi-ta-text {
    max-width: 500px !important;
    min-width: 200px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

/* Garantir que tooltips funcionem corretamente */
.fi-ta-text[title] {
    cursor: help;
}

/* Melhorar espaçamento em células da tabela */
.fi-ta-cell {
    padding: 12px 16px;
    vertical-align: top;
}

/* Coluna de descrição com largura flexível */
.fi-ta-table th:nth-child(2),
.fi-ta-table td:nth-child(2) {
    width: 50%;
    max-width: 500px;
    min-width: 300px;
}

/* Outras colunas com largura controlada */
.fi-ta-table th:not(:nth-child(2)),
.fi-ta-table td:not(:nth-child(2)) {
    width: auto;
    white-space: nowrap;
}

/* Seletores específicos para relation managers */
.fi-ta-relation-manager .fi-ta-text {
    max-width: 500px !important;
    min-width: 250px !important;
}

/* Estilo para upload de arquivos */
.fi-fo-file-upload {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.fi-fo-file-upload:hover {
    border-color: #6366f1;
}

/* Melhorar exibição de ícones de anexo */
.fi-ta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Responsividade para tabelas */
@media (max-width: 1024px) {
    .fi-ta-text,
    .fi-ta-table .fi-ta-text,
    [data-field-wrapper] .fi-ta-text {
        max-width: 400px !important;
        min-width: 150px !important;
    }

    .fi-ta-table th:nth-child(2),
    .fi-ta-table td:nth-child(2) {
        width: 40%;
        max-width: 400px;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .fi-ta-text,
    .fi-ta-table .fi-ta-text,
    [data-field-wrapper] .fi-ta-text {
        max-width: 300px !important;
        min-width: 120px !important;
        font-size: 14px;
    }

    .fi-ta-table th:nth-child(2),
    .fi-ta-table td:nth-child(2) {
        width: 35%;
        max-width: 300px;
        min-width: 150px;
    }
}

/* Estilo para modais de detalhes */
.fi-modal-content {
    max-width: 90vw;
}

.fi-modal-content .whitespace-pre-line {
    white-space: pre-line;
    word-wrap: break-word;
    line-height: 1.6;
}

/* ===== FILAMENT DARK MODE ESPECÍFICO ===== */

/* Modais customizados não-Filament */
.dark .whatsapp-modal {
    background-color: rgba(0, 0, 0, 0.85) !important;
}

.dark .whatsapp-modal-content,
.dark .bg-white.rounded-lg.shadow-xl {
    background-color: #1a202c !important;
    color: #f7fafc !important;
    border: 1px solid #4a5568 !important;
}

/* Títulos em modais customizados */
.dark .whatsapp-modal h3,
.dark .bg-white h3,
.dark .text-lg.font-bold {
    color: #f7fafc !important;
}

/* Labels em modais customizados */
.dark .whatsapp-modal label,
.dark .bg-white label,
.dark .text-sm.font-medium {
    color: #f7fafc !important;
}

/* Inputs em modais customizados */
.dark .whatsapp-modal input,
.dark .whatsapp-modal textarea,
.dark .whatsapp-modal select,
.dark .bg-white input,
.dark .bg-white textarea,
.dark .bg-white select {
    background-color: #374151 !important;
    color: #f7fafc !important;
    border-color: #4a5568 !important;
}

/* Placeholders em modais customizados */
.dark .whatsapp-modal input::placeholder,
.dark .whatsapp-modal textarea::placeholder,
.dark .bg-white input::placeholder,
.dark .bg-white textarea::placeholder {
    color: #a0aec0 !important;
}

/* Botões em modais customizados */
.dark .whatsapp-modal button,
.dark .bg-white button {
    border-color: #4a5568 !important;
}

/* Botões secundários */
.dark .bg-gray-300 {
    background-color: #374151 !important;
    color: #f7fafc !important;
}

.dark .bg-gray-300:hover {
    background-color: #4a5568 !important;
}

.dark .text-gray-700 {
    color: #e2e8f0 !important;
}

/* Lista de contatos em dropdown */
.dark .absolute.z-10.bg-white {
    background-color: #1a202c !important;
    color: #f7fafc !important;
    border-color: #4a5568 !important;
}

.dark .absolute.z-10.bg-white li {
    color: #f7fafc !important;
}

.dark .absolute.z-10.bg-white li:hover {
    background-color: #374151 !important;
}

/* Textos cinza em geral */
.dark .text-gray-600,
.dark .text-gray-500 {
    color: #e2e8f0 !important;
}

/* Ícones em modais */
.dark .text-gray-400 {
    color: #a0aec0 !important;
}

/* Botões de fechar */
.dark .text-gray-400:hover {
    color: #f7fafc !important;
}

/* ===== FILAMENT INFOLIST ESPECÍFICO ===== */
.dark .fi-in-entry-wrp {
    background-color: #4a5568 !important;
    color: #f7fafc !important;
}

.dark .fi-in-entry-wrp-label {
    color: #f7fafc !important;
}

.dark .fi-in-entry-wrp-content {
    color: #e2e8f0 !important;
}

/* ===== FILAMENT SECTION ESPECÍFICO ===== */
.dark .fi-section-header-heading {
    color: #f7fafc !important;
}

.dark .fi-section-header-description {
    color: #e2e8f0 !important;
}

/* ===== FILAMENT CARDS ESPECÍFICO ===== */
.dark .fi-card-header {
    background-color: #4a5568 !important;
    color: #f7fafc !important;
    border-color: #4a5568 !important;
}

.dark .fi-card-body {
    background-color: #4a5568 !important;
    color: #f7fafc !important;
}

/* ===== ANEXOS ESPECÍFICO ===== */
.dark .fi-section-content-ctn,
.dark .fi-section-content {
    background-color: #4a5568 !important;
    color: #f7fafc !important;
}

/* Lista de arquivos anexados */
.dark .fi-section-content .text-sm {
    color: #e2e8f0 !important;
}

.dark .fi-section-content .text-gray-500 {
    color: #a0aec0 !important;
}

/* ===== FORCE OVERRIDES MAIS ESPECÍFICOS ===== */
.dark .bg-white.rounded-lg.shadow-xl.w-full.max-w-md {
    background-color: #1a202c !important;
    color: #f7fafc !important;
    border: 1px solid #4a5568 !important;
}

.dark .bg-white.rounded-lg.shadow-xl .p-6 {
    background-color: #1a202c !important;
    color: #f7fafc !important;
}

/* Garantir que todos os textos em modais sejam visíveis */
.dark [class*="modal"] *,
.dark [class*="popup"] * {
    color: inherit !important;
}

/* Garantir que inputs em modais tenham contraste adequado */
.dark [class*="modal"] input,
.dark [class*="modal"] textarea,
.dark [class*="modal"] select,
.dark [class*="popup"] input,
.dark [class*="popup"] textarea,
.dark [class*="popup"] select {
    background-color: #374151 !important;
    color: #f7fafc !important;
    border-color: #4a5568 !important;
}

/* CORREÇÃO MODERADA PARA ÍCONES */
/* Garantir que ícones SVG tenham tamanho adequado sem quebrar o layout */
.fi-icon svg,
.fi-btn-icon svg,
.fi-ta-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* Ícones menores para ações específicas */
.fi-ta-actions-item svg,
.fi-ac-btn-group svg,
.fi-dropdown-item svg {
    width: 1rem;
    height: 1rem;
}

/* Garantir alinhamento correto dos ícones sem forçar demais */
.fi-icon,
.fi-btn-icon,
.fi-ta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
