/* ------------------------------------------------------------------
   Cortex sign-in: full-screen scene with the sign-in card on the right.
   Two scenes, chosen by the server (login.jsp):
     .cxs-pharmacy  heartbeat monitor (pharmacy installations)
     .cxs-store     central store: export + transfer to pharmacies
   Everything is vector (SVG + CSS), so it stays sharp on HD / 4K screens.
   Loaded after cortexLogin.css, login page only.
   ------------------------------------------------------------------ */

/* ---------- sign-in card (right) ---------- */
body.cxl .cxl-auth { position: relative; background: #fff; }
body.cxl .cxl-auth::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, #0b2a6f, #1565f0 45%, #22b8e6); }
body.cxl.cxl-store .cxl-auth::before { background: linear-gradient(90deg, #0b2a6f, #1565f0 40%, #f59e0b); }
body.cxl .cxl-form { animation: cxsRise .55s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes cxsRise { from { opacity: 0; transform: translateY(10px); } }
body.cxl .cxl-input input, body.cxl .cxl-sel-btn { box-shadow: 0 1px 2px rgba(15, 28, 58, .05), inset 0 1px 0 rgba(255, 255, 255, .8); }
body.cxl .cxl-form button[type="submit"] { position: relative; overflow: hidden; box-shadow: 0 16px 30px -14px rgba(21, 101, 240, .85), inset 0 1px 0 rgba(255, 255, 255, .28); transition: transform .18s ease, box-shadow .18s ease; }
body.cxl .cxl-form button[type="submit"]::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent); transform: skewX(-20deg); transition: left .6s ease; }
body.cxl .cxl-form button[type="submit"]:hover { transform: translateY(-1px); }
body.cxl .cxl-form button[type="submit"]:hover::after { left: 120%; }

@media (min-width: 1021px) {
    body.cxl .cxl-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
    body.cxl .cxl-world, body.cxl .cxl-auth { grid-column: 1; grid-row: 1; }
    body.cxl .cxl-auth {
        z-index: 3; justify-self: end; align-self: center;
        width: 450px; max-width: calc(100vw - 48px); height: auto; min-height: 0; max-height: calc(100dvh - 40px);
        overflow: auto; margin-right: clamp(24px, 5vw, 88px);
        border: 1px solid rgba(255, 255, 255, .7); border-radius: 26px;
        box-shadow: 0 50px 90px -30px rgba(2, 8, 30, .8), 0 0 0 8px rgba(255, 255, 255, .06);
    }
    body.cxl .cxl-auth::before { border-radius: 26px 26px 0 0; }
    body.cxl .cxl-auth-main { max-width: none; }
}

/* ---------- scene (full screen behind the card) ---------- */
body.cxl .cxl-world.cxs {
    padding: 0; display: block; position: relative; overflow: hidden; color: #fff;
    background: #04163a;
}
.cxs-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cxs-pharmacy { background:
    radial-gradient(900px 600px at 18% 20%, rgba(34, 184, 230, .22), transparent 60%),
    radial-gradient(900px 700px at 70% 100%, rgba(21, 101, 240, .35), transparent 62%),
    linear-gradient(150deg, #031330 0%, #052455 48%, #063a6b 100%) !important; }
.cxs-store { background:
    radial-gradient(900px 620px at 15% 15%, rgba(245, 158, 11, .16), transparent 60%),
    radial-gradient(900px 700px at 70% 100%, rgba(21, 101, 240, .32), transparent 62%),
    linear-gradient(150deg, #071230 0%, #0c1f52 50%, #10306b 100%) !important; }

/* content column: the area left of the card */
.cxs-stage {
    position: absolute; z-index: 2; top: 0; bottom: 0; left: 0;
    right: calc(450px + clamp(24px, 5vw, 88px) + 40px);
    padding: clamp(26px, 4vh, 48px) clamp(28px, 4vw, 64px);
    display: flex; flex-direction: column; gap: clamp(14px, 2.4vh, 26px);
}
.cxs-tag { align-self: flex-start; display: inline-flex; align-items: center; gap: 9px; padding: 7px 15px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: #e3efff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.cxs-tag i { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: cxsLive 2s ease-out infinite; }
.cxs-store .cxs-tag i { background: #fbbf24; animation-name: cxsLiveAmber; }
@keyframes cxsLive { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); } 100% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); } }
@keyframes cxsLiveAmber { 0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, .6); } 100% { box-shadow: 0 0 0 9px rgba(251, 191, 36, 0); } }

.cxs-head h2 { margin: 0; font-size: clamp(30px, 3.1vw, 64px); line-height: 1.06; font-weight: 700; letter-spacing: -.03em; max-width: 19ch; }
.cxs-head h2 span { background: linear-gradient(90deg, #5eead4, #38bdf8 55%, #93c5fd); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cxs-store .cxs-head h2 span { background: linear-gradient(90deg, #fcd34d, #fb923c 50%, #fda4af); -webkit-background-clip: text; background-clip: text; }
.cxs-head p { margin: 12px 0 0; max-width: 46ch; font-size: clamp(13px, 1vw, 18px); line-height: 1.6; color: rgba(226, 236, 255, .78); }

.cxs-visual { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; }

/* glass panel */
.cxs-frame { position: relative; width: 100%; max-width: min(1400px, calc((100dvh - 330px) * 1.5)); }
.cxs-glass { position: relative; width: 100%; border-radius: 22px; background: linear-gradient(160deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .03)); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .12); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); overflow: hidden; }
.cxs-glass-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid rgba(255, 255, 255, .08); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(226, 236, 255, .85); }
.cxs-glass-head b { display: inline-flex; align-items: center; gap: 8px; }
.cxs-glass-head em { font-style: normal; font-size: 11px; letter-spacing: .14em; color: #5eead4; display: inline-flex; align-items: center; gap: 6px; }
.cxs-glass-head em::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: cxsBlink 1.2s steps(2, start) infinite; }
.cxs-store .cxs-glass-head em { color: #fbbf24; }
@keyframes cxsBlink { to { visibility: hidden; } }

/* ---------- pharmacy: heartbeat monitor ---------- */
.cxs-ecg { display: block; width: 100%; height: auto; aspect-ratio: 760 / 250; }
.cxs-ecg .grid line { stroke: rgba(94, 234, 212, .07); stroke-width: 1; }
.cxs-ecg .base { fill: none; stroke: rgba(94, 234, 212, .22); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cxs-ecg .trace { fill: none; stroke: url(#cxsEcgGrad); stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 360 2200; stroke-dashoffset: 2560; animation: cxsTrace 3.2s linear infinite; filter: url(#cxsGlow); }
@keyframes cxsTrace { to { stroke-dashoffset: 0; } }
.cxs-vitals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid rgba(255, 255, 255, .08); }
.cxs-vital { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.cxs-vital + .cxs-vital { border-left: 1px solid rgba(255, 255, 255, .08); }
.cxs-vital span { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(94, 234, 212, .12); color: #5eead4; }
.cxs-vital span svg { width: 19px; height: 19px; }
.cxs-vital b { display: block; font-size: 13.5px; font-weight: 700; color: #fff; }
.cxs-vital small { display: block; font-size: 11.5px; color: rgba(226, 236, 255, .65); }
.cxs-heart { color: #fb7185; animation: cxsBeat 1.07s ease-in-out infinite; transform-origin: center; display: inline-flex; }
.cxs-heart svg { width: 16px; height: 16px; }
@keyframes cxsBeat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.28); } 28% { transform: scale(1); } 42% { transform: scale(1.18); } 70% { transform: scale(1); } }

/* ---------- store: export + transfer network ---------- */
.cxs-net { display: block; width: 100%; height: auto; aspect-ratio: 760 / 330; }
.cxs-net .route { fill: none; stroke: rgba(147, 197, 253, .28); stroke-width: 2; stroke-dasharray: 6 8; animation: cxsFlow 1.4s linear infinite; }
.cxs-net .route.exp { stroke: rgba(252, 211, 77, .38); }
@keyframes cxsFlow { to { stroke-dashoffset: -28; } }
.cxs-net .node rect.card { fill: rgba(255, 255, 255, .96); }
.cxs-net .node text { font: 600 12px "DM Sans", "Segoe UI", Arial, sans-serif; fill: #0f1c3a; }
.cxs-net .node text.sub { font-weight: 500; font-size: 10px; fill: #64748b; letter-spacing: .04em; }
.cxs-net .hub rect.card { fill: url(#cxsHubGrad); stroke: rgba(255, 255, 255, .25); }
.cxs-net .hub text { fill: #fff; }
.cxs-net .hub text.sub { fill: rgba(255, 255, 255, .78); }
.cxs-net .pulse { fill: none; stroke: #fbbf24; stroke-width: 2; opacity: 0; animation: cxsRing 2.6s ease-out infinite; }
.cxs-net .pulse.p2 { animation-delay: 1.3s; }
@keyframes cxsRing { 0% { stroke-width: 2; opacity: .8; } 100% { stroke-width: 22; opacity: 0; } }

/* floating chips */
.cxs-chip { position: absolute; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 9px; border-radius: 14px; background: rgba(255, 255, 255, .95); color: #0f1c3a; box-shadow: 0 24px 44px -20px rgba(0, 0, 0, .7); animation: cxsFloat 6s ease-in-out infinite; }
.cxs-chip span { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #1565f0, #22b8e6); }
.cxs-chip span svg { width: 17px; height: 17px; }
.cxs-chip b { display: block; font-size: 12.5px; line-height: 1.2; font-weight: 700; white-space: nowrap; }
.cxs-chip small { display: block; font-size: 11px; color: #64748b; font-weight: 500; white-space: nowrap; }
.cxs-chip.g span { background: linear-gradient(135deg, #059669, #34d399); }
.cxs-chip.a span { background: linear-gradient(135deg, #d97706, #fbbf24); }
.cxs-chip.c1 { top: clamp(70px, 9vh, 110px); right: clamp(28px, 4vw, 64px); }
.cxs-chip.c2 { top: clamp(150px, 20vh, 230px); right: clamp(90px, 9vw, 170px); animation-delay: -3s; }
/* no headline: both chips sit on the top row */
.cxs-chip.c2 { top: clamp(70px, 9vh, 110px); right: clamp(250px, 17vw, 330px); }
@media (max-width: 1600px) { .cxs-chip { display: none; } }
@keyframes cxsFloat { 50% { transform: translateY(-7px); } }

/* ---------- footer: brand + integrations ---------- */
.cxs-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .14); }
.cxs-brand strong { display: block; font-size: clamp(34px, 3.6vw, 54px); line-height: 1; font-weight: 700; letter-spacing: -.035em; }
.cxs-brand strong sup { font-size: 14px; color: #bcd6ff; vertical-align: top; position: relative; top: 6px; margin-left: 3px; font-weight: 500; }
.cxs-brand em { display: block; margin-top: 8px; font-style: normal; font-size: 11.5px; letter-spacing: .26em; text-transform: uppercase; color: rgba(255, 255, 255, .72); }
.cxs-partners { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cxs-partners small { width: 100%; font-size: 10px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.cxs-partners div { height: 34px; padding: 0 11px; border-radius: 10px; background: #fff; display: flex; align-items: center; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .6); }
.cxs-partners img { height: 21px; width: auto; max-width: 80px; object-fit: contain; }

/* ---------- smaller screens ---------- */
@media (max-height: 760px) and (min-width: 1021px) {
    .cxs-head p { display: none; }
    .cxs-chip { display: none; }
    .cxs-vital { padding: 10px 14px; }
}
@media (max-width: 1280px) and (min-width: 1021px) {
    body.cxl .cxl-auth { width: 410px; }
    .cxs-stage { right: calc(410px + clamp(24px, 5vw, 88px) + 28px); }
    .cxs-vital small { display: none; }
    .cxs-partners small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .cxs-ecg .trace, .cxs-net .route, .cxs-net .pulse, .cxs-chip, .cxs-heart, .cxs-tag i, .cxs-glass-head em::before, body.cxl .cxl-form { animation: none; }
    .cxs-ecg .trace { stroke-dasharray: none; }
    .cxs-net .mover { display: none; }
}
