/* ============================================================================
   benasoft.css  —  Authentication screens (login / OTP / interstitials)
   Loaded ONLY by asset/_Pages/_Login.php, _VerifyOTP.php and the shared
   _System/_Auth_Screen.php renderer.  Safe to restyle in isolation.
   ========================================================================= */

/* ---- Design tokens ------------------------------------------------------- */
:root {
    --bg:            241 245 249;          /* slate-100 : page */
    --bg-2:          248 250 252;
    --surface:       255 255 255;          /* card face */
    --surface-2:     252 252 253;
    --fg:            15 23 42;              /* slate-900 */
    --fg-2:          51 65 85;              /* slate-700 */
    --muted:         100 116 139;          /* slate-500 */
    --line:          148 163 184;          /* used with low alpha */
    --hair:          226 232 240;          /* slate-200 : solid hairline */

    --primary:       79 70 229;            /* indigo-600  #4F46E5  (brand) */
    --primary-strong:67 56 202;            /* indigo-700 */
    --primary-soft:  99 102 241;           /* indigo-500 */
    --primary-050:   238 242 255;
    --ring:          99 102 241;

    --danger:        220 38 38;
    --success:       22 163 74;
    --info:          37 99 235;

    --shadow-sm:     0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
    --shadow-lg:     0 24px 50px -12px rgba(15, 23, 42, 0.22), 0 10px 20px -12px rgba(15, 23, 42, 0.14);

    --radius:        20px;
    --radius-md:     14px;
    --radius-sm:     11px;

    --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:         2 6 23;
        --bg-2:       8 12 28;
        --surface:    17 24 39;            /* slate-900-ish */
        --surface-2:  22 30 48;
        --fg:         226 232 240;
        --fg-2:       203 213 225;
        --muted:      148 163 184;
        --line:       148 163 184;
        --hair:       42 52 74;
        --primary-050: 30 30 66;
        --shadow-lg:  0 26px 60px -14px rgba(0, 0, 0, 0.65), 0 10px 24px -14px rgba(0, 0, 0, 0.5);
        --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.4);
    }
}

/* legacy aliases still referenced elsewhere */
:root {
    --primary-color: rgb(var(--primary));
    --primary-600:   var(--primary);
    --bg-color:      rgb(var(--bg));
    --input-bg:      rgb(var(--surface));
    --text-color:    rgb(var(--fg));
    --border-color:  rgba(var(--line) / 0.28);
    --card-solid:    rgb(var(--surface));
}

/* ---- Base --------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { min-height: 100%; overflow-x: hidden; }

body,
.auth-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    font-family: var(--font);
    color: rgb(var(--fg));
    background:
        radial-gradient(900px 500px at 100% 0%, rgba(var(--primary) / 0.06), transparent 60%),
        linear-gradient(180deg, rgb(var(--bg-2)), rgb(var(--bg)));
    background-attachment: fixed;
    display: grid;
    grid-template-columns: minmax(0, 960px);
    justify-content: center;
    align-content: safe center;
    padding: clamp(14px, 4vw, 44px);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.5;
}

a { color: rgb(var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Unified card shell ---------------------------------------------------- */
.auth-shell {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr;
    background: rgb(var(--surface));
    border: 1px solid rgba(var(--line) / 0.16);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
@media (min-width: 900px) {
    .auth-shell { grid-template-columns: 0.86fr 1fr; }
}

/* ---- Brand / showcase panel --------------------------------------------- */
.auth-brand {
    display: none;
    position: relative;
    isolation: isolate;
    flex-direction: column;
    justify-content: space-between;
    gap: 26px;
    padding: clamp(26px, 3vw, 40px);
    color: #fff;
    background:
        radial-gradient(520px 340px at 12% 8%, rgba(255, 255, 255, 0.16), transparent 60%),
        linear-gradient(155deg, rgb(var(--primary-strong)) 0%, rgb(var(--primary)) 52%, rgb(var(--primary-soft)) 100%);
}
@media (min-width: 900px) { .auth-brand { display: flex; } }

/* decorative concentric rings */
.auth-brand::after {
    content: "";
    position: absolute;
    right: -140px;
    bottom: -160px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background:
        repeating-radial-gradient(circle at center,
            rgba(255, 255, 255, 0.10) 0 1px,
            transparent 1px 26px);
    -webkit-mask-image: radial-gradient(circle at center, #000 45%, transparent 72%);
    mask-image: radial-gradient(circle at center, #000 45%, transparent 72%);
    z-index: -1;
}

.auth-brand__id { display: inline-flex; align-items: center; gap: 12px; color: #fff; }
.auth-brand__id:hover { text-decoration: none; }
.auth-brand__logo {
    width: 42px; height: 42px; flex: none;
    object-fit: contain;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.16);
    padding: 5px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.auth-brand__name { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.auth-brand__name b { font-weight: 800; }

.auth-brand__mid { display: flex; flex-direction: column; gap: 18px; }
.auth-brand__headline {
    margin: 0;
    font-size: clamp(20px, 2vw, 25px);
    font-weight: 700;
    line-height: 1.28;
    letter-spacing: -0.01em;
    max-width: 22ch;
}
.auth-brand__points { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.auth-brand__points li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.9);
}
.auth-brand__points i {
    flex: none;
    margin-top: 1px;
    width: 22px; height: 22px;
    display: grid; place-items: center;
    font-size: 11px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.auth-brand__advert:not(:empty) {
    margin-top: 2px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.10);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.auth-brand__advert .card,
.auth-brand__advert .carousel { width: 100%; border: 0; background: transparent; box-shadow: none; margin: 0; }
.auth-brand__advert img { max-width: 100%; height: auto; display: block; }

.auth-brand__foot { font-size: 11.5px; color: rgba(255, 255, 255, 0.72); letter-spacing: .3px; }

/* ---- Form panel --------------------------------------------------------- */
.auth-panel {
    min-width: 0;
    background: rgb(var(--surface));
    padding: clamp(26px, 4.5vw, 46px);
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-wrap: anywhere;
}

.auth-panel__head { display: flex; flex-direction: column; gap: 6px; }

.auth-logo--sm {
    width: 40px; height: 40px; object-fit: contain;
    border-radius: 10px; padding: 4px; margin-bottom: 6px;
    background: rgb(var(--primary-050));
    box-shadow: inset 0 0 0 1px rgba(var(--primary) / 0.14);
}
@media (min-width: 900px) { .auth-logo--sm { display: none; } }

/* inline brand line (used on the OTP screen) */
.auth-brandline { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: 2px; }
.auth-logo {
    width: 40px; height: 40px; object-fit: contain; flex: none;
    border-radius: 10px; padding: 4px;
    background: rgb(var(--primary-050));
    box-shadow: inset 0 0 0 1px rgba(var(--primary) / 0.14);
}
.auth-brandname { font-size: 16px; font-weight: 700; letter-spacing: .2px; min-width: 0; color: rgb(var(--fg)); }
.auth-brandname b { font-weight: 800; }

.auth-heading {
    margin: 0;
    font-size: clamp(22px, 2.4vw, 27px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: rgb(var(--fg));
}
.auth-sub { margin: 0; color: rgb(var(--muted)); font-size: 13.5px; }
.auth-sub b { color: rgb(var(--fg-2)); font-weight: 600; }

/* ---- Fields ----------------------------------------------------------------- */
form { display: grid; gap: 15px; margin: 0; min-width: 0; }

.field { position: relative; display: block; }

.input,
input.input {
    width: 100%;
    padding: 16px 46px 16px 14px;
    font: inherit;
    font-size: 14.5px;
    color: rgb(var(--fg));
    background: rgb(var(--surface-2));
    border: 1px solid rgba(var(--line) / 0.38);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input::placeholder { color: transparent; }
.input:hover { border-color: rgba(var(--line) / 0.6); }
.input:focus {
    border-color: rgb(var(--primary));
    background: rgb(var(--surface));
    box-shadow: 0 0 0 4px rgba(var(--primary) / 0.14);
}
.input.is-invalid,
.form-control.is-invalid {
    border-color: rgb(var(--danger));
    box-shadow: 0 0 0 4px rgba(var(--danger) / 0.14);
}
.input:-webkit-autofill { -webkit-text-fill-color: rgb(var(--fg)); -webkit-box-shadow: 0 0 0 40px rgb(var(--surface)) inset; }

.label {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 5px;
    color: rgb(var(--muted));
    font-size: 14px;
    pointer-events: none;
    border-radius: 6px;
    transition: top .14s ease, font-size .14s ease, color .14s ease;
}
.label i { font-size: 12px; opacity: .8; }
.input:focus + .label,
.input:not(:placeholder-shown) + .label {
    top: 0;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: rgb(var(--primary));
    background: linear-gradient(rgb(var(--surface)) 55%, transparent 55%);
    padding: 0 6px;
}
.input:focus + .label i,
.input:not(:placeholder-shown) + .label i { display: none; }

.toggle-eye {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    border: 0;
    background: none;
    color: rgb(var(--muted));
    cursor: pointer;
    border-radius: 8px;
    transition: color .12s ease, background .12s ease;
}
.toggle-eye:hover { color: rgb(var(--fg)); background: rgba(var(--line) / 0.12); }
.toggle-eye:focus-visible { outline: 2px solid rgb(var(--ring)); outline-offset: 2px; }

/* ---- Remember / forgot row ----------------------------------------------------- */
.auth-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: -2px;
    font-size: 13px;
}
.auth-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: rgb(var(--fg-2)); user-select: none; }
.auth-check input { width: 16px; height: 16px; accent-color: rgb(var(--primary)); cursor: pointer; }

.auth-link {
    border: 0; background: none; padding: 0;
    font: inherit;
    color: rgb(var(--primary));
    font-weight: 600;
    cursor: pointer;
}
.auth-link:hover { text-decoration: underline; }

.auth-help {
    margin: 0;
    padding: 11px 13px;
    font-size: 12.5px;
    line-height: 1.5;
    color: rgb(var(--fg-2));
    background: rgb(var(--primary-050));
    border: 1px solid rgba(var(--primary) / 0.22);
    border-radius: var(--radius-sm);
}

/* ---- Primary button ---------------------------------------------------------- */
.auth-btn,
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 14px 18px;
    margin-top: 2px;
    font: inherit;
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: .2px;
    color: #fff;
    background: linear-gradient(180deg, rgb(var(--primary-soft)), rgb(var(--primary)));
    border: 1px solid rgba(var(--primary-strong) / 0.5);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 22px -10px rgba(var(--primary) / 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.16);
    cursor: pointer;
    text-decoration: none;
    transition: transform .06s ease, box-shadow .18s ease, filter .18s ease;
}
.auth-btn:hover,
.btn:hover { filter: brightness(1.05); box-shadow: 0 14px 28px -10px rgba(var(--primary) / 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.16); color: #fff; text-decoration: none; }
.auth-btn:active,
.btn:active { transform: translateY(1px); }
.auth-btn:focus-visible,
.btn:focus-visible { outline: 2px solid rgb(var(--ring)); outline-offset: 3px; }
.auth-btn[disabled],
.auth-btn.is-loading { opacity: .75; cursor: progress; pointer-events: none; }
.auth-btn.is-loading > i { visibility: hidden; }
.auth-btn.is-loading::after {
    content: "";
    position: absolute;
    width: 17px; height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin .6s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* ---- Secure badge ------------------------------------------------------------ */
.auth-secure {
    margin: -4px 0 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: rgb(var(--muted));
}
.auth-secure i { color: rgb(var(--success)); }

/* ---- Footer / divider ------------------------------------------------------- */
.auth-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgb(var(--hair));
    display: grid;
    gap: 3px;
    text-align: center;
    color: rgb(var(--muted));
    font-size: 11.5px;
}
.auth-foot span:first-child { font-style: italic; }

.divider {
    display: flex; align-items: center; gap: 10px;
    color: rgb(var(--muted)); font-size: 12px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: rgb(var(--hair)); }

/* keep _VerifyOTP.php's old aside markup usable ----------------------------- */
.auth-aside { }
.auth-aside__advert { }
.auth-aside__foot { display: none; }

/* ---- Interstitial screens (_Auth_Screen.php) -------------------------------- */
.auth-screen { width: 100%; max-width: 440px; justify-self: center; margin-inline: auto; }
.auth-card {
    background: rgb(var(--surface));
    border: 1px solid rgba(var(--line) / 0.16);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: clamp(26px, 4vw, 38px);
    text-align: center;
    display: grid;
    gap: 13px;
    justify-items: center;
}
.auth-card__icon {
    width: 60px; height: 60px;
    display: grid; place-items: center;
    border-radius: 50%;
    font-size: 25px;
}
.auth-screen--error   .auth-card__icon { color: rgb(var(--danger));  background: rgba(var(--danger) / 0.12); }
.auth-screen--success .auth-card__icon { color: rgb(var(--success)); background: rgba(var(--success) / 0.12); }
.auth-screen--info    .auth-card__icon { color: rgb(var(--info));    background: rgba(var(--info) / 0.12); }
.auth-card__title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; color: rgb(var(--fg)); }
.auth-card__msg { margin: 0; color: rgb(var(--muted)); font-size: 13.5px; line-height: 1.55; }
.auth-card__actions { margin-top: 6px; display: flex; gap: 10px; justify-content: center; }
.auth-card__actions .auth-btn { width: auto; padding-inline: 24px; margin-top: 0; }

/* ---- OTP ------------------------------------------------------------------- */
.otp-wrap { }
.otp-inputs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(5px, 1.8vw, 12px);
    width: 100%;
    min-width: 0;
    margin: 4px 0;
}
.otp-inputs input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: clamp(48px, 12.5vw, 62px);
    padding: 0;
    text-align: center;
    font-size: clamp(18px, 5.5vw, 26px);
    font-weight: 700;
    color: rgb(var(--fg));
    background: rgb(var(--surface-2));
    border: 1.5px solid rgba(var(--line) / 0.4);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.otp-inputs input:focus {
    border-color: rgb(var(--primary));
    background: rgb(var(--surface));
    box-shadow: 0 0 0 4px rgba(var(--primary) / 0.14);
    transform: translateY(-1px);
}
.otp-inputs input.is-invalid { border-color: rgb(var(--danger)); box-shadow: 0 0 0 4px rgba(var(--danger) / 0.14); }

.otp-actions { display: flex; justify-content: center; margin-top: 2px; }
.otp-paste {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid rgba(var(--line) / 0.35);
    background: rgb(var(--surface-2));
    color: rgb(var(--fg-2));
    font: inherit; font-size: 12.5px; font-weight: 600;
    padding: 7px 14px; border-radius: 999px; cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.otp-paste:hover { background: rgba(var(--line) / 0.12); border-color: rgba(var(--line) / 0.5); }
.otp-paste:focus-visible { outline: 2px solid rgb(var(--ring)); outline-offset: 2px; }

.otp-resend { margin: 4px 0 0; font-size: 12.5px; color: rgb(var(--muted)); text-align: center; }
.otp-resend a { font-weight: 700; }

/* ---- Legacy aliases (minimal) --------------------------------------------- */
.container { width: 100%; max-width: 960px; }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* ---- Small screens: full-bleed card ------------------------------------- */
@media (max-width: 640px) {
    body, .auth-body { padding: 0; align-content: stretch; grid-template-columns: 1fr; }
    .auth-shell {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
        min-height: 100svh;
    }
    .auth-panel {
        padding: clamp(22px, 7vw, 30px) clamp(18px, 6vw, 26px);
        justify-content: center;
    }
    .auth-panel__head { margin-bottom: 4px; }
    .auth-foot { margin-top: 28px; }
}

/* ---- Motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
