/* CllrWay reconnect dialog. Plain global CSS (the app does not link the scoped-CSS bundle).
   Driven by the state classes Blazor sets on #components-reconnect-modal:
   components-reconnect-show | -retrying | -failed | -paused | -resume-failed | -rejected */

#components-reconnect-modal {
    box-sizing: border-box;
    width: min(22rem, calc(100vw - 2rem));
    max-width: 100%;
    margin: auto;
    padding: 1.5rem 1.5rem 1.25rem;
    border: 0;
    border-top: 4px solid var(--mud-palette-primary, #1976d2);
    border-radius: 12px;
    background: #fff;
    color: #263238;
    font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .25), 0 2px 6px rgba(0, 0, 0, .15);
}

#components-reconnect-modal::backdrop {
    background: rgba(13, 34, 64, .45);
}

#components-reconnect-modal[open] {
    animation: cw-reconnect-in .2s ease-out;
}

@keyframes cw-reconnect-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.cw-reconnect {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    text-align: center;
}

.cw-reconnect-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--mud-palette-primary, #1976d2);
}

.cw-reconnect p {
    margin: 0;
    font-size: .92rem;
    line-height: 1.45;
    color: #455a64;
}

/* Every state-specific element is hidden until its state class is present. */
.cw-state {
    display: none;
}

#components-reconnect-modal.components-reconnect-show .cw-state-show,
#components-reconnect-modal.components-reconnect-retrying .cw-state-retrying,
#components-reconnect-modal.components-reconnect-failed .cw-state-failed,
#components-reconnect-modal.components-reconnect-paused .cw-state-paused,
#components-reconnect-modal.components-reconnect-resume-failed .cw-state-resume-failed,
#components-reconnect-modal.components-reconnect-rejected .cw-state-rejected {
    display: block;
}

/* Spinner while connecting / retrying */
.cw-reconnect-spinner {
    display: none;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(25, 118, 210, .2);
    border-top-color: var(--mud-palette-primary, #1976d2);
    border-radius: 50%;
    animation: cw-reconnect-spin .9s linear infinite;
}

#components-reconnect-modal.components-reconnect-show .cw-reconnect-spinner,
#components-reconnect-modal.components-reconnect-retrying .cw-reconnect-spinner {
    display: block;
}

@keyframes cw-reconnect-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .cw-reconnect-spinner { animation-duration: 3s; }
    #components-reconnect-modal[open] { animation: none; }
}

/* Buttons */
.cw-reconnect-actions {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin-top: .25rem;
}

#components-reconnect-modal.components-reconnect-failed .cw-actions-failed,
#components-reconnect-modal.components-reconnect-paused .cw-actions-paused,
#components-reconnect-modal.components-reconnect-resume-failed .cw-actions-resume-failed,
#components-reconnect-modal.components-reconnect-rejected .cw-actions-resume-failed {
    display: flex;
}

#components-reconnect-modal .cw-reconnect-btn {
    min-height: 40px;
    padding: 0 1.25rem;
    border: 1px solid var(--mud-palette-primary, #1976d2);
    border-radius: 6px;
    background: #fff;
    color: var(--mud-palette-primary, #1976d2);
    font: inherit;
    font-size: .85rem;
    font-weight: 500;
    letter-spacing: .03em;
    text-transform: uppercase;
    cursor: pointer;
}

#components-reconnect-modal .cw-reconnect-btn:hover {
    background: rgba(25, 118, 210, .08);
}

#components-reconnect-modal .cw-reconnect-btn:focus-visible {
    outline: 2px solid var(--mud-palette-primary, #1976d2);
    outline-offset: 2px;
}

#components-reconnect-modal .cw-reconnect-btn:disabled {
    opacity: .6;
    cursor: default;
}

#components-reconnect-modal .cw-reconnect-btn--primary {
    background: var(--mud-palette-primary, #1976d2);
    color: #fff;
}

#components-reconnect-modal .cw-reconnect-btn--primary:hover {
    background: #1565c0;
}
