/* =====================================================================
   Pre-sign-in pages (login, forgot password, register)
   Light glass theme shared through frontend/auth_layout.blade.php.
   ===================================================================== */

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

:root {
    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-ring: rgba(79, 70, 229, 0.16);
    --gold: #f59e0b;
    --gold-700: #b45309;
    --ink: #0f172a;
    --text: #334155;
    --muted: #64748b;
    --faint: #94a3b8;
    --border: #e2e8f0;
    --glass: rgba(255, 255, 255, 0.66);
    --glass-strong: rgba(255, 255, 255, 0.86);
    --glass-border: rgba(255, 255, 255, 0.95);
    --danger: #dc2626;
    --success: #047857;
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

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

body {
    font-family: var(--font-body);
    color: var(--text);
    background: #e9eef8;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ====== Animated colour wash ====== */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background: linear-gradient(140deg, #eef2ff 0%, #f8fafc 45%, #fff7ed 100%);
}
.auth-bg span {
    position: absolute;
    border-radius: 50%;
    filter: blur(64px);
}
.auth-bg .blob-1 {
    width: 560px; height: 560px;
    top: -180px; left: -140px;
    background: rgba(99, 102, 241, 0.42);
}
.auth-bg .blob-2 {
    width: 520px; height: 520px;
    top: -120px; right: -160px;
    background: rgba(245, 158, 11, 0.32);
}
.auth-bg .blob-3 {
    width: 620px; height: 620px;
    bottom: -260px; left: 28%;
    background: rgba(56, 189, 248, 0.36);
}
.auth-bg .blob-4 {
    width: 360px; height: 360px;
    bottom: -100px; right: -60px;
    background: rgba(236, 72, 153, 0.2);
}

/* ====== Glass shell ====== */
.auth-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1040px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border-radius: 28px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    -webkit-backdrop-filter: blur(26px) saturate(170%);
    backdrop-filter: blur(26px) saturate(170%);
    box-shadow:
        0 0 0 1px rgba(148, 163, 184, 0.16),
        0 40px 80px -30px rgba(30, 41, 59, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overflow: hidden;
    animation: shell-in 0.25s var(--ease) both;
}
@keyframes shell-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

/* ====== Brand panel ====== */
.auth-brand {
    position: relative;
    padding: 44px 44px 34px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 34px;
    border-right: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(165deg, rgba(238, 242, 255, 0.75) 0%, rgba(255, 255, 255, 0.25) 55%, rgba(255, 247, 237, 0.6) 100%);
}

.brand-logo {
    display: block;
    width: 172px;
    max-width: 60%;
    height: auto;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--gold-700);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    margin-bottom: 18px;
}

.auth-brand h1 {
    font-family: var(--font-display);
    font-size: clamp(26px, 2.5vw, 34px);
    line-height: 1.15;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}
.auth-brand h1 span {
    background: linear-gradient(90deg, var(--primary), #7c3aed 55%, var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-lead {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 24px;
}

.highlights { list-style: none; display: grid; gap: 10px; }
.highlights li {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.12);
    transition: box-shadow 0.15s ease, background-color 0.15s ease;
}
.highlights li:hover {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.2), 0 12px 24px -16px rgba(30, 41, 59, 0.35);
}
.hl-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 10px;
    font-size: 14px;
    background: rgba(245, 158, 11, 0.14);
    color: var(--gold-700);
}
.hl-icon.indigo { background: var(--primary-50); color: var(--primary); }
.hl-icon.green { background: #d1fae5; color: var(--success); }
.highlights strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2px;
}
.highlights p { font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.brand-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    padding-top: 18px;
}
/* ====== Form panel ====== */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px 40px;
    background: rgba(255, 255, 255, 0.5);
}

.auth-card { width: 100%; max-width: 384px; }

/* Content rises in, 40ms apart; everything settles within ~0.4s */
.auth-card > *,
.auth-card form > * {
    animation: rise 0.25s var(--ease) both;
}
.auth-card > *:nth-child(2) { animation-delay: 0.04s; }
.auth-card > *:nth-child(3) { animation-delay: 0.08s; }
.auth-card > *:nth-child(n+4) { animation-delay: 0.12s; }
.auth-card form > *:nth-child(1) { animation-delay: 0.08s; }
.auth-card form > *:nth-child(2) { animation-delay: 0.1s; }
.auth-card form > *:nth-child(n+3) { animation-delay: 0.12s; }
.auth-brand > * { animation: rise 0.25s var(--ease) both; }
.auth-brand > *:nth-child(2) { animation-delay: 0.04s; }
.auth-brand > *:nth-child(3) { animation-delay: 0.08s; }
@keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.mobile-logo { display: none; margin: 0 auto 22px; width: fit-content; }
.mobile-logo img { display: block; width: 150px; height: auto; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease;
}
.back-link:hover { color: var(--primary); }

.auth-head { margin-bottom: 24px; }
.icon-badge {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    margin-bottom: 16px;
    font-size: 19px;
    color: var(--primary);
    background: linear-gradient(140deg, var(--primary-50), #ffffff);
    border: 1px solid var(--primary-100);
    box-shadow: 0 10px 22px -12px rgba(79, 70, 229, 0.55);
}
.icon-badge.gold { color: var(--gold-700); background: linear-gradient(140deg, #fef3c7, #ffffff); border-color: #fde68a; box-shadow: 0 10px 22px -12px rgba(245, 158, 11, 0.6); }
.icon-badge.green { color: var(--success); background: linear-gradient(140deg, #d1fae5, #ffffff); border-color: #a7f3d0; box-shadow: 0 10px 22px -12px rgba(16, 185, 129, 0.6); }
.auth-head h2 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.4px;
    line-height: 1.2;
    margin-bottom: 6px;
}
.auth-head p { font-size: 14px; color: var(--muted); line-height: 1.55; }
.auth-head p strong { color: var(--ink); font-weight: 600; word-break: break-all; }

/* ====== Stepper (forgot password) ====== */
.stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 26px;
}
.step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--faint);
    white-space: nowrap;
}
.step-dot {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.8);
    border: 1.5px solid var(--border);
    color: var(--faint);
    transition: all 0.3s var(--ease);
}
.step.active { color: var(--ink); }
.step.active .step-dot {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px var(--primary-ring);
}
.step.done { color: var(--success); }
.step.done .step-dot { background: #10b981; border-color: #10b981; color: #ffffff; }
.step-line {
    flex: 1;
    height: 2px;
    min-width: 12px;
    border-radius: 2px;
    background: var(--border);
    position: relative;
    overflow: hidden;
}
.step-line.done::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #10b981;
    transform-origin: left;
    animation: fill-line 0.3s var(--ease) 0.1s both;
}
@keyframes fill-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ====== Alerts ====== */
.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.45;
    margin-bottom: 20px;
    border: 1px solid transparent;
}
.alert i { margin-top: 2px; }
.alert.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert.success { background: #ecfdf5; color: var(--success); border-color: #a7f3d0; }
.alert.info { background: var(--primary-50); color: #3730a3; border-color: #c7d2fe; }
.alert a { color: inherit; font-weight: 700; text-decoration: underline; margin-left: 4px; }

/* ====== Fields ====== */
.field { margin-bottom: 18px; }
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.field-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}
.field label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field label .req { color: var(--danger); }
.field-top a {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.field-top a:hover { color: var(--primary-600); text-decoration: underline; }

.control { position: relative; }
.control .lead-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    font-size: 14px;
    pointer-events: none;
    transition: color 0.15s ease;
}
.control input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--ink);
    caret-color: var(--primary);
    font: 500 14.5px var(--font-body);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.control .lead-icon ~ input,
.control input.has-icon { padding-left: 44px; }
.control input.has-toggle { padding-right: 48px; }
.control input::placeholder { color: var(--faint); font-weight: 400; }
.control input:hover { border-color: rgba(100, 116, 139, 0.6); }
.control input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}
.control:focus-within .lead-icon { color: var(--primary); }
.control input:-webkit-autofill,
.control input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ink);
    -webkit-box-shadow: 0 0 0 1000px #f5f7ff inset;
    transition: background-color 9999s ease-out;
}
.field.has-error .control input { border-color: #fca5a5; }
.field.has-error .control input:focus { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12); }
.field.has-error { animation: shake 0.3s var(--ease); }
@keyframes shake {
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
}

.pw-toggle {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.pw-toggle:hover { color: var(--ink); background: rgba(15, 23, 42, 0.06); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
}
.hint.error { color: var(--danger); }
.hint.ok { color: var(--success); }
.hint.warn { color: var(--gold-700); }
.hint[hidden] { display: none; }

/* Password strength */
.strength { display: flex; gap: 6px; margin-top: 10px; }
.strength span {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--border);
    transition: background-color 0.3s ease;
}

/* OTP boxes */
.otp-boxes {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}
.otp-digit {
    width: 100%;
    height: 56px;
    text-align: center;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink);
    font: 700 22px var(--font-display);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.otp-digit:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}
.otp-digit.filled { border-color: #a5b4fc; background: var(--primary-50); }

/* Checkbox */
.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 2px 0 22px;
    font-size: 13.5px;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.check a { color: var(--primary); font-weight: 600; text-decoration: none; }
.check a:hover { text-decoration: underline; }
.check input {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    background: #ffffff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.check input::after {
    content: '';
    width: 9px;
    height: 5px;
    border: 2px solid #ffffff;
    border-top: 0;
    border-right: 0;
    transform: rotate(-45deg) translate(1px, -1px) scale(0);
    transition: transform 0.2s var(--ease);
}
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.check input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Buttons */
.btn-submit {
    position: relative;
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, var(--primary) 55%, var(--primary-600) 100%);
    color: #ffffff;
    font: 600 15px var(--font-body);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 14px 28px -12px rgba(79, 70, 229, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.16s var(--ease), filter 0.15s ease;
}
.btn-submit:hover { filter: brightness(1.06); }
.btn-submit:active:not(:disabled) { transform: scale(0.97); }
.btn-submit:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 3px; }
.btn-submit:disabled { opacity: 0.75; cursor: progress; transform: none; }

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--faint);
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 46px;
    margin-bottom: 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.85);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.16s var(--ease);
}
.btn-social:hover { background: #ffffff; border-color: #a5b4fc; }
.btn-social:active { transform: scale(0.97); }
.btn-social img { width: 18px; height: 18px; }

.secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    font-size: 12.5px;
    color: var(--muted);
}
.secure-note i { color: #10b981; }

.auth-links {
    margin-top: 20px;
    text-align: center;
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.9;
}
.auth-links a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-links a:hover { color: var(--primary-600); text-decoration: underline; }

.legal {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

/* ====== Responsive ====== */
@media (max-width: 900px) {
    body { padding: 20px 14px; }
    .auth-shell { grid-template-columns: 1fr; max-width: 460px; border-radius: 22px; }
    .auth-brand { display: none; }
    .auth-panel { padding: 34px 24px; }
    .mobile-logo { display: block; }
    .auth-head.center-sm { text-align: center; }
    .auth-head.center-sm .icon-badge { margin-left: auto; margin-right: auto; }
}

@media (max-width: 420px) {
    .auth-panel { padding: 28px 18px; }
    .auth-head h2 { font-size: 24px; }
    .field-row { grid-template-columns: 1fr; gap: 0; }
    .otp-boxes { gap: 7px; }
    .otp-digit { height: 50px; font-size: 20px; }
    .step span.step-label { display: none; }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .auth-shell { background: rgba(255, 255, 255, 0.95); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-shell,
    .auth-card > *,
    .auth-card form > *,
    .auth-brand > * {
        animation: fade 0.2s ease both !important;
    }
    .field.has-error { animation: none; }
    .btn-submit:active,
    .btn-social:active { transform: none; }
    .step-line.done::after { animation: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Remember-me and forgot-password share one row, after the password field */
.form-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0 22px;
}
.form-row-between .check { margin: 0; }
.text-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
}
.text-link:hover { color: var(--primary-600); text-decoration: underline; }
.text-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }
.brand-foot i { margin-right: 4px; color: #10b981; }
