/* ============================================================
   IDT ONLINE PLUS - STUDENT APP · SIGN IN & PASSWORD RESET
   1. Tokens      4. Card & form    7. Steps & OTP
   2. Base        5. Buttons        8. Password meter
   3. Shell/hero  6. Alerts & toast 9. Desktop
   ============================================================ */

/* ============================================================
   1. TOKENS
   ============================================================ */

:root {
    --primary: #e3262f;
    --primary-rgb: 227, 38, 47;
    --primary-600: color-mix(in srgb, var(--primary) 82%, #000);
    --primary-50: color-mix(in srgb, var(--primary) 8%, #fff);
    --primary-100: color-mix(in srgb, var(--primary) 16%, #fff);

    --hero: #0f1320;
    --hero-2: #171c2c;
    --bg: #f4f5f9;
    --card: #ffffff;
    --field: #f6f7fa;
    --ink: #121826;
    --ink-2: #3d4556;
    --muted: #7b8194;
    --line: #e5e7ee;
    --ok: #15924f;
    --ok-bg: #e7f6ee;
    --warn: #b7700a;
    --warn-bg: #fdf4e3;
    --bad: #d93a40;
    --bad-bg: #fdecec;
    --info: #0b84c6;
    --info-bg: #e5f4fc;

    --radius: 16px;
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
    --primary-50: color-mix(in srgb, var(--primary) 14%, #161a23);
    --primary-100: color-mix(in srgb, var(--primary) 24%, #161a23);
    --hero: #090b12;
    --hero-2: #10131d;
    --bg: #0d1016;
    --card: #161a23;
    --field: #1d222d;
    --ink: #eceef3;
    --ink-2: #c3c8d4;
    --muted: #8a91a3;
    --line: #2a303d;
    --ok-bg: rgba(63, 202, 127, 0.14);
    --ok: #3fca7f;
    --warn-bg: rgba(240, 180, 76, 0.14);
    --warn: #f0b44c;
    --bad-bg: rgba(229, 72, 77, 0.16);
    --bad: #ff7b80;
    --info-bg: rgba(76, 182, 240, 0.14);
    --info: #4cb6f0;
}

/* ============================================================
   2. BASE
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body.auth-body {
    min-height: 100dvh;
    background: var(--hero);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
    color: inherit;
}

.d-none {
    display: none !important;
}

.text-center {
    text-align: center;
}

/* ============================================================
   3. SHELL & HERO
   ============================================================ */

.auth-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.auth-hero {
    position: relative;
    overflow: hidden;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 22px 54px;
    background: linear-gradient(160deg, var(--hero-2) 0%, var(--hero) 70%);
    color: #ffffff;
}

.auth-hero-glow {
    position: absolute;
    top: -120px;
    right: -90px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.55) 0%, rgba(var(--primary-rgb), 0) 70%);
    pointer-events: none;
}

.auth-hero::after {
    content: "";
    position: absolute;
    left: -60px;
    bottom: -80px;
    width: 220px;
    height: 220px;
    border: 28px solid rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    pointer-events: none;
}

.auth-hero > *:not(.auth-hero-glow) {
    position: relative;
    z-index: 1;
}

.auth-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.auth-brand-mark {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    padding: 6px;
    border-radius: 12px;
    background: #ffffff;
}

.auth-brand-mark img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.auth-brand-txt {
    min-width: 0;
}

.auth-brand-txt b {
    display: block;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.auth-brand-txt small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11.5px;
    font-weight: 600;
}

.auth-hero-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 99px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.auth-hero-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

.auth-hero-copy {
    margin-top: 28px;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 99px;
    background: rgba(var(--primary-rgb), 0.22);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
}

.auth-hero h1 {
    max-width: 440px;
    margin: 14px 0 8px;
    font-size: 25px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.auth-hero p {
    max-width: 420px;
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13.5px;
}

.auth-points,
.auth-hero-foot {
    display: none;
}

.auth-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: -28px;
    padding: 0 0 calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 28px 28px 0 0;
    background: var(--card);
    position: relative;
    z-index: 2;
}

/* ============================================================
   4. CARD & FORM
   ============================================================ */

.auth-card {
    width: 100%;
    padding: 26px 22px 8px;
}

.auth-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.auth-card-ic,
.auth-step-ic {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--primary-50);
    color: var(--primary);
    font-size: 21px;
}

.auth-card-head h2,
.auth-step-title {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 800;
}

.auth-card-head p,
.auth-step-text {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-step-ic {
    margin-bottom: 14px;
}

.auth-step-text {
    margin: 6px 0 18px;
}

.auth-step-text b {
    color: var(--ink);
}

.auth-form {
    display: block;
}

.auth-field {
    display: block;
    margin-bottom: 14px;
}

.auth-label {
    display: block;
    margin-bottom: 6px;
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 700;
}

.auth-input {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 14px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: var(--field);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.auth-input > i {
    color: var(--muted);
    font-size: 17px;
}

.auth-input:focus-within {
    border-color: var(--primary);
    background: var(--card);
}

.auth-input:focus-within > i {
    color: var(--primary);
}

.auth-input input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
}

.auth-input input::placeholder {
    color: var(--muted);
    font-weight: 400;
}

.auth-field.has-error .auth-input {
    border-color: var(--bad);
}

.auth-eye {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-right: -6px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 17px;
    cursor: pointer;
}

.auth-eye:hover {
    background: var(--line);
}

.auth-error {
    display: block;
    min-height: 0;
    margin-top: 5px;
    color: var(--bad);
    font-size: 12px;
    font-weight: 600;
}

.auth-error:empty {
    display: none;
}

.auth-caps {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    color: var(--warn);
    font-size: 12px;
    font-weight: 600;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0 18px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.auth-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-switch {
    position: relative;
    flex-shrink: 0;
    width: 36px;
    height: 21px;
    border-radius: 99px;
    background: var(--line);
    transition: background 0.2s ease;
}

.auth-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s ease;
}

.auth-check input:checked + .auth-switch {
    background: var(--primary);
}

.auth-check input:checked + .auth-switch::after {
    transform: translateX(15px);
}

.auth-check input:focus-visible + .auth-switch {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.auth-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 14px 0 0;
    padding: 11px 12px;
    border-radius: 12px;
    background: var(--field);
    color: var(--muted);
    font-size: 12.5px;
}

.auth-note i {
    margin-top: 1px;
    color: var(--primary);
}

.auth-or {
    position: relative;
    margin: 16px 0;
    text-align: center;
}

.auth-or::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid var(--line);
}

.auth-or span {
    position: relative;
    padding: 0 12px;
    background: var(--card);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.auth-bio-user {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.auth-bio-user:empty {
    display: none;
}

.auth-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.auth-foot a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-2);
    font-weight: 700;
}

.auth-foot a:hover {
    color: var(--primary);
}

.auth-help {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px 14px;
    flex-wrap: wrap;
    margin-top: auto;
    padding: 14px 22px 0;
    color: var(--muted);
    font-size: 12.5px;
}

.auth-help a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ink-2);
    font-weight: 700;
}

.auth-help a:hover {
    color: var(--primary);
}

/* ============================================================
   5. BUTTONS
   ============================================================ */

.auth-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background: var(--primary);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.12s ease, opacity 0.2s ease;
}

.auth-btn:hover {
    background: var(--primary-600);
}

.auth-btn:active {
    transform: scale(0.985);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-btn.outline {
    border: 1.5px solid var(--line);
    background: var(--card);
    color: var(--ink);
}

.auth-btn.outline:hover {
    border-color: var(--primary);
    background: var(--primary-50);
}

.auth-btn.outline i {
    color: var(--primary);
    font-size: 19px;
}

.auth-btn-txt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-spin {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

.auth-btn.outline .auth-spin {
    border-color: var(--line);
    border-top-color: var(--primary);
}

.auth-btn.is-loading {
    pointer-events: none;
}

.auth-btn.is-loading .auth-btn-txt {
    display: none;
}

.auth-btn.is-loading .auth-spin {
    display: block;
}

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

/* ============================================================
   6. ALERTS & TOAST
   ============================================================ */

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 16px;
    padding: 11px 13px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}

.auth-alert i {
    margin-top: 1px;
    font-size: 15px;
}

.auth-alert.is-danger {
    background: var(--bad-bg);
    color: var(--bad);
}

.auth-alert.is-warning {
    background: var(--warn-bg);
    color: var(--warn);
}

.auth-alert.is-success {
    background: var(--ok-bg);
    color: var(--ok);
}

.auth-alert.is-info {
    background: var(--info-bg);
    color: var(--info);
}

.auth-toast {
    position: fixed;
    left: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    max-width: calc(100% - 32px);
    padding: 11px 16px;
    border-radius: 12px;
    background: #121826;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.auth-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ============================================================
   7. STEPS & OTP
   ============================================================ */

.auth-steps {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 22px;
}

.auth-steps > i {
    flex: 1;
    height: 2px;
    margin-top: 14px;
    border-radius: 2px;
    background: var(--line);
    transition: background 0.3s ease;
}

.auth-steps > i.done {
    background: var(--primary);
}

.auth-steps span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 54px;
}

.auth-steps b {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--card);
    color: var(--muted);
    font-size: 12.5px;
    transition: all 0.25s ease;
}

.auth-steps small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.auth-steps span.active b {
    border-color: var(--primary);
    color: var(--primary);
}

.auth-steps span.active small {
    color: var(--ink);
}

.auth-steps span.done b {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.auth-step {
    display: none;
}

.auth-step.is-active {
    display: block;
    animation: auth-in 0.3s ease;
}

@keyframes auth-in {
    from {
        opacity: 0;
        transform: translateX(14px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.otp-boxes {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    max-width: 360px;
    margin: 0 auto;
}

.otp-boxes input {
    width: 100%;
    height: 54px;
    padding: 0;
    border: 1.5px solid var(--line);
    border-radius: 13px;
    outline: 0;
    background: var(--field);
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.otp-boxes input:focus {
    border-color: var(--primary);
    background: var(--card);
}

.otp-boxes input.filled {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
    background: var(--primary-50);
}

.otp-boxes.has-error input {
    border-color: var(--bad);
    animation: auth-shake 0.35s ease;
}

@keyframes auth-shake {
    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.otp-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 16px 0 18px;
    color: var(--muted);
    font-size: 13px;
}

.otp-meta b {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.auth-done {
    padding: 8px 0 4px;
    text-align: center;
}

.auth-done-ic {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 4px auto 16px;
    border-radius: 50%;
    background: var(--ok-bg);
    color: var(--ok);
    font-size: 38px;
    animation: auth-pop 0.4s ease;
}

.auth-done .auth-step-text {
    margin-bottom: 22px;
}

@keyframes auth-pop {
    from {
        transform: scale(0.6);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================================
   8. PASSWORD METER
   ============================================================ */

.pw-meter {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin: -4px 0 10px;
}

.pw-meter span {
    height: 4px;
    border-radius: 4px;
    background: var(--line);
    transition: background 0.25s ease;
}

.pw-meter[data-score="1"] span:nth-child(-n + 1) {
    background: var(--bad);
}

.pw-meter[data-score="2"] span:nth-child(-n + 2) {
    background: var(--warn);
}

.pw-meter[data-score="3"] span:nth-child(-n + 3) {
    background: #2f9e44;
}

.pw-meter[data-score="4"] span {
    background: var(--ok);
}

.pw-rules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.pw-rules li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pw-rules li.ok {
    color: var(--ok);
}

/* ============================================================
   9. DESKTOP & TABLET
   ============================================================ */

@media (min-width: 576px) {
    .auth-card {
        max-width: 460px;
        margin: 0 auto;
        padding-top: 30px;
    }

    .auth-hero-copy {
        max-width: 460px;
        margin: 34px auto 0;
    }
}

@media (min-width: 992px) {
    body.auth-body {
        background: var(--bg);
    }

    .auth-shell {
        flex-direction: row;
    }

    .auth-hero {
        display: flex;
        flex-direction: column;
        position: sticky;
        top: 0;
        width: 46%;
        max-width: 620px;
        height: 100dvh;
        padding: 34px 48px;
    }

    .auth-hero-glow {
        top: -160px;
        right: -140px;
        width: 460px;
        height: 460px;
    }

    .auth-hero-copy {
        max-width: none;
        margin: auto 0 0;
    }

    .auth-hero h1 {
        font-size: 34px;
    }

    .auth-hero p {
        font-size: 15px;
    }

    .auth-points {
        display: grid;
        gap: 14px;
        margin: 34px 0 auto;
        padding: 0;
        list-style: none;
    }

    .auth-points li {
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .auth-points li > span {
        display: grid;
        place-items: center;
        flex-shrink: 0;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.07);
        color: #ffffff;
        font-size: 18px;
    }

    .auth-points b {
        display: block;
        font-size: 14px;
    }

    .auth-points small {
        color: rgba(255, 255, 255, 0.6);
        font-size: 12.5px;
    }

    .auth-hero-foot {
        display: block;
        margin: 0;
        color: rgba(255, 255, 255, 0.45);
        font-size: 12px;
    }

    .auth-panel {
        flex: 1;
        justify-content: center;
        margin: 0;
        padding: 40px 32px;
        border-radius: 0;
        background: var(--bg);
    }

    .auth-card {
        max-width: 460px;
        padding: 34px 34px 22px;
        border: 1px solid var(--line);
        border-radius: 24px;
        background: var(--card);
        box-shadow: 0 1px 2px rgba(18, 24, 38, 0.04);
    }

    .auth-help {
        margin-top: 18px;
    }
}

@media (max-width: 360px) {
    .auth-card {
        padding: 22px 16px 8px;
    }

    .otp-boxes {
        gap: 6px;
    }

    .otp-boxes input {
        height: 48px;
        font-size: 19px;
    }

    .pw-rules {
        grid-template-columns: 1fr;
    }
}
