﻿/* ============================================================================
   AUTH PAGE - /login. Theme-matched adaptation of Hyperion's Login.razor.
   Form lives in a 2-column grid; OAuth alternatives are a 2×2 grid (replaces
   Hyperion's stack of full-width bars). Themed to the Chronos violet palette.
   ============================================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(800px 400px at 30% 0%, rgba(124,58,237,0.10), transparent 60%),
        radial-gradient(600px 400px at 80% 100%, rgba(236,72,153,0.08), transparent 60%),
        var(--chronos-bg);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 28px 30px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.10);
}

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.auth-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
    user-select: none;
    pointer-events: none;
}

.auth-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 4px 0 0;
}

/* ---- Form ---- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-form .form-grid {
    display: grid;
    grid-template-columns: 1fr;     /* stacked on the narrow auth-card */
    gap: 12px;
}

.auth-form .field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-form .field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--chronos-fg-muted);
}

.auth-form .input {
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--chronos-outline);
    border-radius: 8px;
    background: white;
    font-family: inherit;
    font-size: 14px;
    color: var(--chronos-fg-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* ---- Focus: a thin ring, drawn INSIDE the box ----------------------------
   Every pixel of this state stays within the input's own border box. The ring
   is `inset`, so it thickens the existing hairline to a crisp 2px instead of
   painting a second shape around the field, and there is no outer glow and no
   transform. /login used to answer focus with `0 0 22px` of violet bloom, HUD
   corner brackets on the label row and a beam bar under the input, all of which
   spilled past the control and into the card's padding - that is the "it crawls
   out" this replaces. /register, /forgot and /reset had the opposite problem:
   `outline: none` with only a border-colour swap, which is not a focus
   indicator at all on a hairline that light.

   One rule for all four pages on purpose: the same field must not answer focus
   differently depending on which form it is sitting in.

   Do NOT move this to `:focus-visible`. These are text inputs; a pointer user
   who clicks into a field needs the same "you are typing here" answer a
   keyboard user gets, and browsers already treat text fields as always
   focus-visible - the split would only cost contrast, never buy anything. */
.auth-form .input:focus {
    border-color: var(--chronos-violet);
    box-shadow: inset 0 0 0 1px var(--chronos-violet);
}

.validation-message {
    color: var(--chronos-red);
    margin: 0;
    font-size: 13px;
}

/* v0.4.23: success/info banner on the auth pages (reset link sent / password updated). */
.auth-info {
    color: #34D399;
    background: rgba(16, 185, 129, 0.10);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0;
    font-size: 13px;
}

/* v0.4.24: upgrade / pricing page (Stripe + ЮKassa pay buttons). */
.upgrade-card { width: 520px; }
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin: 8px 0 6px;
}
.plan-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid var(--chronos-outline);
}
.plan-name { align-self: flex-start; }
.plan-perk { font-size: 13px; color: var(--chronos-fg-muted); line-height: 1.4; flex: 1; }
.plan-pays { display: flex; flex-direction: column; gap: 8px; }
.plan-pays form { margin: 0; }
.plan-pay { width: 100%; }
.upgrade-note { text-align: center; font-size: 12px; margin: 6px 0 0; }

.auth-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-primary {
    background: var(--chronos-violet);
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    padding: 10px 18px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover  { background: var(--chronos-lavender); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
    background: transparent;
    color: var(--chronos-violet);
    border: 1.5px solid var(--chronos-violet);
    border-radius: var(--radius-pill);
    padding: 8px 18px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-ghost:hover { background: var(--chronos-violet-light); }

.auth-forgot {
    text-align: center;
    font-size: 12px;
}
.auth-forgot a {
    color: var(--chronos-fg-muted);
    text-decoration: none;
}
.auth-forgot a:hover { color: var(--chronos-violet); text-decoration: underline; }

/* ---- OAuth section: divider + 2×2 grid (replaces Hyperion vertical bars) ---- */
.oauth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
}
.oauth-divider hr {
    border: none;
    border-top: 1px solid var(--chronos-outline);
    margin: 0;
}
.oauth-divider span {
    font-size: 11px;
    color: var(--chronos-fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.oauth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Google cell: our custom .oauth-btn is the visible button, sized like every
   other grid cell. A transparent Google Identity Services (GSI) button sits
   on top of it (absolutely positioned overlay) so a click launches the real
   Google sign-in while the grid stays a plain 2x2. */
.oauth-cell.oauth-google {
    position: relative;
}
.oauth-cell.oauth-google .oauth-btn {
    width: 100%;
    height: 100%;
}

/* Invisible click target. GSI's rendered button has a fixed intrinsic size
   (data-width has a ~200px floor), so it is scaled up and clipped to the
   cell bounds instead of being allowed to overflow into the next column. */
.oauth-google-overlay {
    position: absolute;
    inset: 0;
    opacity: 0;
    overflow: hidden;
    z-index: 2;
    cursor: pointer;
}
.oauth-google-overlay > div,
.oauth-google-overlay iframe {
    width: 100% !important;
    height: 100% !important;
    transform: scale(2.2);
    transform-origin: center;
}

.oauth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border: 1px solid var(--chronos-outline);
    border-radius: 10px;
    color: var(--chronos-fg-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.oauth-btn:hover:not(:disabled) {
    border-color: var(--chronos-violet);
    background: #FAFAFE;
}
.oauth-btn:active:not(:disabled) { transform: translateY(1px); }
.oauth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    /* Subtle gradient hints "coming soon" without being grey-dead. */
    background: linear-gradient(180deg, white 0%, #F8F8FB 100%);
}
.oauth-btn svg { flex-shrink: 0; }

.auth-hint {
    text-align: center;
    font-size: 12px;
    margin: 0;
}
.auth-hint code {
    background: var(--chronos-chip-bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--chronos-font-mono);
    font-size: 11.5px;
}

/* Slim screens: stack OAuth grid to 1 column */
@media (max-width: 380px) {
    .oauth-grid { grid-template-columns: 1fr; }
    .auth-actions { grid-template-columns: 1fr; }
}


/* v0.6.0: resend-confirmation inline form (shown on the email_unconfirmed error). */
.auth-resend {
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
}
.auth-resend .input { flex: 1; min-width: 0; }

/* ============================================================================
   LOGIN FX (v0.7.5) - the front door's light show. Everything scoped under
   .login-fx so /register and /forgot keep the plain look until they opt in.
   The canvas/aurora/spotlight layers are enhancements drawn by js/login-fx.js;
   every ANIMATION below is pure CSS and plays even if that script never runs.
   Layering inside the page: aurora 0 < canvas 1 < spotlight 2 < card 3.
   ============================================================================ */
.auth-page.login-fx {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.login-canvas,
.login-aurora,
.login-spotlight {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.login-canvas { z-index: 1; }

/* A slow nebula behind the card: two blurred conic blooms drifting in opposite
   rotation. Light theme gets a fainter pass so the page stays airy. */
.login-aurora { z-index: 0; }
.login-aurora::before,
.login-aurora::after {
    content: "";
    position: absolute;
    width: 76vmax;
    height: 76vmax;
    left: 50%;
    top: 50%;
    margin: -38vmax 0 0 -38vmax;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.5;
    background: conic-gradient(from 0deg,
        rgba(124, 58, 237, 0.20), rgba(236, 72, 153, 0.10), rgba(14, 165, 233, 0.08),
        rgba(124, 58, 237, 0.02), rgba(191, 127, 255, 0.16), rgba(124, 58, 237, 0.20));
    animation: login-aurora-spin 44s linear infinite;
}
.login-aurora::after {
    width: 54vmax; height: 54vmax; margin: -27vmax 0 0 -27vmax;
    animation-direction: reverse;
    animation-duration: 60s;
    opacity: 0.35;
}
:root[data-theme="light"] .login-aurora::before,
:root[data-theme="light"] .login-aurora::after { opacity: 0.22; }
@keyframes login-aurora-spin { to { transform: rotate(360deg); } }

/* The cursor spotlight - --mx/--my come from login-fx.js. */
.login-spotlight {
    z-index: 2;
    background: radial-gradient(300px 300px at var(--mx, 50%) var(--my, 38%),
        rgba(191, 127, 255, 0.14), rgba(124, 58, 237, 0.05) 45%, transparent 70%);
    transition: opacity 0.4s ease;
}
:root[data-theme="light"] .login-spotlight { opacity: 0.5; }

/* ---- the card: materialize, then hand transform over to the pointer tilt ---- */
.login-fx .auth-card {
    position: relative;
    z-index: 3;
    border: 1px solid transparent;
    background:
        linear-gradient(var(--chronos-card-bg), var(--chronos-card-bg)) padding-box,
        linear-gradient(150deg, rgba(191, 127, 255, 0.55), rgba(124, 58, 237, 0.2) 30%,
            rgba(236, 72, 153, 0.3) 65%, rgba(191, 127, 255, 0.5)) border-box;
    box-shadow:
        0 24px 60px rgba(17, 24, 39, 0.28),
        0 0 46px rgba(124, 58, 237, 0.13);
    animation: login-card-in 0.9s cubic-bezier(0.22, 0.9, 0.3, 1.2) both;
}
.login-fx .auth-card.tilt-on {
    animation: none;
    transform: perspective(950px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
    transition: transform 0.25s ease-out;
    will-change: transform;
}
@keyframes login-card-in {
    0%   { opacity: 0; transform: translateY(30px) scale(0.955); filter: blur(14px); }
    60%  { opacity: 1; filter: blur(0); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* Blocks inside the card surface one after another. */
.login-fx .auth-card > * {
    animation: login-block-in 0.55s cubic-bezier(0.22, 0.9, 0.36, 1) both;
}
.login-fx .auth-card > :nth-child(1) { animation-delay: 0.20s; }
.login-fx .auth-card > :nth-child(2) { animation-delay: 0.34s; }
.login-fx .auth-card > :nth-child(3) { animation-delay: 0.46s; }
.login-fx .auth-card > :nth-child(4) { animation-delay: 0.58s; }
.login-fx .auth-card > :nth-child(5) { animation-delay: 0.70s; }
.login-fx .auth-card > :nth-child(6) { animation-delay: 0.82s; }
@keyframes login-block-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- logo: drop in, then breathe light rings ---- */
.login-logo-wrap { position: relative; display: inline-block; }
.login-fx .auth-logo {
    position: relative;
    z-index: 1;
    animation: login-logo-in 0.8s cubic-bezier(0.18, 1.2, 0.4, 1) 0.15s both;
    filter: drop-shadow(0 0 14px rgba(124, 58, 237, 0.45));
}
@keyframes login-logo-in {
    0%   { opacity: 0; transform: translateY(-26px) rotate(-14deg) scale(0.8); }
    100% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
}
.login-logo-wrap::before,
.login-logo-wrap::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(191, 127, 255, 0.55);
    opacity: 0;
    animation: login-ring 4.2s ease-out 1s infinite;
    pointer-events: none;
}
.login-logo-wrap::after { animation-delay: 2.05s; }
@keyframes login-ring {
    0%   { opacity: 0.65; transform: scale(0.72); }
    55%  { opacity: 0;    transform: scale(1.7); }
    100% { opacity: 0;    transform: scale(1.7); }
}

/* ---- the title assembles letter by letter, then a light band walks it ----
   NOT background-clip:text - transformed child spans escape the clip in
   Chromium and the glyphs turn invisible. The shine is an overlay band. */
.login-title {
    position: relative;
    overflow: hidden;
}
.login-title::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg,
        transparent 38%, rgba(191, 127, 255, 0.45) 48%, rgba(255, 255, 255, 0.5) 52%,
        rgba(236, 72, 153, 0.35) 56%, transparent 66%);
    background-size: 260% 100%;
    background-position: 120% 0;
    mix-blend-mode: screen;
    animation: login-title-shine 7s ease-in-out 2.2s infinite;
    pointer-events: none;
}
:root[data-theme="light"] .login-title::after { mix-blend-mode: multiply; opacity: 0.5; }
@keyframes login-title-shine {
    0%, 55% { background-position: 120% 0; }
    78%, 100% { background-position: -20% 0; }
}
.login-title .lt {
    display: inline-block;
    animation: login-letter 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
    animation-delay: calc(var(--i) * 42ms + 0.4s);
}
@keyframes login-letter {
    0%   { opacity: 0; transform: translateY(16px) rotateX(70deg) scale(0.8); filter: blur(6px); }
    100% { opacity: 1; transform: translateY(0) rotateX(0) scale(1); filter: blur(0); }
}
.login-sub {
    animation: login-sub-in 0.9s ease-out 1.1s both;
}
@keyframes login-sub-in {
    0%   { opacity: 0; letter-spacing: 0.34em; filter: blur(5px); }
    100% { opacity: 1; letter-spacing: normal; filter: blur(0); }
}

/* ---- fields: the ONLY part of the login FX that is not decoration ---------
   The HUD corner brackets, the ignite beam, the 22px focus bloom and the 1px
   lift on focus all used to live here. They are gone: every one of them drew
   outside the input, and the focus answer is now the contained inset ring in
   the shared block near the top of this file - the same one /register, /forgot
   and /reset get. This is deliberately NOT a login-only treatment any more.

   What survives is the tint, because it sits under the text inside the border
   box and never crosses it. .field keeps `position: relative` only so that a
   future absolutely-positioned child (a reveal-password toggle) has something
   to anchor to; the old `padding: 5px 6px 7px` went with the brackets it was
   making room for, which also makes a login field exactly as wide as the same
   field on /register.

   Do not reintroduce a transform on focus. A control that moves when it is
   focused is the same class of bug as a panel that jumps when its content
   grows, and the field sits directly under the caret the user is aiming at. */
.login-fx .field { position: relative; }
.login-fx .field .input {
    background: linear-gradient(180deg, rgba(191, 127, 255, 0.05), rgba(124, 58, 237, 0.02));
}

/* ---- buttons: the primary and the ghost take turns glowing; a sheen sweeps
   the primary; the four OAuth cells breathe one after another ---- */
.login-fx .btn-primary,
.login-fx .auth-actions .btn-ghost {
    position: relative;
    overflow: hidden;
    animation: login-btn-glow 4.2s ease-in-out infinite;
}
.login-fx .auth-actions .btn-ghost { animation-delay: 2.1s; }
@keyframes login-btn-glow {
    0%, 100% { box-shadow: 0 0 0 rgba(124, 58, 237, 0); }
    12%      { box-shadow: 0 0 22px rgba(124, 58, 237, 0.55), 0 0 4px rgba(191, 127, 255, 0.4); }
    30%      { box-shadow: 0 0 0 rgba(124, 58, 237, 0); }
}
.login-fx .btn-primary::after {
    content: "";
    position: absolute;
    top: -60%; bottom: -60%;
    left: -30%;
    width: 34%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.34), transparent);
    transform: skewX(-18deg) translateX(-140%);
    animation: login-sheen 4.2s ease-in-out 0.9s infinite;
    pointer-events: none;
}
@keyframes login-sheen {
    0%, 55% { transform: skewX(-18deg) translateX(-160%); }
    72%     { transform: skewX(-18deg) translateX(520%); }
    100%    { transform: skewX(-18deg) translateX(520%); }
}
.login-fx .oauth-btn { animation: login-oauth-breathe 4.8s ease-in-out infinite; }
.login-fx .oauth-grid > :nth-child(1) .oauth-btn,
.login-fx .oauth-grid > :nth-child(1).oauth-cell .oauth-btn { animation-delay: 0s; }
.login-fx .oauth-grid > :nth-child(2) { animation-delay: 1.2s; }
.login-fx .oauth-grid > :nth-child(3) { animation-delay: 2.4s; }
.login-fx .oauth-grid > :nth-child(4) { animation-delay: 3.6s; }
.login-fx .oauth-grid > .oauth-btn:hover:not(:disabled) { transform: translateY(-2px); }
@keyframes login-oauth-breathe {
    0%, 100% { border-color: var(--chronos-outline); box-shadow: 0 0 0 rgba(191, 127, 255, 0); }
    10%      { border-color: rgba(191, 127, 255, 0.75); box-shadow: 0 0 16px rgba(124, 58, 237, 0.35); }
    26%      { border-color: var(--chronos-outline); box-shadow: 0 0 0 rgba(191, 127, 255, 0); }
}

/* ---- kill switches: user asked for calm, or the script bailed ---- */
.login-fx.fx-off .login-canvas,
.login-fx.fx-off .login-spotlight { display: none; }
@media (prefers-reduced-motion: reduce) {
    .login-fx *, .login-fx *::before, .login-fx *::after { animation: none !important; }
    .login-canvas, .login-spotlight { display: none; }
    .login-aurora::before, .login-aurora::after { animation: none; }
    .login-title { -webkit-text-fill-color: currentColor; background: none; }
}

