/*
 * Shared UI components — charter Wave 1 (trust, state and safety).
 * State cards, spinner, busy buttons, toasts and the destructive-action
 * hierarchy. Uses design-system tokens only; loaded after the page stylesheet.
 */

/* ---- State cards (loading / empty / no-config / stale / denied / error) ---- */

.sv-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 28px 20px;
    border-radius: var(--radius-s);
    background: var(--surface-1);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.sv-state__title {
    font-weight: var(--fw-semibold);
    font-size: var(--fs-card);
    line-height: var(--lh-card);
    color: var(--text-primary);
}

.sv-state__message {
    font-size: var(--fs-label);
    line-height: var(--lh-label);
    color: var(--text-secondary);
    max-width: 46ch;
}

.sv-state__actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.sv-state--error { border-color: rgba(220, 38, 38, 0.35); }
.sv-state--error .sv-state__title { color: var(--status-danger); }

.sv-state--denied { border-color: rgba(234, 88, 12, 0.35); }
.sv-state--denied .sv-state__title { color: var(--status-warn); }

.sv-state--stale { border-color: rgba(234, 88, 12, 0.3); }
.sv-state--stale .sv-state__title { color: var(--status-warn); }

.sv-state--success .sv-state__title { color: var(--status-ok); }

/* ---- Spinner and busy buttons ---- */

.sv-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--accent-tint);
    border-top-color: var(--accent);
    animation: sv-spin 0.8s linear infinite;
}

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

.sv-btn-busy {
    cursor: progress;
    opacity: 0.75;
}

/* ---- Toasts ---- */

.sv-toast-host {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.sv-toast {
    padding: 10px 18px;
    border-radius: var(--radius-12);
    background: var(--glass-bg-strong);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    font-size: var(--fs-label);
    font-weight: var(--fw-medium);
    max-width: min(90vw, 480px);
}

.sv-toast--err {
    border-color: rgba(220, 38, 38, 0.4);
    color: var(--status-danger);
}

/* ---- Destructive-action hierarchy ----
   Cancel/remove actions must not look like the primary "Complete" action:
   they render as quiet, warning-coloured secondary buttons. */

.btn.btn-cancel-request,
.task-action-btn.btn-cancel-request,
.btn-destructive {
    background: transparent;
    color: var(--status-danger);
    border: 1px solid rgba(220, 38, 38, 0.35);
    box-shadow: none;
}

.btn.btn-cancel-request:hover,
.task-action-btn.btn-cancel-request:hover,
.btn-destructive:hover {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.55);
    box-shadow: none;
    transform: none;
}
