﻿/* platform.css â€” Minimal tokens for gaps MudBlazor doesn't cover
   MudThemeProvider handles colors, typography, spacing.
   This file covers: shadows, animations, RTL utils, state primitives. */

/* ========== Custom Tokens ========== */
:root {
    /* Shadows (MudBlazor elevation covers most, these are design-specific) */
    --ammn-shadow-card: 0px 12px 16px 0px color-mix(in srgb, var(--n900) 4%, transparent);
    --ammn-shadow-glass: 0 8px 32px color-mix(in srgb, var(--n900) 10%, transparent);
    --ammn-shadow-hover: 0px 16px 24px 0px color-mix(in srgb, var(--n900) 8%, transparent);
    /* Animations */
    --ammn-transition-fast: 0.2s ease;
    --ammn-transition-base: 0.3s ease;
    --ammn-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    /* Radius overrides for non-MudBlazor elements */
    --ammn-radius-full: 999px;
}

/* ========== RTL Layout Helpers ========== */
[dir="rtl"] {
    --ammn-dir: rtl;
}

/* ========== State Primitives ========== */

/* Loader */
.ammn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Full-page branded loading screen (AmmnPageLoader): the full AMMN wordmark over
   a slim indeterminate progress bar, on a deep branded field. The wordmark art
   is white, so the splash uses a constant dark background (--splash-* tokens) in
   both light and dark themes.

   NO ENTRANCE ANIMATION (no @starting-style fade-in, on the field or the stage). An entrance
   replays on every insertion, and Blazor inserts this element more than once per page — the
   prerendered markup, then the interactive render that replaces it — so each fade-in showed the
   page through the cover: recorded as the same flash twice on one motor search. Leaving is still
   animated, by .ammn-boot--done. */
.ammn-page-loader {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    background: var(--splash-bg);
    font-family: var(--font-body);
}

/* Soft brand-lit ambience — lifts the deep field so it is not a flat block. */
.ammn-page-loader::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(40% 34% at 50% 38%,
            color-mix(in srgb, var(--brand-primary) 20%, transparent), transparent 72%),
        radial-gradient(52% 42% at 50% 98%,
            color-mix(in srgb, var(--brand-primary) 11%, transparent), transparent 70%);
    animation: ammn-page-loader-breathe 4.2s ease-in-out infinite;
    pointer-events: none;
}

.ammn-page-loader__stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    text-align: center;
}

/* The full AMMN wordmark — the focal point, shown large. */
.ammn-page-loader__logo {
    width: clamp(176px, 44vw, 212px);
    height: auto;
}

/* Slim indeterminate progress bar — a brand segment sweeping a faint track. */
.ammn-page-loader__bar {
    position: relative;
    width: clamp(176px, 44vw, 212px);
    height: 4px;
    border-radius: var(--ammn-radius-full);
    background: color-mix(in srgb, var(--splash-text) 14%, transparent);
    overflow: hidden;
}

.ammn-page-loader__bar::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 38%;
    border-radius: var(--ammn-radius-full);
    background: var(--brand-primary);
    animation: ammn-page-loader-slide 1.05s linear infinite;
}

.ammn-page-loader__copy {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ammn-page-loader__text {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--splash-text);
}

.ammn-page-loader__subtext {
    margin: 0;
    font-size: 0.875rem;
    color: var(--splash-text-muted);
}

@keyframes ammn-page-loader-slide {
    from { transform: translateX(-120%); }
    to   { transform: translateX(330%); }
}

@keyframes ammn-page-loader-breathe {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Wizard resume gate (Phase 2 item 12 / R4): occupies the wizard content
   slot while the resume-confirm decision is pending so no saved step
   flashes underneath the dialog. */

/* Wizard resume confirm dialog — self-contained CSS modal. Replaces the
   MudDialog usage that stopped rendering after the MudBlazor 9 upgrade
   (the inline `<MudDialog @bind-Visible>` pattern was deprecated). */
.wizard-resume-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1300;
}

.wizard-resume-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1301;
    padding: 1rem;
}

.wizard-resume-modal__card {
    background: var(--n0, #fff);
    color: var(--text, #111);
    border-radius: var(--radius-md, 12px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    max-width: 440px;
    width: 100%;
    padding: 24px;
    font-family: var(--font-body);
}

.wizard-resume-modal__title {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text, #111);
}

.wizard-resume-modal__body {
    margin: 0 0 24px 0;
    font-size: 0.95rem;
    color: var(--n600, #555);
    line-height: 1.5;
}

.wizard-resume-modal__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.wizard-resume-modal__btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm, 8px);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: var(--font-body);
    transition: filter 0.15s ease, transform 0.05s ease;
}

.wizard-resume-modal__btn:active {
    transform: translateY(1px);
}

.wizard-resume-modal__btn--primary {
    background: var(--brand-green, #00875A);
    color: var(--n0, #fff);
    border-color: var(--brand-green, #00875A);
}

.wizard-resume-modal__btn--primary:hover {
    filter: brightness(1.05);
}

.wizard-resume-modal__btn--secondary {
    background: transparent;
    color: var(--text, #111);
    border-color: var(--border, #ccc);
}

.wizard-resume-modal__btn--secondary:hover {
    background: var(--n50, #f5f5f5);
}

/* Skeleton */
.ammn-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Empty State */
.ammn-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    gap: 1rem;
}

.ammn-empty-state__icon {
    width: 64px;
    height: 64px;
    opacity: 0.5;
}

.ammn-empty-state__title {
    font-size: 1.25rem;
    font-weight: 600;
}

.ammn-empty-state__message {
    font-size: 0.875rem;
    opacity: 0.7;
    max-width: 400px;
}

/* Error State */
.ammn-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    gap: 1rem;
}

.ammn-error-state__icon {
    width: 64px;
    height: 64px;
    opacity: 0.6;
}

.ammn-error-state__title {
    font-size: 1.25rem;
    font-weight: 600;
}

.ammn-error-state__message {
    font-size: 0.875rem;
    opacity: 0.7;
    max-width: 400px;
}

/* ========== Platform Layout ========== */

/* Service (wizard) layout */
.ammn-service-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========== ChatBot Widget ========== */

/* Floating trigger */
.chatbot-fab {
    position: fixed;
    bottom: 32px;
    inset-inline-start: 32px;
    z-index: 1090;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--brand-primary);
    color: var(--n0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform var(--ammn-transition-fast), box-shadow var(--ammn-transition-fast);
}

    .chatbot-fab:hover {
        transform: scale(1.08);
        box-shadow: 0 10px 30px rgba(var(--brand-green-rgb), 0.35);
    }

/* Panel */
.chatbot-panel {
    position: fixed;
    bottom: 32px;
    inset-inline-start: 32px;
    z-index: 1091;
    width: 380px;
    max-height: calc(100vh - 80px);
    background: var(--bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatbot-slide-up 0.3s ease;
}

/* Header */
.chatbot-panel__header {
    background: var(--brand-primary);
    color: var(--n0);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-panel__header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-panel__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-panel__header-text {
    display: flex;
    flex-direction: column;
}

.chatbot-panel__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.chatbot-panel__subtitle {
    font-size: 12px;
    opacity: 0.85;
}

.chatbot-panel__close {
    background: none;
    border: none;
    color: var(--n0);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--ammn-transition-fast);
}

    .chatbot-panel__close:hover {
        background: rgba(255, 255, 255, 0.2);
    }

/* Back button — only rendered in the chat view; mirrors the close button. */
.chatbot-panel__back {
    background: none;
    border: none;
    color: var(--n0);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--ammn-transition-fast);
}

    .chatbot-panel__back:hover {
        background: rgba(255, 255, 255, 0.2);
    }

/* Chevron points toward the start of the reading direction. */
.chatbot-panel[dir="rtl"] .chatbot-panel__back svg {
    transform: scaleX(-1);
}

/* Keyboard focus in the chat (UAT round 2, after DEF-115): MudBlazor's global reset (button:focus and a:focus-visible:
   outline none) takes the browser's own ring away, so a keyboard user could not see which control they were on. The
   ring is the page's text colour, clear on the panel's surface and on the page around the launcher in both themes; on
   the green header it is the dark ink made for that green, as the green does not change with the theme. */
.chatbot-fab:focus-visible,
.chatbot-panel button:focus-visible,
.chatbot-panel a:focus-visible,
.chatbot-panel summary:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

.chatbot-panel__header button:focus-visible {
    outline-color: var(--brand-primary-contrast);
    outline-offset: 0;
}

/* Body */
.chatbot-panel__body {
    flex: 1;
    overflow-y: auto;
    min-height: 280px;
    max-height: 420px;
}

/* Welcome view */
.chatbot-welcome {
    padding: 20px 16px;
}

.chatbot-welcome__greeting {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
}

.chatbot-welcome__text {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.6;
}

/* Lead-capture form (anonymous visitors) — clean, minimal pre-chat */
.chatbot-lead {
    padding: 22px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-lead__prompt {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 2px;
    line-height: 1.55;
}

.chatbot-lead__field {
    display: flex;
}

.chatbot-lead__input {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 13px 16px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color var(--ammn-transition-fast), box-shadow var(--ammn-transition-fast);
}

.chatbot-lead__input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--n30);
}

.chatbot-lead__input::placeholder {
    color: var(--text-muted);
}

.chatbot-lead__error {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--error);
    margin: 0;
}

.chatbot-lead__submit {
    margin-top: 6px;
    width: 100%;
    border: none;
    border-radius: var(--radius-md);
    padding: 13px 16px;
    background: var(--brand-primary);
    color: var(--n0);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--ammn-transition-fast), transform var(--ammn-transition-fast);
}

.chatbot-lead__submit:hover {
    background: var(--brand-primary-hover);
}

.chatbot-lead__submit:active {
    transform: translateY(1px);
}

.chatbot-lead__back {
    align-self: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    transition: color var(--ammn-transition-fast);
}

.chatbot-lead__back:hover {
    color: var(--text);
}

/* Action buttons */
.chatbot-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--ammn-transition-fast), transform var(--ammn-transition-fast);
}

.chatbot-action-btn--primary {
    background: var(--brand-primary);
    color: var(--n0);
}

    .chatbot-action-btn--primary:hover {
        background: var(--brand-primary-hover);
        transform: translateY(-1px);
    }

.chatbot-action-btn--secondary {
    background: var(--surface);
    color: var(--text);
    margin-top: 8px;
}

    .chatbot-action-btn--secondary:hover {
        background: var(--n30);
    }

/* FAQ section */
.chatbot-faq {
    margin-top: 20px;
}

.chatbot-faq__title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px;
}

.chatbot-faq__loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.chatbot-faq__item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    overflow: hidden;
}

    .chatbot-faq__item[open] {
        background: var(--surface);
    }

.chatbot-faq__question {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .chatbot-faq__question::-webkit-details-marker {
        display: none;
    }

    .chatbot-faq__question::after {
        content: '+';
        font-size: 16px;
        font-weight: 400;
        color: var(--text-muted);
        transition: transform var(--ammn-transition-fast);
        flex-shrink: 0;
        margin-inline-start: 8px;
    }

.chatbot-faq__item[open] .chatbot-faq__question::after {
    content: '−';
}

.chatbot-faq__answer {
    padding: 0 14px 12px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Chat view */
.chatbot-chat__loading,
.chatbot-chat__error,
.chatbot-chat__ended {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* A refused send sits between the conversation and the input box: compact, and in the lead form's error colour. */
.chatbot-chat__send-error {
    padding: 10px 16px;
    gap: 8px;
}

    .chatbot-chat__send-error > span {
        color: var(--error);
        font-size: 13px;
    }

    .chatbot-chat__send-error .support-contact {
        margin-top: 0;
    }

.chatbot-chat__messages {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
}

.chatbot-chat__bubble {
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 85%;
    word-wrap: break-word;
}

    .chatbot-chat__bubble p {
        margin: 0;
        font-size: 14px;
        line-height: 1.5;
    }

.chatbot-chat__bubble--user {
    background: var(--brand-primary);
    color: var(--n0);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

[dir="rtl"] .chatbot-chat__bubble--user {
    border-bottom-right-radius: 16px;
    border-bottom-left-radius: 4px;
}

.chatbot-chat__bubble--bot {
    background: var(--surface);
    color: var(--text);
    align-self: flex-start;
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .chatbot-chat__bubble--bot {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
}

/* Agent (human) message — AMMN logo avatar + agent short name */
.chatbot-chat__agent {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    align-self: flex-start;
    max-width: 88%;
}

.chatbot-chat__agent-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    padding: 4px;
}

.chatbot-chat__agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chatbot-chat__agent-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.chatbot-chat__agent-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-primary);
}

.chatbot-chat__bubble--agent {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.chatbot-chat__time {
    font-size: 11px;
    opacity: 0.6;
    display: block;
    margin-top: 4px;
}

.chatbot-chat__bubble--user .chatbot-chat__time {
    text-align: end;
}

/* Typing indicator */
.chatbot-chat__typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

    .chatbot-chat__typing span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--text-muted);
        animation: chatbot-typing 1.2s infinite ease-in-out;
    }

        .chatbot-chat__typing span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .chatbot-chat__typing span:nth-child(3) {
            animation-delay: 0.4s;
        }

/* Input bar */
.chatbot-panel__input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

    .chatbot-panel__input input {
        flex: 1;
        border: 1px solid var(--border);
        border-radius: var(--radius-full);
        padding: 10px 16px;
        font-size: 14px;
        background: var(--surface);
        color: var(--text);
        outline: none;
        transition: border-color var(--ammn-transition-fast);
    }

.chatbot-panel__input input:focus {
    border-color: var(--brand-primary);
}

.chatbot-panel__input input::placeholder {
    color: var(--text-muted);
}

.chatbot-panel__send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--brand-primary);
    color: var(--n0);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--ammn-transition-fast);
    flex-shrink: 0;
}

    .chatbot-panel__send:hover:not(:disabled) {
        background: var(--brand-primary-hover);
    }

    .chatbot-panel__send:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* RTL: flip send icon */
[dir="rtl"] .chatbot-panel__send svg {
    transform: scaleX(-1);
}

/* Animations */
@keyframes chatbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes chatbot-typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Quick links */
.chatbot-quick-links {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Chat actions bar */
.chatbot-chat__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-top: 1px solid var(--border);
}

/* Inline link button */
.chatbot-link-btn {
    background: none;
    border: none;
    color: var(--brand-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--ammn-transition-fast);
}

    .chatbot-link-btn:hover {
        background: rgba(var(--brand-green-rgb), 0.08);
    }

    .chatbot-link-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* Escalation success banner */
.chatbot-chat__escalated {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(var(--brand-green-rgb), 0.08);
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
}

/* Mobile */
@media (max-width: 480px) {
    .chatbot-fab {
        bottom: 20px;
        inset-inline-start: 20px;
    }

    .chatbot-panel {
        bottom: 0;
        inset-inline-start: 0;
        width: 100%;
        max-height: 100vh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   RE-JOIN + ERROR CHROME
   Blazor toggles state classes on #components-reconnect-modal and flips
   #blazor-error-ui to display:block. Both ship unstyled and in English by
   default, which is not acceptable on an Arabic-first site, so the states are
   dressed here. Recovery itself is the script after blazor.web.js in App.razor:
   it reloads the page, and adds the two "--gave-up" / "--shown" classes below
   only when a reload would loop. There is no button anywhere in this chrome.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
    --ammn-radius-card: 20px;
    --ammn-shadow-overlay: 0 24px 60px rgb(0 0 0 / 28%);
}

/* Hidden until the framework says otherwise. */
.ammn-rejoin { display: none; }

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-paused,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected,
#components-reconnect-modal.components-reconnect-resume-failed,
#components-reconnect-modal.ammn-rejoin--gave-up {
    display: grid;
    place-items: center;
    position: fixed;
    inset: 0;
    z-index: 3000;
    padding: 1rem;
    font-family: var(--font-body);
    background: color-mix(in srgb, var(--splash-bg) 78%, transparent);
    backdrop-filter: blur(6px);
}

.ammn-rejoin__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    inline-size: min(92vw, 26rem);
    padding: 2rem 1.75rem;
    text-align: center;
    color: var(--text);
    background: var(--surface);
    border-radius: var(--ammn-radius-card);
    box-shadow: var(--ammn-shadow-overlay);
}

/* A single calm pulse: enough to say "working", not a spinner competing with
   the page behind the scrim. */
.ammn-rejoin__pulse {
    inline-size: 2.5rem;
    block-size: 2.5rem;
    border-radius: var(--ammn-radius-full);
    background: color-mix(in srgb, var(--brand-primary) 18%, transparent);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-primary) 45%, transparent);
    animation: ammn-rejoin-pulse 1.8s var(--ammn-ease-out) infinite;
}

.ammn-rejoin__title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.ammn-rejoin__body {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: color-mix(in srgb, var(--text) 68%, transparent);
}

/* "Reconnecting" for every framework state — a failed or rejected circuit is
   about to be reloaded, which is still reconnecting as far as the customer is
   concerned. "Could not reconnect" only once the script has given up. */
.ammn-rejoin__when-failed { display: none; }

.ammn-rejoin--gave-up .ammn-rejoin__when-retrying { display: none; }

.ammn-rejoin--gave-up .ammn-rejoin__when-failed { display: inline; }

/* Given up — the pulse would be a lie. */
.ammn-rejoin--gave-up .ammn-rejoin__pulse {
    animation: none;
    background: color-mix(in srgb, var(--error) 18%, transparent);
    box-shadow: none;
}

@keyframes ammn-rejoin-pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-primary) 45%, transparent); }
    70%  { box-shadow: 0 0 0 14px color-mix(in srgb, var(--brand-primary) 0%, transparent); }
    100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-primary) 0%, transparent); }
}

/* ── Unhandled-error bar ───────────────────────────────────────────────── */

/* Blazor writes an inline display:block on an unhandled error; !important keeps
   the bar hidden anyway, because the script reloads instead. It shows only when
   that reload would loop. */
#blazor-error-ui.ammn-errorbar {
    display: none !important;
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 3100;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--splash-text);
    background: var(--error);
    box-shadow: var(--ammn-shadow-overlay);
}

#blazor-error-ui.ammn-errorbar.ammn-errorbar--shown {
    display: flex !important;
}

/* ── Page-change progress bar ──────────────────────────────────────────────
   Driven by App.razor's navigation script: `is-active` while the next page is being
   fetched, `is-done` for the finishing sweep and fade. The bar grows toward 90% over a
   long, decelerating transition — it cannot know the real progress, so it never claims
   to have finished until the page is actually in. Above the reconnect scrim (3000) and
   the error bar (3100): it is 3px at the very top and never covers them. */
.ammn-navprogress {
    position: fixed;
    inset-inline: 0;
    inset-block-start: 0;
    z-index: 3200;
    block-size: 3px;
    pointer-events: none;
    opacity: 0;
}

.ammn-navprogress.is-active {
    opacity: 1;
}

.ammn-navprogress.is-done {
    opacity: 0;
    transition: opacity .4s ease .15s;
}

.ammn-navprogress__bar {
    display: block;
    block-size: 100%;
    background: var(--brand-primary);
    box-shadow: 0 0 8px color-mix(in srgb, var(--brand-primary) 60%, transparent);
    transform: scaleX(0);
    transform-origin: left center;
}

/* transform-origin has no logical keywords: grow from the reading start. */
[dir="rtl"] .ammn-navprogress__bar {
    transform-origin: right center;
}

.ammn-navprogress.is-active .ammn-navprogress__bar {
    transform: scaleX(0.9);
    transition: transform 8s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.ammn-navprogress.is-done .ammn-navprogress__bar {
    transform: scaleX(1);
    transition: transform .2s ease-out;
}

/* ── Motion preferences ────────────────────────────────────────────────────
   The splash breathes, its bar sweeps and the re-join pulses. All three are
   decoration; none of them carries information a still frame does not. */
@media (prefers-reduced-motion: reduce) {
    .ammn-page-loader::before,
    .ammn-page-loader__bar::before,
    .ammn-rejoin__pulse {
        animation: none;
    }

    /* Keep the bar readable as a static fill rather than a frozen sliver. */
    .ammn-page-loader__bar::before { inline-size: 100%; opacity: 0.55; }

    /* The page-change bar still appears — it carries information — but as a still,
       half-width fill instead of a moving one. */
    .ammn-navprogress.is-active .ammn-navprogress__bar,
    .ammn-navprogress.is-done .ammn-navprogress__bar {
        transform: scaleX(0.5);
        transition: none;
    }
}

/* ── Landing boot cover ────────────────────────────────────────────────────
   The landing is prerendered, so its markup is painted before the page can
   answer a tap. This holds the branded loader over it until the component has
   actually hydrated, then fades out.

   The animation is a backstop, not decoration: if interactivity never arrives
   (a failed WASM download, a blocked circuit) the cover lifts on its own rather
   than trapping a page that is otherwise perfectly readable. */
/* The timeout animation targets opacity/visibility, and an element with a RUNNING animation on
   opacity creates a stacking context — even while the animation sits in its 12s delay. With
   z-index:auto that context lands in normal document order, which trapped the child loader's
   z-index:2000 inside it: measured, .footer (position:relative; z-index:10) and .hero-slide
   (z-index:2) both painted straight over a full-screen "please wait" cover, because they come
   later in the DOM. Giving the wrapper the loader's own z-index puts the context where the child
   always meant to be. position:relative is safe for the fixed child — only transform/filter/
   perspective would re-anchor it away from the viewport. */
.ammn-boot {
  position: relative;
  z-index: 2000;
  animation: ammn-boot-timeout 0s linear 12s forwards;
}

/* Offers and Checkout render the cover as a direct child of `.container.stagger`, and
   `.ammn-wizard .stagger>*` (wizard.css) is the more specific selector, so it replaced the
   timeout animation above with `fadeInUp .4s ease both`. Fill-mode `both` keeps the final
   keyframe applied forever, which leaves a permanent `transform: translateY(0)` on the wrapper —
   and a transformed ancestor becomes the containing block for a position:fixed child. Measured on
   the real wizard markup: the "full screen" cover resolved to 1100x0 at top 4946 in a 1366x900
   viewport, i.e. an invisible sliver thousands of pixels down the page. That is the loader that
   never appeared on select-quote and checkout.

   Three classes beats the stagger rule's two, so this wins wherever the two meet. */
.ammn-wizard .stagger > .ammn-boot {
  animation: ammn-boot-timeout 0s linear 12s forwards;
  transform: none;
}

.ammn-boot--done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .45s var(--ammn-ease-out), visibility 0s linear .45s;
}

@keyframes ammn-boot-timeout {
  to {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

/* ========== Support contact call-out ========== */
/* Used by the dead-end surfaces (service unavailable, payment unavailable) where the
   page would otherwise state a failure and offer the customer no next action.

   Colours derive from currentColor ON PURPOSE. This component has two hosts with
   opposite palettes: the wizard-selection panel is a dark glass card (light text) and
   the HyperPay status page is a light surface (dark text). Pinning it to --surface/
   --text-* tokens made it a white slab on the dark panel - the same trap IbsRecapture
   hit. Deriving from currentColor means it reads as part of whichever host it lands in.

   Lives here rather than in a .razor.css because App.razor does not link the Blazor
   scoped-style bundle, and rather than in wizard.css/landing.css because the two host
   pages load different sheets. */
.support-contact {
    display: flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    max-width: 100%;
    margin: 16px auto 0;
    padding: 10px 16px;
    border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, currentColor 7%, transparent);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease;
}

.support-contact:hover,
.support-contact:focus-visible {
    border-color: color-mix(in srgb, currentColor 45%, transparent);
    background: color-mix(in srgb, currentColor 12%, transparent);
}

.support-contact__icon {
    display: inline-flex;
    flex: 0 0 auto;
    opacity: .8;
}

.support-contact__body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.support-contact__text {
    font-size: 13px;
    opacity: .75;
}

.support-contact__call {
    font-size: 14px;
    font-weight: 600;
}
