/* GCX DASH reconnect / offline shell — light + dark via data-theme / gcx-shell-status--dark. */

.gcx-shell-status {
    --gcx-shell-status-page-a: rgba(0, 177, 184, 0.16);
    --gcx-shell-status-page-b: rgba(3, 64, 147, 0.18);
    --gcx-shell-status-page-gradient: linear-gradient(135deg, #f8fbff 0%, #e2ecf7 100%);
    --gcx-shell-status-text: var(--color-text-primary, #2f546a);
    --gcx-shell-status-text-muted: var(--color-text-secondary, #4a7a95);
    --gcx-shell-status-meta: var(--color-text-muted, #587f9b);
    --gcx-shell-status-eyebrow: var(--color-brand-teal, #006b82);
    --gcx-shell-status-panel-border: var(--color-card-border, rgba(16, 120, 190, 0.16));
    --gcx-shell-status-panel-bg: var(--color-card-bg, #ffffff);
    --gcx-shell-status-panel-shadow:
        0 28px 80px rgba(15, 23, 42, 0.22),
        0 1px 0 rgba(255, 255, 255, 0.72) inset;
    --gcx-shell-status-ring-track: rgba(3, 64, 147, 0.12);
    --gcx-shell-status-ring-a: var(--color-brand-blue-dark, #034093);
    --gcx-shell-status-ring-b: var(--color-brand-teal, #00a7b5);
    --gcx-shell-status-pulse: linear-gradient(135deg, rgba(0, 167, 181, 0.18), rgba(3, 64, 147, 0.18));
    --gcx-shell-status-font-body: var(--font-body, "Lato", "Segoe UI", sans-serif);
    --gcx-shell-status-font-title: var(--font-title, "Montserrat", "Segoe UI", sans-serif);
}

/*
 * Dark palette is applied when:
 * - html has data-theme="dark" (normal DASH preference resolution), or
 * - the modal itself carries gcx-shell-status--dark / data-theme="dark"
 *   (set by dash-theme.js / offline bootstrap — survives when the overlay sits outside themed chrome)
 */
html[data-theme="dark"] .gcx-shell-status,
.gcx-shell-status[data-theme="dark"],
.gcx-shell-status.gcx-shell-status--dark {
    --gcx-shell-status-page-a: rgba(0, 177, 184, 0.14);
    --gcx-shell-status-page-b: rgba(16, 120, 190, 0.22);
    --gcx-shell-status-page-gradient: linear-gradient(135deg, #0b1f30 0%, #0f2a3f 100%);
    --gcx-shell-status-text: var(--color-text-primary, #e4f0f8);
    --gcx-shell-status-text-muted: var(--color-text-secondary, #7ab0cc);
    --gcx-shell-status-meta: var(--color-text-muted, #8fbdd4);
    --gcx-shell-status-eyebrow: var(--color-brand-teal, #00b6d5);
    --gcx-shell-status-panel-border: var(--color-card-border, rgba(255, 255, 255, 0.1));
    --gcx-shell-status-panel-bg: var(--color-card-bg, #0f2a3f);
    --gcx-shell-status-panel-shadow:
        0 28px 80px rgba(0, 0, 0, 0.45),
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
    --gcx-shell-status-ring-track: rgba(148, 163, 184, 0.18);
    --gcx-shell-status-pulse: linear-gradient(135deg, rgba(0, 182, 213, 0.22), rgba(16, 120, 190, 0.28));
}

#components-reconnect-modal.gcx-shell-status {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 18% 18%, var(--gcx-shell-status-page-a), transparent 30%),
        radial-gradient(circle at 82% 12%, var(--gcx-shell-status-page-b), transparent 34%),
        var(--gcx-shell-status-page-gradient);
    color: var(--gcx-shell-status-text);
    font-family: var(--gcx-shell-status-font-body);
    color-scheme: light;
    backdrop-filter: blur(14px);
}

html[data-theme="dark"] #components-reconnect-modal.gcx-shell-status,
#components-reconnect-modal.gcx-shell-status[data-theme="dark"],
#components-reconnect-modal.gcx-shell-status.gcx-shell-status--dark {
    color-scheme: dark;
}

#components-reconnect-modal.gcx-shell-status.components-reconnect-show,
#components-reconnect-modal.gcx-shell-status.components-reconnect-failed,
#components-reconnect-modal.gcx-shell-status.components-reconnect-rejected,
#gcx-idle-session-modal.gcx-shell-status.gcx-shell-status--idle-warn,
#gcx-idle-session-modal.gcx-shell-status.gcx-shell-status--idle-ended {
    display: flex;
}

#gcx-idle-session-modal.gcx-shell-status {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 18% 18%, var(--gcx-shell-status-page-a), transparent 30%),
        radial-gradient(circle at 82% 12%, var(--gcx-shell-status-page-b), transparent 34%),
        var(--gcx-shell-status-page-gradient);
    color: var(--gcx-shell-status-text);
    font-family: var(--gcx-shell-status-font-body);
    color-scheme: light;
    backdrop-filter: blur(14px);
}

html[data-theme="dark"] #gcx-idle-session-modal.gcx-shell-status,
#gcx-idle-session-modal.gcx-shell-status[data-theme="dark"],
#gcx-idle-session-modal.gcx-shell-status.gcx-shell-status--dark {
    color-scheme: dark;
}

.gcx-shell-status__copy--visible,
.gcx-shell-status__actions--visible {
    display: flex;
}

.gcx-shell-status__copy.gcx-shell-status__copy--visible {
    display: block;
}

.gcx-shell-status__button--secondary {
    background: transparent;
    color: var(--gcx-shell-status-text);
    border-color: var(--gcx-shell-status-panel-border);
}

#gcx-idle-session-modal.gcx-shell-status--idle-ended .gcx-shell-status__ring {
    border-color: rgba(220, 38, 38, 0.14);
    border-top-color: #7c3aed;
    border-right-color: #034093;
    animation: none;
}

#gcx-idle-session-modal.gcx-shell-status--idle-warn .gcx-shell-status__ring {
    border-top-color: #d97706;
    border-right-color: #034093;
}

.gcx-shell-status__panel {
    position: relative;
    width: min(100%, 520px);
    overflow: hidden;
    border: 1px solid var(--gcx-shell-status-panel-border);
    border-radius: 28px;
    padding: 28px;
    background: var(--gcx-shell-status-panel-bg);
    box-shadow: var(--gcx-shell-status-panel-shadow);
}

.gcx-shell-status__brand {
    display: flex;
    align-items: center;
    width: fit-content;
    margin: 0 auto 28px;
    border-radius: 16px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #034093 0%, #006b82 100%);
    box-shadow: 0 14px 28px rgba(3, 64, 147, 0.18);
}

.gcx-shell-status__logo {
    width: 150px;
    max-width: 48vw;
    height: 39px;
    object-fit: contain;
    object-position: left center;
}

.gcx-shell-status__visual {
    position: relative;
    display: grid;
    place-items: center;
    width: 108px;
    height: 108px;
    margin: 0 auto 24px;
}

.gcx-shell-status__ring,
.gcx-shell-status__pulse {
    position: absolute;
    border-radius: 999px;
}

.gcx-shell-status__ring {
    width: 86px;
    height: 86px;
    border: 8px solid var(--gcx-shell-status-ring-track);
    border-top-color: var(--gcx-shell-status-ring-a);
    border-right-color: var(--gcx-shell-status-ring-b);
    animation: gcx-shell-status-spin 1.05s linear infinite;
}

.gcx-shell-status__pulse {
    width: 46px;
    height: 46px;
    background: var(--gcx-shell-status-pulse);
    animation: gcx-shell-status-pulse 1.6s ease-in-out infinite;
}

#components-reconnect-modal.components-reconnect-failed .gcx-shell-status__ring,
#components-reconnect-modal.components-reconnect-rejected .gcx-shell-status__ring {
    border-color: rgba(220, 38, 38, 0.14);
    border-top-color: #dc2626;
    border-right-color: #f97316;
}

html[data-theme="dark"] #components-reconnect-modal.components-reconnect-failed .gcx-shell-status__ring,
html[data-theme="dark"] #components-reconnect-modal.components-reconnect-rejected .gcx-shell-status__ring,
#components-reconnect-modal.gcx-shell-status--dark.components-reconnect-failed .gcx-shell-status__ring,
#components-reconnect-modal.gcx-shell-status--dark.components-reconnect-rejected .gcx-shell-status__ring,
#components-reconnect-modal[data-theme="dark"].components-reconnect-failed .gcx-shell-status__ring,
#components-reconnect-modal[data-theme="dark"].components-reconnect-rejected .gcx-shell-status__ring {
    border-color: rgba(248, 113, 113, 0.22);
    border-top-color: #f87171;
    border-right-color: #fb923c;
}

#components-reconnect-modal.components-reconnect-rejected .gcx-shell-status__ring {
    border-top-color: #7c3aed;
    border-right-color: #034093;
}

html[data-theme="dark"] #components-reconnect-modal.components-reconnect-rejected .gcx-shell-status__ring,
#components-reconnect-modal.gcx-shell-status--dark.components-reconnect-rejected .gcx-shell-status__ring,
#components-reconnect-modal[data-theme="dark"].components-reconnect-rejected .gcx-shell-status__ring {
    border-top-color: #a78bfa;
    border-right-color: #38bdf8;
}

.gcx-shell-status__copy {
    display: none;
    text-align: center;
}

#components-reconnect-modal.components-reconnect-show .gcx-shell-status__copy.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed .gcx-shell-status__copy.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected .gcx-shell-status__copy.components-reconnect-rejected {
    display: block;
}

.gcx-shell-status__eyebrow {
    margin: 0 0 8px;
    color: var(--gcx-shell-status-eyebrow);
    font-family: var(--gcx-shell-status-font-body);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.gcx-shell-status__copy h2 {
    margin: 0;
    color: var(--gcx-shell-status-text);
    font-family: var(--gcx-shell-status-font-title);
    font-size: clamp(26px, 4vw, 36px);
    font-weight: 800;
    line-height: 1.12;
}

.gcx-shell-status__copy p:last-child {
    max-width: 420px;
    margin: 12px auto 0;
    color: var(--gcx-shell-status-text-muted);
    font-size: 15px;
    line-height: 1.6;
}

.gcx-shell-status__actions {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}

#components-reconnect-modal.components-reconnect-show .gcx-shell-status__actions,
#components-reconnect-modal.components-reconnect-failed .gcx-shell-status__actions,
#components-reconnect-modal.components-reconnect-rejected .gcx-shell-status__actions {
    display: flex;
}

.gcx-shell-status__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 16px;
    font-family: var(--gcx-shell-status-font-body);
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.gcx-shell-status__button:hover {
    transform: translateY(-1px);
}

.gcx-shell-status__button:focus-visible {
    outline: 3px solid rgba(0, 167, 181, 0.28);
    outline-offset: 3px;
}

.gcx-shell-status__button--primary {
    background: linear-gradient(135deg, #034093 0%, #006b82 100%);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(3, 64, 147, 0.24);
}

.gcx-shell-status__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
    color: var(--gcx-shell-status-meta);
    font-size: 12px;
    font-weight: 600;
}

.gcx-shell-status__meta-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

@keyframes gcx-shell-status-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes gcx-shell-status-pulse {
    0%,
    100% {
        transform: scale(0.82);
        opacity: 0.72;
    }

    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}

@media (max-width: 540px) {
    #components-reconnect-modal.gcx-shell-status {
        padding: 16px;
    }

    .gcx-shell-status__panel {
        border-radius: 22px;
        padding: 24px 20px;
    }

    .gcx-shell-status__brand {
        margin-bottom: 22px;
    }

    .gcx-shell-status__button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gcx-shell-status__ring,
    .gcx-shell-status__pulse,
    .gcx-shell-status__button {
        animation: none;
        transition: none;
    }
}
