/* =============================================================
   Modern auth theme — login / signup / forgot password / verify OTP
   Loaded after style.css; every rule is scoped to body.auth-modern,
   so dashboards and other pages are not affected.
   ============================================================= */
body.auth-modern {
    --am-blue: #0866ff;
    --am-blue-dark: #0a4fd6;
    --am-blue-rgb: 8, 102, 255;
    --am-ink: #0b0f19;
    --am-muted: #8b919c;
    --am-field: #f4f5f7;
    --am-page: #e9ecf1;
    font-family: 'Poppins', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--am-page);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    box-sizing: border-box;
}
body.auth-modern::before { display: none; }

/* ---------- outer white card ---------- */
body.auth-modern .auth-shell {
    width: 100%;
    max-width: 1040px;
    min-height: 0;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 36px;
    padding: 24px;
    background: #fff;
    border-radius: 32px;
    box-shadow: 0 30px 70px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .04);
    box-sizing: border-box;
}
body.auth-modern .auth-shell--wide { max-width: 1080px; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); }

/* ---------- left blue panel ---------- */
body.auth-modern .auth-brand {
    position: relative;
    display: flex;
    align-items: stretch;
    padding: 0;
    border-radius: 26px;
    overflow: hidden;
    color: #fff;
    min-height: 560px;
    background:
        radial-gradient(120% 70% at 100% 100%, rgba(148, 177, 236, .55) 0%, rgba(148, 177, 236, 0) 60%),
        linear-gradient(165deg, #0866ff 0%, #0b5ff0 42%, #1d4fc4 78%, #4c74c9 100%);
}
body.auth-modern .auth-brand::after {
    content: '';
    position: absolute;
    width: 320px;
    height: 320px;
    right: -120px;
    top: -120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    pointer-events: none;
}
body.auth-modern .auth-brand-inner {
    position: relative;
    z-index: 1;
    max-width: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 64px 44px 0;
    box-sizing: border-box;
}
body.auth-modern .auth-brand-heading {
    font-family: inherit;
    font-size: clamp(28px, 3.1vw, 38px);
    font-weight: 600;
    line-height: 1.38;
    letter-spacing: -.01em;
    color: #fff;
    margin: 0 0 22px;
}
body.auth-modern .auth-brand-text {
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.6;
    color: rgba(255, 255, 255, .92);
    margin: 0 0 18px;
    max-width: 330px;
}
body.auth-modern .auth-brand-points {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 8px;
    padding: 0;
}
body.auth-modern .auth-brand-point {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .2);
    font-size: 11.5px;
    font-weight: 600;
}
body.auth-modern .auth-brand-art {
    margin-top: auto;
    padding-top: 18px;
    display: flex;
    justify-content: center;
}
body.auth-modern .auth-brand-art svg {
    display: block;
    width: 100%;
    max-width: 380px;
    height: auto;
}

/* ---------- right form side ---------- */
body.auth-modern .auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 32px 28px 4px;
}
body.auth-modern .auth-card,
body.auth-modern .auth-card.signup-card {
    width: 100%;
    max-width: 380px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
body.auth-modern .auth-card.signup-card { max-width: 460px; }

/* small brand row above "Welcome Back" (desktop + mobile) */
body.auth-modern .auth-card .auth-logo {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 0 18px;
    text-align: left;
}
body.auth-modern .auth-card .auth-logo img {
    height: 46px !important;
    max-width: 140px !important;
    margin: 0 !important;
    object-fit: contain;
}
body.auth-modern .auth-card .auth-logo .bolt-icon {
    width: 46px;
    height: 46px;
    margin: 0;
    border-radius: 50%;
    font-size: 18px;
    background: linear-gradient(140deg, var(--am-blue), #0a3fb8);
    box-shadow: 0 8px 18px rgba(var(--am-blue-rgb), .28);
}
body.auth-modern .auth-card .auth-logo h2 {
    font-family: inherit;
    font-size: 19px;
    font-weight: 600;
    color: var(--am-ink);
    margin: 0;
    line-height: 1.25;
}
body.auth-modern .auth-card .auth-logo p { display: none; }

body.auth-modern .auth-title {
    font-family: inherit;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    color: #000;
    letter-spacing: -.01em;
    margin: 0 0 6px;
}
body.auth-modern .auth-subtitle {
    text-align: center;
    font-size: 13px;
    font-weight: 400;
    color: var(--am-muted);
    margin: 0 0 30px;
}

/* ---------- fields: filled, borderless, label as placeholder ---------- */
body.auth-modern .form-group { margin-bottom: 16px; }
body.auth-modern .form-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
body.auth-modern .input-icon { display: none; }
body.auth-modern .form-control,
body.auth-modern .input-group .form-control {
    height: 54px;
    border-radius: 10px;
    border: 1.5px solid transparent;
    background: var(--am-field);
    padding: 0 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--am-ink);
    box-shadow: none;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
body.auth-modern .input-group .form-control { padding-right: 52px; }
body.auth-modern .form-control::placeholder { color: #1f2430; opacity: .78; font-weight: 500; }
body.auth-modern .form-control:focus {
    outline: none;
    background: #fff;
    border-color: var(--am-blue);
    box-shadow: 0 0 0 4px rgba(var(--am-blue-rgb), .10);
}
body.auth-modern .input-action {
    right: 10px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #a3a9b4;
    font-size: 16px;
}
body.auth-modern .input-action:hover { color: var(--am-blue); background: rgba(var(--am-blue-rgb), .06); }
body.auth-modern .input-action:focus-visible { outline: 2px solid var(--am-blue); outline-offset: 1px; }

body.auth-modern .auth-link-row { text-align: right; margin-top: 12px; }
body.auth-modern .auth-link-row a { font-size: 12px; font-weight: 500; color: var(--am-ink); }
body.auth-modern .auth-link-row a:hover { color: var(--am-blue); }

/* ---------- primary button ---------- */
body.auth-modern .btn-primary {
    height: 54px;
    border: 0;
    border-radius: 10px;
    background: var(--am-blue);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    color: #fff;
    box-shadow: 0 10px 22px rgba(var(--am-blue-rgb), .22);
    transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
body.auth-modern .btn-primary:hover { background: var(--am-blue-dark); transform: translateY(-1px); box-shadow: 0 14px 26px rgba(var(--am-blue-rgb), .28); }
body.auth-modern .btn-primary:disabled { opacity: .6; transform: none; }
body.auth-modern form .btn-primary { margin-top: 18px; }

body.auth-modern .auth-footer {
    text-align: center;
    margin-top: 26px;
    font-size: 12px;
    color: var(--am-muted);
    font-weight: 400;
}
body.auth-modern .auth-footer a { color: var(--am-blue); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
body.auth-modern .auth-back { margin-top: 10px; font-size: 12px; color: var(--am-muted); }
body.auth-modern .auth-back:hover { color: var(--am-blue); }

/* ---------- alerts, steps, OTP ---------- */
body.auth-modern .alert { border-radius: 10px; font-size: 13px; }
body.auth-modern .auth-steps { margin-bottom: 24px; }
body.auth-modern .auth-step.active { background: var(--am-blue); }
body.auth-modern .auth-info-box { border-radius: 10px; background: var(--am-field); border-color: transparent; }
body.auth-modern .auth-info-box i { color: var(--am-blue); }
body.auth-modern .auth-info-box-success { background: #ecfdf3; border-color: rgba(34, 197, 94, .25); }
body.auth-modern .auth-info-box-success i { color: #16a34a; }
body.auth-modern .auth-info-box-error { background: #fef2f2; border-color: rgba(239, 68, 68, .22); }
body.auth-modern .auth-info-box-error i { color: #dc2626; }
body.auth-modern .auth-otp-box {
    width: 48px;
    height: 54px;
    border: 1.5px solid transparent;
    border-radius: 10px;
    background: var(--am-field);
    font-family: inherit;
    font-weight: 600;
}
body.auth-modern .auth-otp-box:focus { background: #fff; border-color: var(--am-blue); box-shadow: 0 0 0 4px rgba(var(--am-blue-rgb), .10); }
body.auth-modern .auth-otp-timer { background: rgba(var(--am-blue-rgb), .07); border-color: rgba(var(--am-blue-rgb), .16); color: var(--am-blue-dark); }
body.auth-modern .auth-otp-timer span,
body.auth-modern .auth-otp-resend-timer strong,
body.auth-modern .auth-otp-resend-timer [data-otp-resend-count] { color: var(--am-blue); }
body.auth-modern .auth-otp-resend-timer i { color: var(--am-blue); }
body.auth-modern .auth-otp-resend-link { color: var(--am-blue); font-weight: 600; }
body.auth-modern .auth-otp-resend-link:hover { color: var(--am-blue-dark); }
body.auth-modern .auth-success-icon { background: rgba(var(--am-blue-rgb), .1); color: var(--am-blue); }
body.auth-modern .auth-success h3 { font-family: inherit; font-weight: 700; }

/* ---------- tablet ---------- */
@media (max-width: 1080px) {
    body.auth-modern .auth-shell { gap: 24px; }
    body.auth-modern .auth-brand-inner { padding: 48px 32px 0; }
    body.auth-modern .auth-main { padding: 20px 16px 20px 0; }
}

/* ---------- mobile: blue header on top, form below ---------- */
@media (max-width: 900px) {
    body.auth-modern { align-items: flex-start; padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom)); }
    body.auth-modern .auth-shell,
    body.auth-modern .auth-shell--wide {
        grid-template-columns: 1fr !important;
        max-width: 480px !important;
        gap: 22px;
        padding: 12px !important;
        border-radius: 26px;
    }
    body.auth-modern .auth-brand { display: flex !important; min-height: 0; border-radius: 20px; }
    body.auth-modern .auth-brand-inner { padding: 26px 22px 24px; }
    body.auth-modern .auth-brand-heading { font-size: 22px; line-height: 1.35; margin-bottom: 8px; }
    body.auth-modern .auth-brand-text { font-size: 12.5px; margin-bottom: 0; }
    body.auth-modern .auth-brand-points { margin-top: 12px; }
    body.auth-modern .auth-brand-art { display: none; }
    body.auth-modern .auth-main { padding: 4px 10px 14px !important; }
    body.auth-modern .auth-card,
    body.auth-modern .auth-card.signup-card { max-width: 100% !important; padding: 0 !important; border-radius: 0 !important; }
    body.auth-modern .auth-card .auth-logo { gap: 10px; flex-wrap: wrap; }
    body.auth-modern .auth-card .auth-logo img { height: 38px !important; max-width: 118px !important; }
    body.auth-modern .auth-card .auth-logo h2 { font-size: 16px; }
    body.auth-modern .auth-title { font-size: 26px; }
    body.auth-modern .auth-subtitle { margin-bottom: 22px; }
    body.auth-modern .form-control,
    body.auth-modern .input-group .form-control { font-size: 16px; height: 52px; } /* 16px stops iOS zoom */
    body.auth-modern .btn-primary { height: 52px; }
}

@media (max-width: 380px) {
    body.auth-modern .auth-shell { border-radius: 22px; }
    body.auth-modern .auth-otp-boxes { gap: 6px; }
    body.auth-modern .auth-otp-box { width: 40px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
    body.auth-modern .btn-primary,
    body.auth-modern .form-control { transition: none; }
}

/* =============================================================
   FIT TO SCREEN — no page scroll (up/down/left/right) on any screen.
   The page is locked to the viewport; the card shrinks with the
   window height. Only in an extreme case (e.g. very small landscape
   phone) the form column itself scrolls, never the page.
   ============================================================= */
html:has(body.auth-modern) { height: 100%; overflow: hidden; }
body.auth-modern {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding: clamp(8px, 3.2vh, 32px) clamp(8px, 2vw, 20px);
}
body.auth-modern .auth-shell,
body.auth-modern .auth-shell--wide {
    height: auto;
    max-height: 100%;
    min-height: 0;
    padding: clamp(10px, 2.4vh, 24px);
    gap: clamp(16px, 3vw, 36px);
    overflow: hidden;
}
body.auth-modern .auth-brand { min-height: 0; height: auto; }
body.auth-modern .auth-brand-inner {
    min-height: 0;
    padding: clamp(24px, 6.5vh, 64px) clamp(24px, 3.4vw, 44px) 0;
}
body.auth-modern .auth-brand-heading { font-size: clamp(22px, min(3.1vw, 4.6vh), 38px); margin-bottom: clamp(10px, 2.4vh, 22px); }
body.auth-modern .auth-brand-art { flex: 1 1 auto; min-height: 0; align-items: flex-end; }
body.auth-modern .auth-brand-art svg { width: auto; max-width: 100%; height: 100%; max-height: min(300px, 36vh); }
body.auth-modern .auth-main {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    padding-top: clamp(8px, 2.6vh, 28px);
    padding-bottom: clamp(8px, 2.6vh, 28px);
}
body.auth-modern .auth-main::-webkit-scrollbar { display: none; }
body.auth-modern .auth-card .auth-logo { margin-bottom: clamp(8px, 2vh, 18px); }
body.auth-modern .auth-title { font-size: clamp(22px, 4vh, 32px); }
body.auth-modern .auth-subtitle { margin-bottom: clamp(12px, 3.2vh, 30px); }
body.auth-modern .form-group { margin-bottom: clamp(8px, 1.8vh, 16px); }
body.auth-modern .form-control,
body.auth-modern .input-group .form-control,
body.auth-modern .btn-primary { height: clamp(44px, 6.4vh, 54px); }
body.auth-modern form .btn-primary { margin-top: clamp(8px, 2vh, 18px); }
body.auth-modern .auth-footer { margin-top: clamp(10px, 2.6vh, 26px); }
body.auth-modern .auth-steps { margin-bottom: clamp(10px, 2.4vh, 24px); }
body.auth-modern .auth-otp-boxes { margin: clamp(8px, 1.8vh, 16px) 0 clamp(10px, 2vh, 18px); }
body.auth-modern .auth-otp-box { height: clamp(44px, 6.4vh, 54px); }
body.auth-modern .auth-info-box { margin-bottom: clamp(8px, 1.8vh, 16px); }

/* floating WhatsApp/Telegram buttons must not widen the page */
body.auth-modern { overflow-x: hidden; }

/* ---------- short desktop / laptop windows ---------- */
@media (min-width: 901px) and (max-height: 640px) {
    body.auth-modern .auth-brand-art { display: none; }
    body.auth-modern .auth-brand-inner { justify-content: center; padding-bottom: clamp(20px, 5vh, 44px); }
    body.auth-modern .auth-card .auth-logo img { height: 36px !important; }
    body.auth-modern .auth-card .auth-logo h2 { font-size: 16px; }
}
@media (min-width: 901px) and (max-height: 520px) {
    body.auth-modern .auth-brand-text,
    body.auth-modern .auth-brand-points { display: none; }
    body.auth-modern .auth-card .auth-logo { display: none !important; }
    body.auth-modern .auth-subtitle { margin-bottom: 10px; }
    body.auth-modern .auth-back { display: none; }
}

/* ---------- phones & small tablets ---------- */
@media (max-width: 900px) {
    body.auth-modern { padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
    body.auth-modern .auth-shell,
    body.auth-modern .auth-shell--wide {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        max-width: 480px !important;
        max-height: 100%;
        gap: clamp(10px, 2vh, 20px);
        padding: 10px !important;
    }
    body.auth-modern .auth-brand { flex: 0 0 auto; }
    body.auth-modern .auth-brand-inner { padding: clamp(14px, 2.6vh, 24px) 20px; }
    body.auth-modern .auth-brand-heading { font-size: clamp(18px, 2.8vh, 22px); margin-bottom: 6px; }
    body.auth-modern .auth-brand-text { font-size: 12px; line-height: 1.5; }
    body.auth-modern .auth-brand-points { display: none; }
    body.auth-modern .auth-main { flex: 1 1 auto; padding: 0 8px 6px !important; align-items: center; }
    body.auth-modern .auth-title { font-size: clamp(21px, 3.4vh, 26px); }
    body.auth-modern .form-control,
    body.auth-modern .input-group .form-control,
    body.auth-modern .btn-primary { height: clamp(44px, 6vh, 52px); }
}
@media (max-width: 900px) and (max-height: 760px) {
    body.auth-modern .auth-brand-text { display: none; }
}
@media (max-width: 900px) and (max-height: 640px) {
    body.auth-modern .auth-brand { display: none !important; }
    body.auth-modern .auth-back { display: none; }
}
/* landscape phones */
@media (max-height: 460px) {
    body.auth-modern .auth-brand { display: none !important; }
    body.auth-modern .auth-shell,
    body.auth-modern .auth-shell--wide { max-width: 520px !important; grid-template-columns: 1fr !important; }
    body.auth-modern .auth-card .auth-logo { display: none !important; }
    body.auth-modern .auth-subtitle { display: none; }
    body.auth-modern .auth-title { margin-bottom: 10px; }
    body.auth-modern .auth-back { display: none; }
}

/* ---------- mobile: card centred vertically (was pinned to the top) ---------- */
@media (max-width: 900px) {
    body.auth-modern { align-items: center !important; justify-content: center !important; }
    body.auth-modern .auth-shell,
    body.auth-modern .auth-shell--wide { margin: auto !important; }
}

/* ---------- JS validation: warning shown as red placeholder ---------- */
body.auth-modern .form-control.av-error,
body.auth-modern .input-group .form-control.av-error {
    background: #fef2f2 !important;
    border-color: #f87171 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .12) !important;
    animation: avShake .38s ease;
}
body.auth-modern .form-control.av-error::placeholder { color: #dc2626 !important; opacity: 1 !important; font-weight: 500; }
body.auth-modern .form-control.av-error::-webkit-input-placeholder { color: #dc2626 !important; opacity: 1 !important; }
@keyframes avShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
    body.auth-modern .form-control.av-error { animation: none; }
}
