/**
 * OSGB shared UI components — Faz 5
 * Toast, empty, skeleton, badge, status
 */

/* Status badge */
.osgb-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-xs, 4px);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.3;
    border: 1px solid transparent;
    white-space: nowrap;
}
.osgb-badge__dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.osgb-badge--success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.osgb-badge--warning {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}
.osgb-badge--danger {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}
.osgb-badge--muted {
    color: #475569;
    background: #f8fafc;
    border-color: #e2e8f0;
}
.osgb-badge--info {
    color: #075985;
    background: #f0f9ff;
    border-color: #bae6fd;
}
[data-theme="dark"] .osgb-badge--success { color: #86efac; background: rgba(22, 163, 74, 0.15); border-color: rgba(134, 239, 172, 0.25); }
[data-theme="dark"] .osgb-badge--warning { color: #fcd34d; background: rgba(217, 119, 6, 0.15); border-color: rgba(252, 211, 77, 0.25); }
[data-theme="dark"] .osgb-badge--danger { color: #fca5a5; background: rgba(220, 38, 38, 0.15); border-color: rgba(252, 165, 165, 0.25); }
[data-theme="dark"] .osgb-badge--muted { color: #94a3b8; background: rgba(148, 163, 184, 0.1); border-color: rgba(148, 163, 184, 0.2); }
[data-theme="dark"] .osgb-badge--info { color: #7dd3fc; background: rgba(2, 132, 200, 0.15); border-color: rgba(125, 211, 252, 0.25); }

/* Empty state */
.osgb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1.25rem;
    color: var(--muted, #64748b);
    gap: 0.35rem;
}
.osgb-empty__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text, #0f172a);
}
.osgb-empty__desc {
    margin: 0;
    font-size: 0.8125rem;
    max-width: 22rem;
    line-height: 1.45;
}

/* Skeleton */
.osgb-skeleton {
    display: block;
    background: linear-gradient(90deg, var(--surface-muted, #f1f5f9) 25%, var(--panel2, #f8fafc) 50%, var(--surface-muted, #f1f5f9) 75%);
    background-size: 200% 100%;
    animation: osgb-skel 1.2s ease-in-out infinite;
    border-radius: var(--radius-sm, 6px);
}
.osgb-skeleton--line { height: 0.75rem; width: 100%; }
.osgb-skeleton--title { height: 1rem; width: 40%; margin-bottom: 0.5rem; }
.osgb-skeleton--row { height: 2.25rem; width: 100%; margin-bottom: 0.35rem; }
@keyframes osgb-skel {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Toast host */
#osgb-toast-host {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-width: min(22rem, calc(100vw - 2rem));
    pointer-events: none;
}
.osgb-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.65rem 0.75rem;
    background: var(--panel, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(15, 23, 42, 0.08));
    font-size: 0.8125rem;
    color: var(--text, #0f172a);
    animation: osgb-toast-in 180ms ease;
}
.osgb-toast--success { border-left: 3px solid var(--success, #16a34a); }
.osgb-toast--error { border-left: 3px solid var(--danger, #dc2626); }
.osgb-toast--info { border-left: 3px solid var(--info, #0284c8); }
.osgb-toast__msg { flex: 1; min-width: 0; line-height: 1.4; }
.osgb-toast__close {
    border: 0;
    background: transparent;
    color: var(--muted, #64748b);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
}
@keyframes osgb-toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Segmented control / filter pills */
.osgb-seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.2rem;
    background: var(--surface-muted, #f1f5f9);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-md, 8px);
}
.osgb-seg__btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted, #64748b);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 550;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}
.osgb-seg__btn:hover {
    color: var(--text, #0f172a);
    background: color-mix(in srgb, var(--panel, #fff) 70%, transparent);
}
.osgb-seg__btn.is-active {
    background: var(--panel, #fff);
    color: var(--text, #0f172a);
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(15, 23, 42, 0.04));
}
.osgb-seg__count {
    margin-left: 0.2rem;
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
}
