/* /Components/ReconnectModal.razor.rz.scp.css */
/* Status pill shown while the live connection is down. ReconnectModal.razor.js sets data-state
   to connecting, retrying, failed or paused, and everything below keys off that attribute. */

.connection-status[b-uc0n43cfki],
.connection-restored[b-uc0n43cfki] {
    /* The theme's status colours are tuned for fills. Mixing in the text colour keeps them
       legible as text and icons on both the light and dark surfaces. */
    --connection-warning: color-mix(in srgb, var(--status-warning) 60%, var(--text-primary));
    --connection-success: color-mix(in srgb, var(--status-success) 70%, var(--text-primary));
}

.connection-status[b-uc0n43cfki] {
    --connection-progress: 1;
    interpolate-size: allow-keywords;
    position: fixed;
    inset: calc(var(--header-height, 56px) + 10px) 0 auto;
    z-index: 2000;
    width: fit-content;
    max-width: calc(100vw - 24px);
    height: auto;
    max-height: none;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background: var(--surface-elevated);
    color: var(--text-primary);
    box-shadow: var(--card-shadow-hover);
    font-family: var(--font-body);
    opacity: 0;
    translate: 0 -8px;
    transition: opacity 0.2s ease, translate 0.2s ease, width 0.4s cubic-bezier(0.3, 0.8, 0.3, 1), border-radius 0.4s ease, display 0.2s allow-discrete, overlay 0.2s allow-discrete;
}

    /* Drops that recover within the delay never show. Keep it in step with revealDelayMs in the script. */
    .connection-status[open][b-uc0n43cfki] {
        opacity: 1;
        translate: none;
        animation: connection-status-enter-b-uc0n43cfki 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.15) 0.5s backwards;
    }

    .connection-status:focus[b-uc0n43cfki],
    .connection-status:focus-visible[b-uc0n43cfki] {
        outline: none;
    }

    /* Literal colours: older browsers do not pass theme variables into ::backdrop. */
    .connection-status[b-uc0n43cfki]::backdrop {
        background-color: rgba(7, 12, 22, 0.16);
        backdrop-filter: grayscale(0.85);
        opacity: 0;
        transition: opacity 0.2s ease, background-color 0.3s ease, display 0.2s allow-discrete, overlay 0.2s allow-discrete;
    }

    .connection-status[open][b-uc0n43cfki]::backdrop {
        opacity: 1;
        animation: connection-status-fade-b-uc0n43cfki 0.35s ease 0.5s backwards;
    }

    .connection-status[data-state="failed"][b-uc0n43cfki] {
        width: 360px;
        border-radius: 14px;
    }

        .connection-status[data-state="failed"][b-uc0n43cfki]::backdrop {
            background-color: rgba(7, 12, 22, 0.32);
        }

    .connection-status:not([data-state="connecting"]) [data-for="connecting"][b-uc0n43cfki],
    .connection-status:not([data-state="retrying"]) [data-for="retrying"][b-uc0n43cfki],
    .connection-status:not([data-state="failed"]) [data-for="failed"][b-uc0n43cfki],
    .connection-status:not([data-state="paused"]) [data-for="paused"][b-uc0n43cfki] {
        display: none;
    }

.connection-status-row[b-uc0n43cfki] {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 16px 0 12px;
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
}

.connection-status[data-state="paused"] .connection-status-row[b-uc0n43cfki] {
    padding-right: 5px;
}

.connection-status[data-state="failed"] .connection-status-row[b-uc0n43cfki] {
    height: 46px;
    padding-left: 14px;
    font-weight: 600;
}

.connection-status-title[b-uc0n43cfki] {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.connection-status-indicator[b-uc0n43cfki] {
    display: grid;
    flex: none;
    place-items: center;
    width: 18px;
    height: 18px;
}

.connection-status-orbit[b-uc0n43cfki] {
    position: relative;
    width: 16px;
    height: 16px;
    animation: connection-status-spin-b-uc0n43cfki 1s linear infinite;
}

    .connection-status-orbit span[b-uc0n43cfki] {
        position: absolute;
        top: 0;
        left: 5px;
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: var(--accent-primary);
    }

        .connection-status-orbit span + span[b-uc0n43cfki] {
            top: auto;
            bottom: 0;
            background: var(--accent-secondary);
        }

.connection-status-beacon[b-uc0n43cfki] {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-warning);
    animation: connection-status-beacon-b-uc0n43cfki 1.6s ease-out infinite;
}

.connection-status-icon[b-uc0n43cfki] {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

    .connection-status-icon.is-warning[b-uc0n43cfki] {
        color: var(--connection-warning);
    }

    .connection-status-icon.is-accent[b-uc0n43cfki] {
        color: var(--accent-primary);
    }

    .connection-status-icon.is-success[b-uc0n43cfki] {
        color: var(--connection-success);
    }

.connection-status-offline[b-uc0n43cfki] {
    color: var(--connection-warning);
}

.connection-status-dot[b-uc0n43cfki] {
    display: inline-block;
    width: 3px;
    height: 3px;
    margin: 0 8px;
    border-radius: 50%;
    background: var(--text-muted);
    vertical-align: middle;
}

.connection-status-seconds[b-uc0n43cfki] {
    font-variant-numeric: tabular-nums;
}

/* Collapsed until reconnecting fails. The zero width stops the hidden text from widening the pill. */
.connection-status-details[b-uc0n43cfki] {
    display: grid;
    grid-template-rows: 0fr;
    width: 0;
    min-width: 100%;
    transition: grid-template-rows 0.4s cubic-bezier(0.3, 0.8, 0.3, 1);
}

    .connection-status-details > div[b-uc0n43cfki] {
        min-height: 0;
        overflow: hidden;
        visibility: hidden;
        transition: visibility 0s linear 0.4s;
    }

    .connection-status-details p[b-uc0n43cfki] {
        margin: -4px 0 0;
        padding: 0 16px 0 42px;
        font-size: 13px;
        line-height: 1.5;
        color: var(--text-secondary);
        white-space: normal;
        text-wrap: pretty;
    }

.connection-status[data-state="failed"] .connection-status-details[b-uc0n43cfki] {
    grid-template-rows: 1fr;
}

    .connection-status[data-state="failed"] .connection-status-details > div[b-uc0n43cfki] {
        visibility: visible;
        transition-delay: 0s;
    }

.connection-status-actions[b-uc0n43cfki] {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 12px 12px;
}

/* The theme's .btn rules leave Bootstrap's state variables alone, so a focused or pressed
   button would otherwise switch to Bootstrap's own colours. */
.connection-status .btn[b-uc0n43cfki] {
    --bs-btn-focus-box-shadow: none;
}

.connection-status .btn-primary[b-uc0n43cfki] {
    --bs-btn-hover-color: var(--text-on-accent);
    --bs-btn-hover-bg: var(--accent-primary-hover);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--text-on-accent);
    --bs-btn-active-bg: var(--accent-primary-hover);
    --bs-btn-active-border-color: transparent;
}

.connection-status .btn-secondary[b-uc0n43cfki] {
    --bs-btn-hover-color: var(--text-primary);
    --bs-btn-hover-bg: var(--border);
    --bs-btn-hover-border-color: var(--border-strong);
    --bs-btn-active-color: var(--text-primary);
    --bs-btn-active-bg: var(--border);
    --bs-btn-active-border-color: var(--border-strong);
}

.connection-status .btn:focus-visible[b-uc0n43cfki] {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.connection-status-progress[b-uc0n43cfki] {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

    .connection-status-progress span[b-uc0n43cfki] {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 40%;
        border-radius: 2px;
        background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    }

.connection-status:is([data-state="connecting"], [data-state="retrying"]) .connection-status-progress[b-uc0n43cfki] {
    opacity: 1;
}

.connection-status[data-state="connecting"] .connection-status-progress span[b-uc0n43cfki] {
    animation: connection-status-sweep-b-uc0n43cfki 1.25s ease-in-out infinite;
}

.connection-status[data-state="retrying"] .connection-status-progress span[b-uc0n43cfki] {
    width: 100%;
    transform-origin: left;
    scale: var(--connection-progress) 1;
    transition: scale 1s linear;
}

/* "Back online" confirmation. It is a separate element so the page is usable again at once. */
.connection-restored[b-uc0n43cfki] {
    position: fixed;
    top: calc(var(--header-height, 56px) + 10px);
    left: 50%;
    z-index: 2000;
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 16px 0 12px;
    border: 1px solid color-mix(in srgb, var(--status-success) 50%, transparent);
    border-radius: 20px;
    background: var(--surface-elevated);
    color: var(--text-primary);
    box-shadow: var(--card-shadow-hover);
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    translate: -50% -8px;
    pointer-events: none;
    transition: opacity 0.25s ease, translate 0.3s ease;
}

    .connection-restored.is-visible[b-uc0n43cfki] {
        opacity: 1;
        translate: -50% 0;
    }

.connection-restored-content[b-uc0n43cfki] {
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes connection-status-enter-b-uc0n43cfki {
    from {
        opacity: 0;
        translate: 0 -14px;
    }
}

@keyframes connection-status-fade-b-uc0n43cfki {
    from {
        opacity: 0;
    }
}

@keyframes connection-status-spin-b-uc0n43cfki {
    to {
        rotate: 360deg;
    }
}

@keyframes connection-status-sweep-b-uc0n43cfki {
    from {
        translate: -100% 0;
    }

    to {
        translate: 250% 0;
    }
}

@keyframes connection-status-beacon-b-uc0n43cfki {
    from {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--status-warning) 55%, transparent);
    }

    to {
        box-shadow: 0 0 0 8px transparent;
    }
}

@media (prefers-reduced-motion: reduce) {
    .connection-status-orbit[b-uc0n43cfki],
    .connection-status-beacon[b-uc0n43cfki],
    .connection-status-progress span[b-uc0n43cfki] {
        animation: none;
    }

    .connection-status[data-state="connecting"] .connection-status-progress span[b-uc0n43cfki] {
        width: 100%;
    }

    .connection-status[b-uc0n43cfki] {
        translate: none;
    }

        .connection-status[open][b-uc0n43cfki] {
            animation-name: connection-status-fade-b-uc0n43cfki;
        }

    .connection-restored[b-uc0n43cfki] {
        translate: -50% 0;
    }
}
