/* ==========================================================================
   BIDA Omnea Transactions Plugin – transactions.css
   ========================================================================== */

/* ── Root variables ────────────────────────────────────────────────────── */
.bot-container {
    --bot-primary:    #0d6efd;
    --bot-primary-dk: #0b5ed7;
    --bot-success:    #198754;
    --bot-danger:     #dc3545;
    --bot-warning:    #fd7e14;
    --bot-neutral:    #6c757d;
    --bot-bg:         #ffffff;
    --bot-bg-alt:     #f8f9fa;
    --bot-border:     #dee2e6;
    --bot-text:       #212529;
    --bot-text-muted: #6c757d;
    --bot-radius:     6px;
    --bot-font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    font-family: var(--bot-font);
    font-size: 14px;
    color: var(--bot-text);
    line-height: 1.5;
    max-width: 100%;
    margin: 0 0 32px;
}

/* ── Notices ───────────────────────────────────────────────────────────── */
.bot-notice {
    padding: 12px 16px;
    border-radius: var(--bot-radius);
    margin-bottom: 16px;
    border-left: 4px solid transparent;
}
.bot-notice--error {
    background: #fff5f5;
    border-color: var(--bot-danger);
    color: #842029;
}
.bot-notice--warning {
    background: #fff8f0;
    border-color: var(--bot-warning);
    color: #784212;
}

/* ── Filter bar ────────────────────────────────────────────────────────── */
.bot-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 16px;
    background: var(--bot-bg-alt);
    border: 1px solid var(--bot-border);
    border-radius: var(--bot-radius);
    margin-bottom: 16px;
}

.bot-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bot-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--bot-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bot-input {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--bot-border);
    border-radius: var(--bot-radius);
    font-size: 14px;
    color: var(--bot-text);
    background: var(--bot-bg);
    outline: none;
    transition: border-color 0.15s;
}
.bot-input:focus {
    border-color: var(--bot-primary);
    box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

.bot-filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-top: 20px; /* align with inputs */
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.bot-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    height: 36px;
    border-radius: var(--bot-radius);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.bot-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.bot-btn--primary {
    background: var(--bot-primary);
    color: #fff;
    border-color: var(--bot-primary);
}
.bot-btn--primary:hover:not(:disabled) {
    background: var(--bot-primary-dk);
    border-color: var(--bot-primary-dk);
}
.bot-btn--ghost {
    background: transparent;
    color: var(--bot-text-muted);
    border-color: var(--bot-border);
}
.bot-btn--ghost:hover:not(:disabled) {
    background: var(--bot-bg-alt);
    color: var(--bot-text);
}

/* ── Summary bar ───────────────────────────────────────────────────────── */
.bot-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--bot-text-muted);
    margin-bottom: 12px;
    padding: 0 2px;
}
.bot-summary-item {
    font-weight: 500;
    color: var(--bot-text);
}
.bot-summary-sep {
    color: var(--bot-border);
}

/* ── Loading spinner ───────────────────────────────────────────────────── */
.bot-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
    color: var(--bot-text-muted);
    font-size: 14px;
}
.bot-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bot-border);
    border-top-color: var(--bot-primary);
    border-radius: 50%;
    animation: bot-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes bot-spin {
    to { transform: rotate(360deg); }
}

/* ── Data table ────────────────────────────────────────────────────────── */
.bot-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--bot-border);
    border-radius: var(--bot-radius);
    margin-bottom: 12px;
}

.bot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--bot-bg);
    white-space: nowrap;
}

.bot-table thead th {
    padding: 10px 14px;
    background: var(--bot-bg-alt);
    border-bottom: 2px solid var(--bot-border);
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--bot-text-muted);
}

.bot-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--bot-border);
    vertical-align: middle;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bot-table tbody tr:last-child td {
    border-bottom: none;
}
.bot-table tbody tr:hover td {
    background: #f0f6ff;
}

/* Sortable column headers */
.bot-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.bot-sortable:hover {
    color: var(--bot-primary);
    background: #edf2ff;
}
.bot-sortable.bot-sorted-asc,
.bot-sortable.bot-sorted-desc {
    color: var(--bot-primary);
}
.bot-sort-icon {
    font-size: 10px;
    opacity: 0.6;
    margin-left: 2px;
}

/* Amount column */
.bot-col-amount {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}

/* Amount colouring */
.bot-amount-credit {
    color: var(--bot-success);
    font-weight: 600;
}
.bot-amount-debit {
    color: var(--bot-danger);
    font-weight: 600;
}

/* Reference cell */
.bot-ref {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    color: var(--bot-text-muted);
    max-width: 200px;
}

/* ── Badge styles ──────────────────────────────────────────────────────── */
.bot-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* Status badges */
.bot-status-success {
    background: #d1e7dd;
    color: #0a3622;
}
.bot-status-danger {
    background: #f8d7da;
    color: #58151c;
}
.bot-status-warning {
    background: #ffe5d0;
    color: #6c3800;
}
.bot-status-default {
    background: #e9ecef;
    color: #495057;
}

/* Transaction type badge */
.bot-type-badge {
    background: #e8f0fe;
    color: #1a56db;
}

/* ── Load more ─────────────────────────────────────────────────────────── */
.bot-load-more-wrap {
    text-align: center;
    margin-bottom: 12px;
}

/* ── Empty state ───────────────────────────────────────────────────────── */
.bot-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--bot-text-muted);
    text-align: center;
}
.bot-empty svg {
    opacity: 0.3;
}
.bot-empty p {
    margin: 0;
    font-size: 15px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .bot-filters {
        flex-direction: column;
        align-items: stretch;
    }
    .bot-filter-actions {
        padding-top: 0;
        flex-direction: column;
    }
    .bot-btn {
        justify-content: center;
        width: 100%;
    }
}
