/* NexaHub 2FA — shared, cacheable presentation styles. */
:root {
    color-scheme: light;
    --ink: #17122f;
    --muted: #6f6982;
    --violet: #7447ed;
    --violet-deep: #5627d7;
    --cyan: #15bce8;
    --success: #16865e;
    --danger: #c93b5e;
    --surface: rgba(255, 255, 255, 0.94);
    --surface-strong: rgba(255, 255, 255, 0.94);
    --line: rgba(91, 66, 161, 0.14);
    --shadow: 0 26px 80px rgba(58, 36, 119, 0.22),
              0 8px 24px rgba(28, 22, 54, 0.10);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    isolation: isolate;
    overflow-x: hidden;
    color: var(--ink);
    background: #eae6f8;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

.backdrop,
.backdrop::after {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.backdrop {
    z-index: -3;
    background-image: url("../images/IMG_Desktop.PNG");
    background-image: image-set(
        url("../images/IMG_Desktop.webp") type("image/webp"),
        url("../images/IMG_Desktop.PNG") type("image/png")
    );
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.backdrop::after {
    content: "";
    z-index: 0;
    background:
        radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.12) 0 18%, transparent 58%),
        linear-gradient(180deg, rgba(30, 12, 70, 0.06), rgba(23, 9, 52, 0.18));
}

.ambient-orb {
    position: fixed;
    z-index: -1;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    opacity: 0.25;
    pointer-events: none;
}

.ambient-orb--violet {
    top: 14%;
    left: 27%;
    background: radial-gradient(circle, rgba(140, 82, 255, 0.75), transparent 70%);
}

.ambient-orb--cyan {
    right: 25%;
    bottom: 12%;
    background: radial-gradient(circle, rgba(24, 197, 239, 0.75), transparent 70%);
}

.page-shell {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: clamp(20px, 4vw, 48px);
}

.auth-card {
    position: relative;
    width: min(100%, 410px);
    min-width: 0;
    padding: clamp(24px, 5vw, 30px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: cardArrive 250ms ease-out both;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--violet), var(--cyan), transparent);
    opacity: 0.78;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    margin-bottom: 12px;
}

.brand-mark {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    color: #fff;
    border-radius: 17px;
    background: linear-gradient(145deg, #8e5aff, var(--violet-deep) 62%, #2c99eb);
    box-shadow: 0 12px 26px rgba(96, 50, 218, 0.32), inset 0 1px 1px rgba(255, 255, 255, 0.42);
}

.brand-mark svg {
    width: 27px;
    height: 27px;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--violet);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.13em;
}

h1 {
    margin: 0;
    font-size: clamp(1.4rem, 5vw, 1.9rem);
    line-height: 1.1;
    letter-spacing: -0.035em;
}

.intro {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 0.96rem;
    line-height: 1.55;
}

.field-label {
    display: inline-block;
    margin: 0 0 8px 3px;
    color: #37304c;
    font-size: 0.88rem;
    font-weight: 700;
}

.input-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 17px;
    width: 20px;
    height: 20px;
    color: #8c85a0;
    pointer-events: none;
    transform: translateY(-50%);
    transition: color 180ms ease;
}

.email-input {
    width: 100%;
    min-height: 54px;
    font-size: 1rem;
    padding: 0 17px 0 48px;
    color: var(--ink);
    outline: none;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: inset 0 1px 2px rgba(37, 22, 73, 0.04);
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.email-input::placeholder {
    color: #aaa4b7;
}

.email-input:hover {
    border-color: rgba(116, 71, 237, 0.28);
    background: rgba(255, 255, 255, 0.9);
}

.email-input:focus {
    border-color: rgba(116, 71, 237, 0.66);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(116, 71, 237, 0.11);
}

.input-wrap:focus-within .input-icon {
    color: var(--violet);
}

.generate-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 54px;
    margin-top: 13px;
    overflow: hidden;
    color: #fff;
    cursor: pointer;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(115deg, var(--violet-deep), var(--violet) 54%, #3f8fe8);
    box-shadow: 0 13px 25px rgba(92, 49, 207, 0.27);
    font-weight: 800;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.generate-button::before {
    content: "";
    position: absolute;
    top: -80%;
    left: -38%;
    width: 26%;
    height: 260%;
    background: rgba(255, 255, 255, 0.28);
    transform: rotate(24deg);
    transition: left 550ms ease;
}

.generate-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 17px 30px rgba(92, 49, 207, 0.32);
    filter: saturate(108%);
}

.generate-button:hover:not(:disabled)::before {
    left: 118%;
}

.generate-button:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

.generate-button:focus-visible,
.copy-button:focus-visible {
    outline: 3px solid rgba(20, 188, 232, 0.42);
    outline-offset: 3px;
}

.generate-button svg {
    width: 19px;
    height: 19px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 25px 0 17px;
    color: #8b849a;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.result-panel {
    position: relative;
    min-height: 150px;
    padding: 19px;
    overflow: hidden;
    border: 1px solid rgba(94, 65, 171, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.55);
}

.result-panel--success {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(242, 237, 255, 0.82));
    box-shadow: 0 10px 30px rgba(116, 71, 237, 0.1);
}

.result-panel--error {
    border-color: rgba(201, 59, 94, 0.18);
    background: rgba(255, 245, 248, 0.76);
}

.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 28px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.status-badge::before {
    content: "";
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #aaa4b8;
    box-shadow: 0 0 0 4px rgba(170, 164, 184, 0.13);
}

.result-panel--success .status-badge {
    color: var(--success);
}

.result-panel--success .status-badge::before {
    background: #20b880;
    box-shadow: 0 0 0 4px rgba(32, 184, 128, 0.13);
}

.result-panel--error .status-badge {
    color: var(--danger);
}

.result-panel--error .status-badge::before {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(201, 59, 94, 0.12);
}

.copy-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 10px;
    color: #5b3fb1;
    cursor: pointer;
    border: 1px solid rgba(116, 71, 237, 0.14);
    border-radius: 10px;
    background: rgba(116, 71, 237, 0.07);
    font-size: 0.75rem;
    font-weight: 800;
    transition: background 160ms ease, transform 160ms ease;
}

.copy-button:hover:not(:disabled) {
    background: rgba(116, 71, 237, 0.13);
    transform: translateY(-1px);
}

.copy-button svg {
    width: 15px;
    height: 15px;
}

.code {
    display: flex;
    justify-content: center;
    gap: clamp(4px, 1.8vw, 8px);
    margin: 15px 0 13px;
    color: var(--violet-deep);
    font-size: clamp(2rem, 8.5vw, 2.7rem);
    font-variant-numeric: tabular-nums;
    font-weight: 850;
    letter-spacing: -0.035em;
    line-height: 1;
}

.code-digit {
    display: inline-block;
}

.result-panel--error .code {
    display: block;
    text-align: center;
    color: var(--danger);
    font-size: 1.45rem;
    letter-spacing: -0.02em;
}

.result-panel--idle .code {
    color: #b1aabd;
}

.result-note {
    margin: 0;
    color: var(--muted);
    text-align: center;
    font-size: 0.83rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.83rem;
}

.timer-ring {
    --progress: 360deg;
    position: relative;
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: conic-gradient(var(--violet) var(--progress), rgba(116, 71, 237, 0.12) 0);
}

.timer-ring::after {
    content: "";
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #faf8ff;
}

.timer-value {
    color: #42395a;
    font-weight: 850;
}

body.is-refreshing .generate-button svg {
    animation: spin 700ms linear infinite;
}

body.is-refreshing .generate-button {
    pointer-events: none;
    filter: saturate(70%);
}

@keyframes cardArrive {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 700px) {
    .backdrop {
        background-image: url("../images/IMG_Mobile.jpg");
        background-position: center;
    }

    .page-shell {
        align-items: start;
        justify-items: center;
        padding: clamp(32px, 12vh, 112px) 16px 24px;
        padding: clamp(32px, 12svh, 112px) 16px 24px;
    }

    .auth-card {
        width: min(100%, 370px);
        padding: 22px;
        border-radius: 24px;
    }

    .brand {
        margin-bottom: 10px;
    }

    .brand-mark {
        width: 48px;
        height: 48px;
        border-radius: 15px;
    }

    .intro {
        margin-bottom: 18px;
    }

    .email-input,
    .generate-button {
        min-height: 50px;
    }

    .divider {
        margin: 19px 0 13px;
    }

    .result-panel {
        min-height: 136px;
        padding: 16px;
    }

    .ambient-orb--violet {
        left: -18%;
    }

    .ambient-orb--cyan {
        right: -22%;
    }
}

@media (max-width: 390px) {
    .auth-card {
        width: min(100%, 350px);
        padding: 19px 18px;
        border-radius: 21px;
    }

    .brand-mark {
        width: 47px;
        height: 47px;
        border-radius: 15px;
    }

    .intro {
        margin-bottom: 20px;
    }

    .result-panel {
        padding-inline: 14px;
    }
}


/* Keep semantic visibility authoritative when component styles use flex/grid. */
[hidden] {
    display: none !important;
}

button:disabled {
    cursor: default;
    opacity: 0.65;
    transform: none;
}

.result-panel--loading,
.result-panel--expired {
    background: rgba(255, 251, 240, 0.92);
    border-color: rgba(155, 105, 24, 0.23);
}

.result-panel--loading .status-badge,
.result-panel--expired .status-badge {
    color: #885a10;
}

.result-panel--loading .status-badge::before,
.result-panel--expired .status-badge::before {
    background: #a87721;
    box-shadow: 0 0 0 4px rgba(168, 119, 33, 0.12);
}

.result-panel--loading .code,
.result-panel--expired .code {
    color: #8d859f;
}

.status-message {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.status-message--error {
    color: var(--danger);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-height: 700px) {
    .page-shell {
        align-items: start;
        padding-top: 24px;
        padding-bottom: 24px;
    }
}

@media (max-width: 340px) {
    .page-shell {
        padding-inline: 12px;
    }

    .auth-card {
        padding-inline: 16px;
    }

    .brand {
        gap: 10px;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
    }

    .eyebrow {
        font-size: 0.65rem;
        letter-spacing: 0.08em;
    }

    .result-panel {
        padding-inline: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
