/* Modal Styles - LexFlow Theme */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.6);
    /* Overlay suave */
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-bg, #ffffff);
    color: var(--text, #1e293b);
    margin: 8% auto;
    padding: 24px;
    border: 1px solid var(--border, #e2e8f0);
    width: 90%;
    max-width: 850px;
    border-radius: var(--radius, 16px);
    position: relative;
    box-shadow: var(--shadow-lg, 0 20px 25px -5px rgba(0, 0, 0, 0.1));
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary-light, #10b981);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary, #10b981);
}

.close-modal {
    color: var(--secondary, #94a3b8);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--danger, #ef4444);
}

#modalCpfDisplay {
    background: var(--light, #f8fafc);
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 4px solid var(--primary, #10b981);
    font-size: 0.95rem;
    color: var(--dark, #1e293b);
    display: inline-block;
    margin-bottom: 20px;
    font-weight: 700;
}

[data-theme="dark"] #modalCpfDisplay {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text, #f8fafc);
}

/* History Table Styles with High Contrast */
.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border, #e2e8f0);
}

.history-table th {
    background-color: var(--light, #f8fafc);
    color: var(--primary-dark, #059669);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid var(--primary-light, #10b981);
}

.history-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text, #1e293b);
    border-bottom: 1px solid var(--border, #e2e8f0);
    vertical-align: middle;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.history-table tr:hover td {
    background-color: rgba(16, 185, 129, 0.03);
}

[data-theme="dark"] .history-table tr:hover td {
    background-color: rgba(16, 185, 129, 0.05);
}

/* Loader Styles */
.loader {
    border: 3px solid var(--border, #e2e8f0);
    border-radius: 50%;
    border-top: 3px solid var(--primary, #10b981);
    width: 28px;
    height: 28px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Dark Mode Overrides (Explicit) */
[data-theme="dark"] .modal-content {
    background-color: var(--card-bg, #22345a);
    border-color: var(--border, #334155);
}

[data-theme="dark"] .history-table th {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--primary-light, #34d399);
}