/* Logs tab: reuses the Setup table's filter-bar/table/pager classes
   (iafwzdesk-setup.css) and adds the Logs-specific bits below. */

.iafwzdesk-logs-code-badge {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    background: var(--iafwzdesk-border-300, #f1f2f7);
    color: var(--iafwzdesk-body-text, #4a4f66);
}

.iafwzdesk-logs-code-badge--success {
    background: #e7f7ee;
    color: #138a4b;
}

.iafwzdesk-logs-code-badge--skipped {
    background: #fff4e5;
    color: #b45f06;
}

.iafwzdesk-logs-integration-link {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--iafwzdesk-primary-text, #5b3fe0);
    font-weight: 600;
    text-decoration: none;
}

.iafwzdesk-logs-integration-link:hover {
    color: var(--iafwzdesk-primary-text-hover, #4b31c9);
}

/* ── Row actions: View, Resync, Delete (icon) - buttons as in the design ── */
.iafwzdesk-row-actions .iafwzdesk-logs-action-view,
.iafwzdesk-row-actions .iafwzdesk-setup-action-edit.iafwzdesk-logs-resync-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    margin: 0;
    padding: 0 10px;
    box-sizing: border-box;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.iafwzdesk-row-actions .iafwzdesk-logs-action-view {
    border: 1px solid #e3dcfc;
    background: #f5f2ff;
    color: #5b3fe0;
}

.iafwzdesk-row-actions .iafwzdesk-logs-action-view:hover {
    background: #ebe5ff;
    border-color: #c9bdfb;
    color: #5b3fe0;
}

.iafwzdesk-row-actions .iafwzdesk-setup-action-edit.iafwzdesk-logs-resync-btn {
    border: 1px solid var(--iafwzdesk-border-200, #e4e6ef);
    background: #fff;
    color: #4a4f66;
}

.iafwzdesk-row-actions .iafwzdesk-setup-action-edit.iafwzdesk-logs-resync-btn:hover,
.iafwzdesk-row-actions .iafwzdesk-setup-action-edit.iafwzdesk-logs-resync-btn:focus {
    background: #fff;
    border-color: #c9bdfb;
    color: #6a4cf0;
}

.iafwzdesk-row-actions a.iafwzdesk-logs-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid #f3d0d0;
    border-radius: 8px;
    background: #fff;
    color: #e0393e;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.iafwzdesk-row-actions a.iafwzdesk-logs-delete-btn:hover,
.iafwzdesk-row-actions a.iafwzdesk-logs-delete-btn:focus {
    background: #fff5f5;
    border-color: #e9b4b6;
    color: #d23339;
    outline: none;
}

/* Status: a round badge with a clear check (sent) or cross (failed). */
.iafwzdesk-log-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-sizing: border-box;
}

.iafwzdesk-log-status svg {
    width: 12px;
    height: 12px;
    stroke-width: 3;
}

.iafwzdesk-log-status--ok {
    background: #d9f5e8;
    border: 1px solid #8fdcb9;
    color: #0b8a5a;
}

.iafwzdesk-log-status--skipped {
    background: #fff4e5;
    border: 1px solid #f3cf9b;
    color: #b45f06;
}

.iafwzdesk-log-status--fail {
    background: #fde0e0;
    border: 1px solid #f4a3a6;
    color: #d92d33;
}

/* An action is running (resync / delete through AJAX): dim it and ignore clicks. */

/* A page of logs is being fetched: the table dims and ignores clicks until the new rows arrive. */

.iafwzdesk-pager-gap { display: inline-flex; align-items: center; padding: 0 4px; color: var(--iafwzdesk-muted-text, #8a8fa6); }

/* Page header: Refresh and "Clear All Logs" (red outline, as in the design). */
.iafwzdesk-logs-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.iafwzdesk-logs-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid #f3d0d0;
    border-radius: 10px;
    background: #fff;
    color: #e0393e;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.iafwzdesk-logs-clear-btn:hover {
    background: #fff5f5;
}

.iafwzdesk-status-dot-skipped {
    background: #f59e0b;
}

.iafwzdesk-status-dot-failed {
    background: var(--iafwzdesk-error, #ef4444);
}

/* Logs rows: every cell is centered top to bottom, so text, badges, status and buttons line up. */
#error-log-form .iafwzdesk-setup-table-list tbody td,
#error-log-form .iafwzdesk-setup-table-list thead th {
    vertical-align: middle;
}

#error-log-form .iafwzdesk-setup-table-list tbody td > * {
    vertical-align: middle;
}

#error-log-form .iafwzdesk-setup-table-list tbody td input[type="checkbox"] {
    margin: 0;
    vertical-align: middle;
}

/* View button: spinner in place of the eye until the details popup is open. */
.iafwzdesk-row-actions .iafwzdesk-logs-action-view.iafwzdesk-view-loading {
    pointer-events: none;
    opacity: .85;
}

.iafwzdesk-row-actions .iafwzdesk-logs-action-view.iafwzdesk-view-loading svg {
    display: none;
}

.iafwzdesk-row-actions .iafwzdesk-logs-action-view.iafwzdesk-view-loading::before {
    content: "";
    width: 13px;
    height: 13px;
    box-sizing: border-box;
    border: 2px solid #c9bdfb;
    border-top-color: #5b3fe0;
    border-radius: 50%;
    animation: iafwzdesk-view-spin .7s linear infinite;
}

@keyframes iafwzdesk-view-spin {
    to { transform: rotate(360deg); }
}

/* A page of logs is being fetched (filter, search, sort, paging): the table dims and ignores clicks, with a spinner in the
   middle, until the new rows arrive. */
.iafwzdesk-setup-table-card.iafwzdesk-logs-busy {
    position: relative;
}

.iafwzdesk-setup-table-card.iafwzdesk-logs-busy .iafwzdesk-setup-table-scroll {
    opacity: .55;
    pointer-events: none;
    transition: opacity .15s;
}

.iafwzdesk-setup-table-card.iafwzdesk-logs-busy::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    box-sizing: border-box;
    border: 3px solid #e3dcfc;
    border-top-color: #5b3fe0;
    border-radius: 50%;
    animation: iafwzdesk-view-spin .7s linear infinite;
}

/* Resync (row link or bulk-bar button) while its request runs: it dims, ignores clicks, and its refresh icon rotates. */
a.iafwzdesk-logs-resync-btn.iafwzdesk-logs-busy,
.iafwzdesk-bulkbar-btn.iafwzdesk-logs-busy {
    opacity: .55;
    pointer-events: none;
}

.iafwzdesk-btn-loading {
    pointer-events: none;
}

.iafwzdesk-btn-loading > svg {
    animation: iafwzdesk-view-spin .8s linear infinite;
}
