/* ============================================================
   admin-signin.css
   IAGD console sign-in. High-tech Mica server room: animated
   conic ring border, rack cabinets with blinking status LEDs,
   drifting perspective grid floor, orbiting ambient glow,
   staged materialize entrance.
   Loads after admin-mica.css. Requires data-bs-theme="dark".
   Shared by /admin and /club/login (body#login-page).
   No white strokes anywhere on this page: every hairline is
   violet-family by design.
   ============================================================ */

/* Registered so the conic ring angle can interpolate. Browsers
   without @property simply render the ring static. */
@property --signin-ring-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

/* ---------- Body stage -------------------------------------- */
body#login-page {
    background: var(--mica-base) !important;
    color: var(--mica-text) !important;
    font-family: var(--mica-font-sans);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* Wallpaper tint + grain mirror the iagd-console recipe: negative
   z-indexes so they sit behind all in-flow content, grain overlay-
   blended so it textures the dark base instead of whitening it. */
body#login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    background:
        radial-gradient(80% 60% at 15% 0%, rgba(124, 58, 237, 0.22), transparent 70%),
        radial-gradient(60% 50% at 100% 100%, rgba(34, 211, 238, 0.07), transparent 70%);
}
body#login-page::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image: url("../textures/noise.png");
    background-repeat: repeat;
    background-size: 128px 128px;
    opacity: 0.05;
    mix-blend-mode: overlay;
}

body#login-page > .d-flex {
    position: relative;
    z-index: 2;
}

/* Perspective grid floor, drifting toward the horizon. One element,
   two repeating gradients, background-position animation only. */
body#login-page > .d-flex::before {
    content: "";
    position: absolute;
    left: -20%;
    right: -20%;
    bottom: -4%;
    height: 62%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(124, 58, 237, 0.6) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.6) 1px, transparent 1px);
    background-size: 44px 44px;
    opacity: 0.06;
    transform: perspective(640px) rotateX(58deg);
    transform-origin: 50% 100%;
    animation: signin-grid-drift 24s linear infinite;
    -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9) 30%, transparent 95%);
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9) 30%, transparent 95%);
}
@keyframes signin-grid-drift {
    to { background-position: 0 44px, 0 0; }
}

/* Ambient glow slowly orbiting behind the card. */
body#login-page > .d-flex::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 560px;
    height: 560px;
    margin: -280px 0 0 -280px;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(closest-side, rgba(124, 58, 237, 0.16), transparent 72%);
    animation: signin-orbit 16s ease-in-out infinite alternate;
}
@keyframes signin-orbit {
    from { transform: translate(-64px, -28px) scale(0.94); }
    to   { transform: translate(64px, 36px) scale(1.08); }
}

/* ---------- Login card -------------------------------------- */
.login-container {
    background-color: var(--mica-surface) !important;
    /* Mica film grain on the card surface, original strength. */
    background-image:
        linear-gradient(rgba(16, 12, 38, 0.92), rgba(16, 12, 38, 0.92)),
        url("../textures/noise.png");
    background-repeat: no-repeat, repeat;
    background-size: auto, 128px 128px;
    background-origin: border-box;
    /* No border: the conic ring pseudo below draws the card outline,
       so no UA/legacy stroke can ever render white here. */
    border: 0;
    border-radius: var(--mica-radius-card);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.55),
        0 0 48px rgba(124, 58, 237, 0.12);
    color: var(--mica-text) !important;
    position: relative;
    z-index: 1;
    width: 400px !important;
    max-width: 400px !important;
    min-width: 0 !important;
    opacity: 0;
    transform: translateY(18px);
    filter: blur(8px);
    animation: signin-card-enter 760ms var(--mica-ease) 120ms forwards;
}
@keyframes signin-card-enter {
    60% { filter: blur(0); }
    to  { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Animated conic ring border: violet/cyan trace orbiting the card
   edge. Drawn as a 1px frame via mask compositing. */
.login-container::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(
        from var(--signin-ring-angle),
        rgba(124, 58, 237, 0.60),
        rgba(34, 211, 238, 0.35) 12%,
        rgba(124, 58, 237, 0.10) 30%,
        rgba(124, 58, 237, 0.45) 50%,
        rgba(217, 70, 239, 0.30) 62%,
        rgba(124, 58, 237, 0.10) 82%,
        rgba(124, 58, 237, 0.60)
    );
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    animation: signin-ring-spin 9s linear infinite;
    pointer-events: none;
    z-index: 0;
}
@keyframes signin-ring-spin {
    to { --signin-ring-angle: 360deg; }
}

.login-container > * {
    position: relative;
    z-index: 1;
}

/* ---------- Card children stagger --------------------------- */
.login-container > .col-12 {
    opacity: 0;
    transform: translateY(8px);
    animation: signin-child-rise 500ms var(--mica-ease) forwards;
}
.login-container > .col-12:nth-child(1) { animation-delay: 380ms; }
.login-container > .col-12:nth-child(2) { animation-delay: 460ms; }
.login-container > .col-12:nth-child(3) { animation-delay: 540ms; }
.login-container > .col-12:nth-child(4) { animation-delay: 620ms; }
.login-container > .col-12:nth-child(5) { animation-delay: 700ms; }
.login-container > .col-12:nth-child(6) { animation-delay: 780ms; }

@keyframes signin-child-rise {
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Logo -------------------------------------------- */
.signin-logo-wrap {
    text-align: center;
}
.login-container img {
    max-width: 200px;
    height: auto;
    display: inline-block;
    filter: drop-shadow(0 4px 20px rgba(124, 58, 237, 0.45));
}
/* Slow breathing glow on the IAGD mark. Excludes the club page's
   demoted header logo (filter: none there, keyframes would win). */
.signin-logo-wrap img:not(.club-iagd-logo) {
    animation: signin-logo-breathe 5s ease-in-out infinite;
}
@keyframes signin-logo-breathe {
    0%, 100% { filter: drop-shadow(0 4px 20px rgba(124, 58, 237, 0.35)); }
    50%      { filter: drop-shadow(0 6px 28px rgba(124, 58, 237, 0.65)); }
}

/* ---------- Labels + inputs --------------------------------- */
.login-container .mica-label {
    display: flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #d5c5ff;
    margin-bottom: 6px;
}
/* Accent tick marker before each label. */
.login-container .mica-label::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-right: 8px;
    background: var(--mica-accent);
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.8);
    transform: rotate(45deg);
    flex-shrink: 0;
}
.login-container .form-control {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(124, 58, 237, 0.35) !important;
    color: #ffffff !important;
    border-radius: var(--mica-radius) !important;
    height: 46px;
    font-size: 14px;
    padding: 0 14px;
    letter-spacing: normal !important;
    transition:
        background-color 220ms var(--mica-ease),
        border-color 220ms var(--mica-ease),
        box-shadow 220ms var(--mica-ease);
}
.login-container .form-control:focus {
    background-color: rgba(124, 58, 237, 0.10) !important;
    border-color: var(--mica-accent) !important;
    box-shadow:
        0 0 0 4px var(--mica-accent-soft),
        0 8px 24px rgba(124, 58, 237, 0.22) !important;
    outline: 0;
    letter-spacing: normal !important;
}

/* Suppress autofill yellow + keep text white */
.login-container input:-webkit-autofill,
.login-container input:-webkit-autofill:hover,
.login-container input:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.08) inset !important;
    caret-color: #ffffff !important;
}

/* ---------- Submit button ----------------------------------- */
.login-container .btn-primary {
    background-color: var(--mica-accent) !important;
    background-image: linear-gradient(135deg, var(--mica-accent), var(--mica-accent-deep)) !important;
    border: 1px solid rgba(124, 58, 237, 0.55) !important;
    color: #ffffff !important;
    border-radius: var(--mica-radius) !important;
    padding: 14px 21px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5pt;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 24px rgba(124, 58, 237, 0.35),
        inset 0 1px 0 rgba(196, 168, 255, 0.18);
    transition:
        background-color 220ms var(--mica-ease),
        transform 140ms var(--mica-ease),
        box-shadow 220ms var(--mica-ease);
}

/* Idle sheen sweep */
.login-container .btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        100deg,
        transparent 0%,
        rgba(196, 168, 255, 0.28) 50%,
        transparent 100%
    );
    transform: skewX(-20deg);
    animation: signin-btn-sheen 7s ease-in-out infinite;
    pointer-events: none;
}
@keyframes signin-btn-sheen {
    0%, 25%   { left: -75%; }
    75%, 100% { left: 125%; }
}

.login-container .btn-primary:hover {
    background-image: linear-gradient(135deg, var(--mica-accent-hover), var(--mica-accent)) !important;
    transform: translateY(-2px);
    box-shadow:
        0 14px 32px rgba(124, 58, 237, 0.55),
        inset 0 1px 0 rgba(196, 168, 255, 0.18);
}
.login-container .btn-primary:active {
    transform: translateY(0) scale(0.98);
}

/* Loading dots */
.login-container .btn-primary .btn-dots {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.login-container .btn-primary.is-loading {
    pointer-events: none;
    color: transparent !important;
}
.login-container .btn-primary.is-loading .btn-dots {
    display: flex;
}
.login-container .btn-primary .btn-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffffff;
    animation: signin-dot-pulse 1.2s ease-in-out infinite;
}
.login-container .btn-primary .btn-dots span:nth-child(2) { animation-delay: 0.15s; }
.login-container .btn-primary .btn-dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes signin-dot-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.7); }
    40%           { opacity: 1;   transform: scale(1.1); }
}

/* ---------- Caps lock chip ---------------------------------- */
.signin-caps-chip {
    position: absolute;
    right: 8px;
    bottom: 8px;
    transform: translateX(8px);
    opacity: 0;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: var(--mica-radius-pill);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: rgba(251, 191, 36, 0.18);
    border: 1px solid rgba(251, 191, 36, 0.55);
    color: #fde68a;
    transition:
        opacity 220ms var(--mica-ease),
        transform 260ms var(--mica-ease);
    z-index: 5;
}
.signin-caps-chip.is-active {
    opacity: 1;
    transform: translateX(0);
}
.signin-caps-chip::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 8px #fbbf24;
    animation: signin-caps-pulse 1.4s ease-in-out infinite;
}
@keyframes signin-caps-pulse {
    0%, 100% { opacity: 0.5; transform: scale(0.85); }
    50%      { opacity: 1;   transform: scale(1.1); }
}

/* ---------- Inline error line ------------------------------ */
.signin-error {
    margin-top: 0.75rem;
    min-height: 1.25rem;
    font-size: 0.85rem;
    line-height: 1.25rem;
    color: #ff8a8a;
    text-align: center;
    opacity: 0;
    transition: opacity 160ms ease;
}
.signin-error.is-visible {
    opacity: 1;
}

/* ---------- Google sign-in --------------------------------- */
.signin-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0.25rem 0 1rem;
    color: var(--mica-dim-2);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
/* Violet hairlines, fading toward the text. */
.signin-divider::before,
.signin-divider::after {
    content: "";
    flex: 1;
    height: 1px;
}
.signin-divider::before {
    background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.45));
}
.signin-divider::after {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.45), transparent);
}
.signin-google {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
    min-height: 44px;
    /* Bootstrap's [data-bs-theme=dark] sets color-scheme: dark on :root.
       Chromium then paints cross-origin iframes whose content doesn't
       match (the GIS button is a light document) on an opaque WHITE
       canvas. Scoping this subtree back to light makes the embedder and
       iframe schemes agree, so the canvas composites transparently and
       only the filled_black pill renders. */
    color-scheme: light;
}

/* ---------- Server-room backdrop ---------------------------- */
/* Two rows of rack cabinets angled into a corridor; the card sits
   in the aisle. Pure gradients + tiny LED spans, no images.
   Sits at z 0 inside the wrapper, under the card (z 1). */
.signin-room {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.signin-rackrow {
    position: absolute;
    bottom: 0;
    height: 80vh;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    /* Fade the cabinets out toward the ceiling. */
    -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.95) 55%, transparent 96%);
    mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.95) 55%, transparent 96%);
}
.signin-rackrow--left {
    left: -36px;
    transform: perspective(1000px) rotateY(46deg);
    transform-origin: left bottom;
}
.signin-rackrow--right {
    right: -36px;
    flex-direction: row-reverse;
    transform: perspective(1000px) rotateY(-46deg);
    transform-origin: right bottom;
}

/* Rack cabinet: 1U slot lines + fine vent texture, violet strokes. */
.signin-rack {
    position: relative;
    width: 116px;
    height: 100%;
    background:
        repeating-linear-gradient(180deg, rgba(124, 58, 237, 0.06) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(180deg, rgba(124, 58, 237, 0.18) 0 1px, transparent 1px 30px),
        linear-gradient(180deg, #0e0a24, #0a0719);
    border: 1px solid rgba(124, 58, 237, 0.22);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    box-shadow:
        inset 0 0 28px rgba(0, 0, 0, 0.55),
        0 0 28px rgba(124, 58, 237, 0.07);
}
/* Corridor depth: seven cabinets recede and dim toward the vanishing
   point; the nearest one breathes faintly. */
.signin-rackrow .signin-rack:nth-child(1) {
    height: 96%;
    animation: signin-rack-breathe 7s ease-in-out infinite;
}
.signin-rackrow .signin-rack:nth-child(2) { height: 100%; opacity: 0.85; }
.signin-rackrow .signin-rack:nth-child(3) { height: 92%;  opacity: 0.70; }
.signin-rackrow .signin-rack:nth-child(4) { height: 97%;  opacity: 0.55; }
.signin-rackrow .signin-rack:nth-child(5) { height: 90%;  opacity: 0.42; }
.signin-rackrow .signin-rack:nth-child(6) { height: 95%;  opacity: 0.30; }
.signin-rackrow .signin-rack:nth-child(7) { height: 88%;  opacity: 0.20; }
@keyframes signin-rack-breathe {
    0%, 100% { box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.55), 0 0 22px rgba(124, 58, 237, 0.06); }
    50%      { box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.55), 0 0 34px rgba(124, 58, 237, 0.14); }
}

/* Status LED column on the rack face. Per-LED blink delay/period
   come from the markup via --d / --p. */
.signin-rack__leds {
    position: absolute;
    top: 7%;
    bottom: 7%;
    right: 13px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}
.signin-rack__leds span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    animation-delay: var(--d, 0s);
    animation-duration: var(--p, 2s);
    animation-iteration-count: infinite;
}
/* Steady status: slow green pulse. */
.signin-rack__leds .is-ok {
    background: var(--mica-ok);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
    animation-name: rack-led-pulse;
    animation-timing-function: ease-in-out;
}
/* Network activity: irregular hard blinks. */
.signin-rack__leds .is-data {
    background: #22d3ee;
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.7);
    animation-name: rack-led-data;
    animation-timing-function: step-end;
}
/* Accent identity light: slow violet pulse. */
.signin-rack__leds .is-acc {
    background: var(--mica-accent-text);
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.8);
    animation-name: rack-led-pulse;
    animation-timing-function: ease-in-out;
}
/* Rare amber double-blink, mostly dark. */
.signin-rack__leds .is-warn {
    background: var(--mica-warn);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.7);
    animation-name: rack-led-warn;
    animation-timing-function: step-end;
}
@keyframes rack-led-pulse {
    0%, 100% { opacity: 0.9; }
    50%      { opacity: 0.45; }
}
/* Mostly-on with two brief ticks per cycle: reads as activity,
   not strobing. Periods in the markup run 3.8s and up. */
@keyframes rack-led-data {
    0%, 100% { opacity: 0.9; }
    8%       { opacity: 0.15; }
    12%      { opacity: 0.9; }
    50%      { opacity: 0.2; }
    54%      { opacity: 0.9; }
}
@keyframes rack-led-warn {
    0%, 85%, 100% { opacity: 0.1; }
    87%, 93%      { opacity: 1; }
    90%           { opacity: 0.1; }
}

/* Small activity console on the lead cabinets: three pulsing bars. */
.signin-rack__screen {
    position: absolute;
    top: 24px;
    left: 13px;
    width: 42px;
    height: 24px;
    padding: 4px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    background: rgba(34, 211, 238, 0.06);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 3px;
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.12);
}
.signin-rack__screen i {
    flex: 1;
    height: 35%;
    background: rgba(34, 211, 238, 0.65);
    border-radius: 1px;
    animation: rack-screen-bars 2.8s ease-in-out infinite;
}
.signin-rack__screen i:nth-child(2) { animation-delay: 0.6s; }
.signin-rack__screen i:nth-child(3) { animation-delay: 1.2s; }
@keyframes rack-screen-bars {
    0%, 100% { height: 30%; }
    50%      { height: 90%; }
}

/* The room only reads on wide viewports; below that it crowds the card. */
@media (max-width: 991.98px) {
    .signin-room { display: none; }
}

/* ---------- Reduced motion --------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .login-container,
    .login-container::before,
    .login-container > .col-12,
    .login-container .btn-primary::before,
    .signin-logo-wrap img,
    .signin-caps-chip::before,
    .signin-rack,
    .signin-rack__leds span,
    .signin-rack__screen i,
    body#login-page > .d-flex::before,
    body#login-page > .d-flex::after {
        animation: none !important;
    }
    .login-container { opacity: 1; transform: none; filter: none; }
    .login-container > .col-12 { opacity: 1; transform: none; }
    body#login-page > .d-flex::after { transform: none; }
}
