/* ==========================================================================
   BluePoint Startup Shell
   Premium loading experience shown while the Blazor circuit establishes.
   Brand palette: #1B4796 (primary), #00A7D8 (accent), #112c53 (deep navy)
   ========================================================================== */

/* --- Keyframes ------------------------------------------------------- */

@keyframes bpt-shell-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes bpt-shell-card-enter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes bpt-shell-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes bpt-shell-glow-pulse {
    0%, 100% { opacity: 0.45; transform: scale(1); }
    50%      { opacity: 0.7;  transform: scale(1.12); }
}

@keyframes bpt-shell-brand-breathe {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
    50%      { transform: scale(1.04); filter: drop-shadow(0 4px 20px rgba(0, 167, 216, 0.25)); }
}

@keyframes bpt-shell-dots {
    0%, 80%, 100% { opacity: 0; transform: scale(0.6); }
    40%           { opacity: 1; transform: scale(1); }
}

/* --- Full-screen overlay --------------------------------------------- */

.bpt-startup-shell {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
    color: #112c53;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(27, 71, 150, 0.09), transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(0, 167, 216, 0.06), transparent 50%),
        linear-gradient(168deg, #f8fafd 0%, #edf2f9 48%, #e8eef6 100%);
    animation: bpt-shell-fade-in 400ms ease-out both;
    transition: opacity 260ms cubic-bezier(0.4, 0, 0.2, 1),
                visibility 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Subtle ambient glow behind the card */
.bpt-startup-shell::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 167, 216, 0.12) 0%, transparent 70%);
    pointer-events: none;
    animation: bpt-shell-glow-pulse 4s ease-in-out infinite;
}

.bpt-startup-shell--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* --- Card ------------------------------------------------------------ */

.bpt-startup-shell__card {
    position: relative;
    width: min(100%, 26rem);
    padding: 2.5rem 2rem 2rem;
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid rgba(27, 71, 150, 0.08);
    box-shadow:
        0 1px 2px rgba(27, 71, 150, 0.04),
        0 4px 12px rgba(27, 71, 150, 0.06),
        0 24px 64px -12px rgba(27, 71, 150, 0.12);
    text-align: center;
    animation: bpt-shell-card-enter 500ms cubic-bezier(0.16, 1, 0.3, 1) 120ms both;
}

/* Decorative top-edge accent line */
.bpt-startup-shell__card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 56%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, #1B4796 0%, #00A7D8 50%, #4FC3F7 100%);
    opacity: 0.85;
}

/* --- Brand logo ------------------------------------------------------ */

.bpt-startup-shell__brand {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.bpt-startup-shell__brand img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    animation: bpt-shell-brand-breathe 3s ease-in-out infinite;
}

/* --- Typography ------------------------------------------------------ */

.bpt-startup-shell__title {
    margin: 0 0 0.35rem;
    font-size: 1.65rem;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #112c53 30%, #1B4796 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bpt-startup-shell__status {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    font-weight: 450;
    color: rgba(17, 44, 83, 0.82);
}

.bpt-startup-shell__hint {
    margin: 0.65rem 0 1.5rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(17, 44, 83, 0.52);
}

/* --- Loading indicator (shimmer bar) --------------------------------- */

.bpt-startup-shell__card::after {
    content: "";
    display: block;
    margin: 1.5rem auto 0;
    width: 60%;
    height: 3px;
    border-radius: 3px;
    background:
        linear-gradient(90deg,
            rgba(27, 71, 150, 0.08) 0%,
            rgba(0, 167, 216, 0.35) 40%,
            rgba(79, 195, 247, 0.45) 50%,
            rgba(0, 167, 216, 0.35) 60%,
            rgba(27, 71, 150, 0.08) 100%);
    background-size: 200% 100%;
    animation: bpt-shell-shimmer 2s ease-in-out infinite;
}

/* Hide shimmer in error state */
.bpt-startup-shell[data-state="error"] .bpt-startup-shell__card::after {
    display: none;
}

/* --- Retry button ---------------------------------------------------- */

.bpt-startup-shell__retry {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 0;
    border-radius: 999px;
    padding: 0.75rem 2rem;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.015em;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #1B4796 0%, #00A7D8 100%);
    box-shadow:
        0 4px 14px rgba(27, 71, 150, 0.28),
        0 1px 3px rgba(27, 71, 150, 0.12);
    transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1),
                filter 180ms ease;
}

.bpt-startup-shell__retry:hover {
    transform: translateY(-1px);
    box-shadow:
        0 8px 22px rgba(27, 71, 150, 0.32),
        0 2px 6px rgba(27, 71, 150, 0.14);
    filter: brightness(1.06);
}

.bpt-startup-shell__retry:focus-visible {
    outline: 2px solid #00A7D8;
    outline-offset: 3px;
}

.bpt-startup-shell__retry:active {
    transform: translateY(1px) scale(0.98);
    box-shadow:
        0 2px 8px rgba(27, 71, 150, 0.22),
        0 1px 2px rgba(27, 71, 150, 0.10);
}

/* --- Error state ----------------------------------------------------- */

.bpt-startup-shell[data-state="error"] .bpt-startup-shell__title {
    background: linear-gradient(135deg, #8b1d2c 30%, #c62828 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bpt-startup-shell[data-state="error"] .bpt-startup-shell__status {
    color: #8b1d2c;
    font-weight: 600;
}

.bpt-startup-shell[data-state="error"] .bpt-startup-shell__card::before {
    background: linear-gradient(90deg, #c62828 0%, #ef5350 50%, #c62828 100%);
    opacity: 0.7;
}

.bpt-startup-shell[data-state="error"] .bpt-startup-shell__brand img {
    animation: none;
    filter: grayscale(0.3) opacity(0.8);
}

/* --- Responsive ------------------------------------------------------ */

@media (max-width: 640px) {
    .bpt-startup-shell__card {
        padding: 2rem 1.25rem 1.5rem;
        border-radius: 1.25rem;
    }

    .bpt-startup-shell__brand img {
        width: 88px;
        height: 88px;
    }

    .bpt-startup-shell__title {
        font-size: 1.35rem;
    }

    .bpt-startup-shell::before {
        width: 280px;
        height: 280px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bpt-startup-shell,
    .bpt-startup-shell__card,
    .bpt-startup-shell__brand img,
    .bpt-startup-shell::before,
    .bpt-startup-shell__card::after {
        animation: none !important;
    }
}
