/* Bapei brand styles shared by the web host (ADR-0014 point 5). Colours mirror BapeiTheme.cs. */
:root {
    --bapei-blue: #243F99;
    --bapei-navy: #0E173E;
    --bapei-sky: #56C9EB;
    --bapei-paper: #F0EFEF;
    --bapei-font-body: "Barlow", system-ui, sans-serif;
    --bapei-font-heading: "Figtree", "Barlow", system-ui, sans-serif;
}

body { font-family: var(--bapei-font-body); margin: 0; }
h1:focus { outline: none; }

.appbar-logo { height: 28px; width: auto; }
.appbar-link { color: #fff; font-family: var(--bapei-font-heading); font-weight: 600; }

/* Brand page: public home, error and not-found pages (static SSR, no MudBlazor). */
.bapei-landing {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.5rem;
    padding: 2rem 1rem; box-sizing: border-box; color: #fff; text-align: center;
    background:
        linear-gradient(135deg, transparent 0 38%, rgba(86,201,235,.55) 46%, rgba(36,63,153,0) 58%),
        linear-gradient(135deg, transparent 0 55%, rgba(36,63,153,.65) 66%, transparent 80%),
        linear-gradient(160deg, var(--bapei-navy) 0%, #000 70%);
    font-family: var(--bapei-font-body);
}
.bapei-landing .brand { display: flex; justify-content: center; }
.bapei-landing .logo { width: min(360px, 80vw); height: auto; }
.bapei-landing h1 { margin: 0; font-family: var(--bapei-font-heading); font-weight: 800; font-size: 1.8rem; }
.bapei-landing .tagline { margin: 0; max-width: 32rem; font-size: 1.1rem; color: var(--bapei-paper); opacity: .9; }
.bapei-landing .reference { margin: 0; font-size: .95rem; color: var(--bapei-paper); opacity: .8; }
.bapei-landing .actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.bapei-btn {
    font-family: var(--bapei-font-heading); display: inline-block; padding: .8rem 1.6rem; border-radius: 999px;
    font-weight: 700; text-decoration: none; min-width: 12rem;
}
.bapei-btn.primary { background: #fff; color: var(--bapei-navy); }
.bapei-btn.primary:hover { background: var(--bapei-sky); }
.bapei-btn:focus-visible { outline: 3px solid var(--bapei-sky); outline-offset: 3px; }
.bapei-btn[disabled] { background: transparent; color: var(--bapei-paper); border: 1px solid currentColor; opacity: .6; cursor: not-allowed; }

/* Company selection (static SSR): one button per company. */
.bapei-landing .tenants { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.bapei-landing .tenants form { margin: 0; }

/* Application layout */
.bapei-notice { margin-bottom: 1rem; }

#blazor-error-ui {
    background: #fff3cd; color: #000; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none;
    left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; box-sizing: border-box;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

/* Reconnect UI (Blazor state classes are set on #components-reconnect-modal; texts come from ReconnectModal.razor) */
.components-reconnect-first-attempt-visible,
.components-reconnect-repeated-attempt-visible,
.components-reconnect-failed-visible,
.components-pause-visible,
.components-resume-failed-visible,
.components-rejoining-animation { display: none; }

#components-reconnect-modal.components-reconnect-show .components-reconnect-first-attempt-visible,
#components-reconnect-modal.components-reconnect-show .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-paused .components-pause-visible,
#components-reconnect-modal.components-reconnect-resume-failed .components-resume-failed-visible,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-retrying .components-reconnect-repeated-attempt-visible,
#components-reconnect-modal.components-reconnect-retrying .components-rejoining-animation,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-failed .components-reconnect-failed-visible { display: block; }

#components-reconnect-modal {
    background-color: #fff; color: var(--bapei-navy); font-family: var(--bapei-font-body);
    width: 20rem; margin: 20vh auto; padding: 2rem; border: 0; border-top: 6px solid var(--bapei-blue);
    border-radius: .5rem; box-shadow: 0 3px 6px 2px rgba(0, 0, 0, .3);
    opacity: 0; transition: display .5s allow-discrete, overlay .5s allow-discrete;
    animation: components-reconnect-modal-fadeOutOpacity .5s both;
}
#components-reconnect-modal[open] {
    animation: components-reconnect-modal-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) .3s, components-reconnect-modal-fadeInOpacity .5s ease-in-out .3s;
    animation-fill-mode: both;
}
#components-reconnect-modal::backdrop {
    background-color: rgba(14, 23, 62, .6); animation: components-reconnect-modal-fadeInOpacity .5s ease-in-out; opacity: 1;
}
@keyframes components-reconnect-modal-slideUp { 0% { transform: translateY(30px) scale(.95); } 100% { transform: translateY(0); } }
@keyframes components-reconnect-modal-fadeInOpacity { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes components-reconnect-modal-fadeOutOpacity { 0% { opacity: 1; } 100% { opacity: 0; } }

.components-reconnect-container { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.components-reconnect-logo { width: 48px; height: 48px; }
#components-reconnect-modal p { margin: 0; text-align: center; }
#components-reconnect-modal button {
    border: 0; background-color: var(--bapei-blue); color: #fff; padding: .4rem 1.5rem; border-radius: 4px;
    font-family: var(--bapei-font-heading); font-weight: 700; cursor: pointer;
}
#components-reconnect-modal button:hover { background-color: var(--bapei-navy); }
#components-reconnect-modal button:focus-visible { outline: 3px solid var(--bapei-sky); outline-offset: 2px; }

.components-rejoining-animation { position: relative; width: 80px; height: 80px; }
.components-rejoining-animation div {
    position: absolute; border: 3px solid var(--bapei-blue); opacity: 1; border-radius: 50%;
    animation: components-rejoining-animation 1.5s cubic-bezier(0, .2, .8, 1) infinite;
}
.components-rejoining-animation div:nth-child(2) { animation-delay: -.5s; }
@keyframes components-rejoining-animation {
    0% { top: 40px; left: 40px; width: 0; height: 0; opacity: 0; }
    4.9% { top: 40px; left: 40px; width: 0; height: 0; opacity: 0; }
    5% { top: 40px; left: 40px; width: 0; height: 0; opacity: 1; }
    100% { top: 0; left: 0; width: 80px; height: 80px; opacity: 0; }
}
