/* Audit Logs — gaveta de detalhe, seguindo o tema light do app (variables.css / themes/light.css) */

.audit-log-offcanvas {
    background-color: var(--background-color);
}

.audit-log-offcanvas .offcanvas-header {
    background-color: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}

.audit-log-offcanvas .offcanvas-title {
    color: var(--text-color);
    font-weight: 600;
}

.audit-log-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background-color: var(--background-color);
    border-bottom: 1px solid var(--divider-color);
}

.audit-log-raw-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
}

.audit-log-raw-toggle .form-check-label {
    color: var(--text-color);
    font-size: 13px;
    user-select: none;
}

.audit-log-raw-toggle .form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.audit-log-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.audit-log-body {
    flex: 1;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.audit-log-status {
    padding: 24px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-color);
    font-size: 14px;
}

.audit-log-status.audit-log-error {
    color: #dc3545;
}

.audit-log-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 20px;
    padding: 14px;
    background-color: var(--background-color);
    border-bottom: 1px solid var(--divider-color);
    font-size: 13px;
}

.audit-log-summary-item {
    display: flex;
    gap: 6px;
    overflow: hidden;
}

.audit-log-summary-label {
    color: var(--text-color);
    font-weight: 600;
    white-space: nowrap;
}

.audit-log-summary-value {
    color: var(--text-color);
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audit-log-action-created { color: #198754; font-weight: 600; }
.audit-log-action-updated { color: var(--primary-color); font-weight: 600; }
.audit-log-action-deleted { color: #dc3545; font-weight: 600; }

.audit-log-json {
    margin: 0;
    padding: 14px;
    color: var(--text-color);
    font-family: 'Courier New', Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.audit-log-json .json-key { color: var(--primary-color); font-weight: 600; }
.audit-log-json .json-string { color: #198754; }
.audit-log-json .json-number { color: #b8860b; }
.audit-log-json .json-boolean { color: #6f42c1; }
.audit-log-json .json-null { color: #999999; font-style: italic; }

.audit-log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.audit-log-table thead th {
    position: sticky;
    top: 0;
    text-align: left;
    padding: 10px 14px;
    background-color: var(--background-color);
    color: var(--text-color);
    border-bottom: 1px solid var(--divider-color);
    font-weight: 600;
    z-index: 1;
}

.audit-log-table tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--divider-color);
    vertical-align: top;
    word-break: break-word;
    white-space: pre-wrap;
    color: var(--text-color);
}

.audit-log-table tbody tr:hover td {
    background-color: #f7f7f7;
}

.audit-log-table .col-field {
    font-weight: 600;
    width: 30%;
}

.audit-log-table .col-before {
    color: #dc3545;
    width: 35%;
}

.audit-log-table .col-after {
    color: #198754;
    width: 35%;
}

.audit-log-muted {
    color: var(--text-color);
    opacity: 0.65;
    font-style: italic;
}

/* Impressão — só a gaveta de detalhes vai para o papel, sem o resto da página.
   O tema em tela já é claro, então o print só precisa esconder o que não deve
   ser impresso (toolbar, botão de fechar) e liberar a altura/overflow. */
@media print {
    body * {
        visibility: hidden !important;
    }

    #auditLogDetailOffcanvas,
    #auditLogDetailOffcanvas * {
        visibility: visible !important;
    }

    #auditLogDetailOffcanvas {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        transform: none !important;
        box-shadow: none !important;
        background-color: #fff !important;
    }

    #auditLogDetailOffcanvas .offcanvas-body {
        height: auto !important;
        overflow: visible !important;
    }

    .audit-log-toolbar,
    #auditLogDetailOffcanvas .btn-close,
    .offcanvas-backdrop {
        display: none !important;
    }

    .audit-log-body {
        height: auto !important;
        overflow: visible !important;
    }

    .audit-log-table thead th {
        position: static !important;
    }

    .audit-log-table tbody td {
        white-space: normal !important;
    }

    .audit-log-summary-value {
        white-space: normal !important;
    }
}
