/*
 * Portal styles that Filament's own stylesheet doesn't cover: the destination switcher and the
 * running-tasks bar. Plain CSS on Filament's colour variables, so it follows light and dark mode
 * without a build step. Published by `php artisan filament:assets`.
 */

/* ── Destination switcher ─────────────────────────────────────────────── */

.sc-switcher__trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
    background: white;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-950);
    max-width: 16rem;
}

.dark .sc-switcher__trigger {
    border-color: rgb(255 255 255 / 0.1);
    background: rgb(255 255 255 / 0.05);
    color: white;
}

.sc-switcher__trigger:hover {
    border-color: var(--primary-500);
}

.sc-switcher__icon,
.sc-switcher__chevron {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    color: var(--gray-400);
}

.sc-switcher__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Running-tasks bar ────────────────────────────────────────────────── */

.fi-body {
    padding-bottom: 2.5rem;
}

.sc-bar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 30;
    font-size: 0.8125rem;
    color: var(--gray-700);
    background: white;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -4px 12px rgb(0 0 0 / 0.04);
}

.dark .sc-bar {
    color: var(--gray-300);
    background: var(--gray-900);
    border-top-color: rgb(255 255 255 / 0.1);
}

.sc-bar__summary {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    height: 2.5rem;
    padding: 0 1rem;
    text-align: start;
    cursor: pointer;
}

.sc-bar__summary:hover {
    background: var(--gray-50);
}

.dark .sc-bar__summary:hover {
    background: rgb(255 255 255 / 0.03);
}

.sc-bar__count {
    font-weight: 600;
    white-space: nowrap;
}

.sc-bar__lead,
.sc-bar__idle {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sc-bar__idle {
    color: var(--gray-500);
}

.sc-bar__chevron {
    width: 1rem;
    height: 1rem;
    margin-inline-start: auto;
    color: var(--gray-400);
}

.sc-bar__panel {
    max-height: min(50vh, 28rem);
    overflow-y: auto;
    border-bottom: 1px solid var(--gray-200);
}

.dark .sc-bar__panel {
    border-bottom-color: rgb(255 255 255 / 0.1);
}

.sc-run {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.dark .sc-run {
    border-bottom-color: rgb(255 255 255 / 0.05);
}

.sc-run--empty {
    color: var(--gray-500);
}

.sc-run__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.375rem 0.625rem;
}

.sc-run__label {
    font-weight: 600;
    color: var(--gray-950);
}

.dark .sc-run__label {
    color: white;
}

.sc-run__label:hover {
    text-decoration: underline;
}

.sc-run__meta,
.sc-run__time,
.sc-run__phase {
    color: var(--gray-500);
}

.sc-run__time {
    margin-inline-start: auto;
    white-space: nowrap;
}

.sc-run__cancel {
    color: var(--danger-600);
    font-weight: 600;
}

.sc-run__cancel:hover {
    text-decoration: underline;
}

.sc-run__phase {
    margin-top: 0.25rem;
}

.sc-run__status {
    font-weight: 700;
    color: var(--success-600);
}

.sc-run.is-failed .sc-run__status,
.sc-run__error {
    color: var(--danger-600);
}

.sc-run__error {
    margin-top: 0.25rem;
    font-family: var(--mono-font-family, ui-monospace, monospace);
    font-size: 0.75rem;
}

.sc-badge {
    padding: 0 0.375rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    line-height: 1.25rem;
    color: var(--gray-600);
    background: var(--gray-100);
}

.dark .sc-badge {
    color: var(--gray-300);
    background: rgb(255 255 255 / 0.08);
}

.sc-progress {
    position: relative;
    height: 0.375rem;
    margin-top: 0.5rem;
    overflow: hidden;
    border-radius: 9999px;
    background: var(--gray-100);
}

.dark .sc-progress {
    background: rgb(255 255 255 / 0.08);
}

.sc-progress__fill {
    height: 100%;
    border-radius: inherit;
    background: var(--primary-600);
    transition: width 0.6s ease;
}

.dark .sc-progress__fill {
    background: var(--primary-400);
}

.sc-progress.is-indeterminate .sc-progress__fill {
    position: absolute;
    width: 30%;
    animation: sc-indeterminate 1.4s ease-in-out infinite;
}

.sc-spinner {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
    border: 2px solid var(--primary-200);
    border-top-color: var(--primary-600);
    border-radius: 9999px;
    animation: sc-spin 0.8s linear infinite;
}

.sc-dot {
    width: 0.5rem;
    height: 0.5rem;
    flex-shrink: 0;
    border-radius: 9999px;
    background: var(--danger-500);
}

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

@keyframes sc-indeterminate {
    from {
        left: -30%;
    }

    to {
        left: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sc-spinner,
    .sc-progress.is-indeterminate .sc-progress__fill {
        animation: none;
    }
}

.fi-topbar .sc-switcher {
    margin-inline-start: 1rem;
}
