/**
 * Glassmorphism login page.
 *
 * Standalone stylesheet — deliberately does not depend on black-dashboard.css,
 * so the login screen can be restyled without touching the rest of the panel.
 */

:root {
    --glass-accent: #e14eca;
    --glass-accent-strong: #ba54f5;
    --glass-bg: #0d0b14;
    --glass-text: #ffffff;
    --glass-muted: rgba(255, 255, 255, 0.62);
    --glass-line: rgba(255, 255, 255, 0.22);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body.glass-login {
    margin: 0;
    background: var(--glass-bg);
    color: var(--glass-text);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* ---------- shader backdrop ---------- */

.glass-stage {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.smokey-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* Painted behind the canvas so there is never a black flash before WebGL
       starts, and so it stands in entirely when WebGL is unavailable. */
    background:
        radial-gradient(circle at 20% 25%, rgba(225, 78, 202, 0.35), transparent 55%),
        radial-gradient(circle at 78% 70%, rgba(186, 84, 245, 0.28), transparent 55%),
        var(--glass-bg);
}

.smokey-layer canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.smokey-layer canvas.smokey-unsupported {
    display: none;
}

/* Blur plus a dark scrim and vignette: the raw shader at full brightness
   overpowers the card, so this pulls the backdrop back behind the content. */
.smokey-blur {
    position: absolute;
    inset: 0;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    background:
        radial-gradient(ellipse at center, rgba(9, 7, 16, 0.35) 0%, rgba(9, 7, 16, 0.78) 100%),
        rgba(9, 7, 16, 0.32);
}

/* ---------- layout ---------- */

.glass-content {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
}

/* ---------- card ---------- */

.glass-card {
    width: 100%;
    max-width: 26rem;
    padding: 2.25rem 2rem;
    background: rgba(255, 255, 255, 0.09);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 1.25rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.glass-head {
    text-align: center;
    margin-bottom: 2rem;
}

.glass-head h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.glass-head p {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--glass-muted);
}

/* ---------- alerts ---------- */

.glass-alert {
    margin-bottom: 1.5rem;
    padding: 0.7rem 0.9rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: #ffd7e8;
    background: rgba(220, 53, 96, 0.18);
    border: 1px solid rgba(255, 96, 150, 0.45);
    border-radius: 0.65rem;
}

.glass-alert.is-success {
    color: #ccffe6;
    background: rgba(0, 191, 122, 0.16);
    border-color: rgba(0, 218, 140, 0.45);
}

.glass-alert p {
    margin: 0;
}

.glass-alert p + p {
    margin-top: 0.35rem;
}

/* ---------- floating-label fields ---------- */

.glass-field {
    position: relative;
    margin-bottom: 2.25rem;
}

.glass-field input {
    display: block;
    width: 100%;
    padding: 0.65rem 0 0.65rem 1.65rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--glass-text);
    background: transparent;
    border: 0;
    border-bottom: 2px solid var(--glass-line);
    border-radius: 0;
    outline: none;
    transition: border-color 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
}

.glass-field input:focus {
    border-bottom-color: var(--glass-accent);
}

.glass-field input:-webkit-autofill,
.glass-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--glass-text);
    -webkit-box-shadow: 0 0 0 1000px rgba(20, 16, 30, 0.9) inset;
    caret-color: var(--glass-text);
}

.glass-field label {
    position: absolute;
    left: 1.65rem;
    top: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--glass-muted);
    pointer-events: none;
    transform-origin: 0 0;
    transition: transform 0.25s ease, color 0.25s ease;
}

/* Raised state: whenever the field is focused or already holds a value.
   The blank placeholder on the input is what makes :placeholder-shown work. */
.glass-field input:focus + label,
.glass-field input:not(:placeholder-shown) + label {
    transform: translate(-1.65rem, -1.55rem) scale(0.78);
}

.glass-field input:focus + label {
    color: var(--glass-accent);
}

.glass-field label svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* The icon stays pinned to the input while the text label floats up. */
.glass-field .field-icon {
    position: absolute;
    left: 0;
    top: 0.72rem;
    width: 16px;
    height: 16px;
    color: var(--glass-muted);
    pointer-events: none;
    transition: color 0.25s ease;
}

.glass-field input:focus ~ .field-icon {
    color: var(--glass-accent);
}

.glass-field.has-error input {
    border-bottom-color: #ff6096;
}

/* ---------- security code (anti-bot) ---------- */

.glass-security {
    margin-bottom: 1.5rem;
    padding: 0.85rem 0.95rem 0.95rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.75rem;
}

.glass-security-label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--glass-muted);
}

.glass-security-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.glass-security-digits {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.glass-digit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.4rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #f6b24a;
    background: rgba(246, 178, 74, 0.12);
    border: 1px solid rgba(246, 178, 74, 0.55);
    border-radius: 0.5rem;
    /* Slightly randomised feel; discourages trivial OCR alignment. */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    user-select: none;
}

.glass-security-arrow {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--glass-muted);
}

.glass-security-input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    color: var(--glass-text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
}

.glass-security-input::placeholder {
    letter-spacing: normal;
    color: rgba(255, 255, 255, 0.4);
}

.glass-security-input:focus {
    border-color: #f6b24a;
}

.glass-security.has-error {
    border-color: rgba(255, 96, 150, 0.5);
}

.glass-security.has-error .glass-security-input {
    border-color: #ff6096;
}

/* ---------- helper row ---------- */

.glass-helpers {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-bottom: 1.75rem;
    font-size: 0.75rem;
}

.glass-link {
    color: var(--glass-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.glass-link:hover,
.glass-link:focus {
    color: var(--glass-text);
    text-decoration: none;
}

/* ---------- submit ---------- */

.glass-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1rem;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
    background-image: linear-gradient(to bottom left, var(--glass-accent-strong), var(--glass-accent), var(--glass-accent-strong));
    background-size: 210% 210%;
    background-position: top right;
    border: 0;
    border-radius: 0.7rem;
    cursor: pointer;
    transition: background-position 0.35s ease, box-shadow 0.25s ease, transform 0.15s ease;
}

.glass-submit:hover {
    background-position: bottom left;
    box-shadow: 0 12px 28px -10px rgba(225, 78, 202, 0.8);
}

.glass-submit:active {
    transform: translateY(1px);
}

.glass-submit:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.glass-submit svg {
    width: 18px;
    height: 18px;
    transition: transform 0.25s ease;
}

.glass-submit:hover svg {
    transform: translateX(3px);
}

/* ---------- footer ---------- */

.glass-foot {
    margin: 1.5rem 0 0;
    font-size: 0.72rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.45);
}

/* ---------- responsive ---------- */

@media (max-width: 480px) {
    .glass-card {
        padding: 1.75rem 1.35rem;
        border-radius: 1rem;
    }

    .glass-head h1 {
        font-size: 1.5rem;
    }

}

/* Short viewports (landscape phones): let the page scroll rather than clip. */
@media (max-height: 620px) {
    body.glass-login {
        overflow: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .glass-submit,
    .glass-submit svg,
    .glass-field input,
    .glass-field label {
        transition: none;
    }
}
