/* =====================================================================
   Spornation panel auth — admin + seller login / forgot-password.

   Loaded ONLY from application/views/admin/login.php and
   application/views/seller/login.php, and only when $main_page is
   forms/login or forms/forgot-password. It therefore never reaches the
   dashboard, nor application/views/delivery_boy/* (which has its own
   wrapper and keeps the legacy look).

   ⚠ The <link> cannot be moved into include-head.php: delivery_boy/Login.php
   sets $main_page to the SAME forms/login / forms/forgot-password values, so
   a $main_page test in the shared head would leak this file into the
   delivery-boy panel.

   ⚠ Everything below the token block is scoped under body.sn-auth-page,
   because these two wrappers ALSO render admin/pages/forms/reset_password.php
   and seller/pages/forms/seller-registration.php, which must be untouched.

   Mirrors assets/front_end/modern/css/spornation.css. The admin head emits no
   --primary-color / --secondary-color (that block lives only in the storefront
   template), so the tokens below are literals rather than var() fallbacks.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Inter — the storefront typeface, same TTFs, self-hosted.
   Paths are relative to THIS file: assets/admin/custom/ -> ../../ = assets/
   Declared here rather than linking assets/front_end/modern/css/fonts.css,
   which would also pull in four unused IBM Plex Sans Arabic faces.
   font-display:swap means Poppins (already loaded panel-wide) paints first.
   --------------------------------------------------------------------- */
@font-face {
    font-family: 'Inter';
    src: url('../../front_end/modern/fonts/Inter/Inter-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../../front_end/modern/fonts/Inter/Inter-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../../front_end/modern/fonts/Inter/Inter-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Inter';
    src: url('../../front_end/modern/fonts/Inter/Inter-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ---------------------------------------------------------------------
   2. Tokens, copied from spornation.css (:root at L10-20 and L528-533).
   Safe to declare globally: custom properties are inert until referenced,
   and every reference below sits inside .sn-auth-page.
   --------------------------------------------------------------------- */
:root {
    --sn-ink: #1a1a1a;
    --sn-accent: #e31b23;
    --sn-on-accent: #ffffff;
    --sn-border: #eaeaea;
    --sn-well: #f5f5f6;
    --sn-muted: #6b7280;
    --sn-muted-strong: #999999;
    --sn-field: #f9f9f9;

    /* panel-auth only */
    --sn-ring: rgba(227, 27, 35, .09);
    --sn-card-radius: 15px;
    --sn-ctrl-radius: 12px;
    --sn-ctrl-h: 50px;
}

/* ---------------------------------------------------------------------
   3. Page shell — neutralise the legacy layout, centre the card.

   Rules being fought, all in assets/admin/custom/custom.css:
     L22   .login-page { height: 100% !important }
     L104  .login-page > .alert { position:absolute; top:10px }
     L191  body { font-family: 'Poppins' }
   .login-box / .login-card-body / .btn-signin / .card are simply not emitted
   by the new markup, so custom.css L113-117, L125-131 (right:120px) and
   L164-179 — all !important — can never match.

   AdminLTE already gives .login-page display:flex + centring; the card was
   only off-centre because .login-box was absolutely positioned and the
   background <img> was a flex item. Both are gone on these pages.
   --------------------------------------------------------------------- */
body.sn-auth-page {
    /* 0,2,1 beats custom.css `body { font-family: ... }` at 0,0,1 */
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont,
        'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--sn-ink);
    /* clean light backdrop — the photo + 50% black overlay are not rendered */
    background: #f4f4f6;
    background-image:
        radial-gradient(circle at 15% 12%, rgba(227, 27, 35, .05), transparent 42%),
        radial-gradient(circle at 85% 88%, rgba(26, 26, 26, .05), transparent 45%);
    background-attachment: fixed;
}

/* 0,3,0 + !important beats custom.css .login-page { height:100% !important } */
body.sn-auth-page.login-page {
    height: auto !important;
    min-height: 100vh;
    padding: 2.5rem 1rem;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* ---------------------------------------------------------------------
   4. Demo-mode alert (ALLOW_MODIFICATION == 0).
   custom.css L104 pins it absolutely at top:10px — put it back in flow.
   --------------------------------------------------------------------- */
body.sn-auth-page.login-page > .alert {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 440px;
    margin: 0 auto 1.25rem;
    padding: .875rem 1.125rem;
    border: 1px solid #f0e2c0;
    border-radius: 12px;
    background: #fdf6e3;
    color: var(--sn-ink);
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.5;
}

body.sn-auth-page.login-page > .alert a {
    font-weight: 700;
}

/* ---------------------------------------------------------------------
   5. Card
   --------------------------------------------------------------------- */
.sn-auth-page .sn-auth-shell {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

/* BS4 .container-fluid ships width:100% + 15px side padding + auto margins.
   0,2,0 here beats it, so the storefront's 32px card padding wins. */
.sn-auth-page .sn-auth-card {
    background: #fff;
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-card-radius);
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .07), 0 12px 32px rgba(0, 0, 0, .06);
}

.sn-auth-page .sn-auth-logo {
    display: block;
    margin: 0 0 22px;
    text-decoration: none;
}

.sn-auth-page .sn-auth-logo img {
    max-height: 46px;
    max-width: 170px;
    width: auto;
    object-fit: contain;
}

.sn-auth-page .sn-auth-eyebrow {
    margin: 0 0 6px;
    font-weight: 900;
    font-size: .625rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--sn-muted-strong);
}

.sn-auth-page .sn-auth-title {
    margin: 0 0 6px;
    font-weight: 800;
    font-size: 1.75rem;
    line-height: 1.1;
    letter-spacing: -.02em;
    text-transform: uppercase;
    color: var(--sn-ink);
}

.sn-auth-page .sn-auth-sub {
    margin: 0 0 26px;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--sn-muted);
}

/* ---------------------------------------------------------------------
   6. Fields
   --------------------------------------------------------------------- */
.sn-auth-page .sn-group {
    margin-bottom: 18px;
}

.sn-auth-page .sn-label {
    display: block;
    margin: 0 0 8px;
    font-weight: 900;
    font-size: .625rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--sn-muted-strong);
}

.sn-auth-page .sn-field {
    position: relative;
}

.sn-auth-page .sn-input,
.sn-auth-page .sn-field .form-control {
    display: block;
    width: 100%;
    height: var(--sn-ctrl-h);
    padding: 0 16px;
    background-color: #f7f7f8;
    background-clip: padding-box;
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-ctrl-radius);
    font-family: inherit;
    font-size: .9375rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--sn-ink);
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.sn-auth-page .sn-input::placeholder {
    color: #a8a8ad;
    font-weight: 500;
}

.sn-auth-page .sn-input:hover {
    border-color: #dcdcdc;
}

.sn-auth-page .sn-input:focus,
.sn-auth-page .sn-field .form-control:focus {
    outline: 0;
    background-color: #fff;
    border-color: var(--sn-accent);
    box-shadow: 0 0 0 3px var(--sn-ring);
    color: var(--sn-ink);
}

/* Chrome repaints autofilled fields pale yellow — keep the well look. */
.sn-auth-page .sn-input:-webkit-autofill,
.sn-auth-page .sn-input:-webkit-autofill:hover,
.sn-auth-page .sn-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--sn-ink);
    -webkit-box-shadow: 0 0 0 1000px #f7f7f8 inset;
    box-shadow: 0 0 0 1000px #f7f7f8 inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* --- password show/hide.
   Font Awesome 5.13 (assets/admin/css/all.min.css). Unicons is NOT loaded in
   the panel, so `uil uil-eye` from the storefront markup would render nothing. */
.sn-auth-page .sn-field--pass .sn-input {
    padding-right: 50px;
}

.sn-auth-page .sn-pass-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: var(--sn-ctrl-h);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: none;
    color: var(--sn-muted-strong);
    cursor: pointer;
    border-radius: 0 var(--sn-ctrl-radius) var(--sn-ctrl-radius) 0;
    transition: color .15s ease;
}

.sn-auth-page .sn-pass-toggle:hover,
.sn-auth-page .sn-pass-toggle:focus {
    color: var(--sn-accent);
    outline: 0;
}

.sn-auth-page .sn-pass-toggle:focus-visible {
    box-shadow: 0 0 0 3px var(--sn-ring);
}

.sn-auth-page .sn-pass-toggle i {
    font-size: .95rem;
    line-height: 1;
}

/* ---------------------------------------------------------------------
   7. Remember-me row.
   The old markup used .check-primary, which has NO CSS anywhere in the repo —
   it was an unstyled native checkbox. Replaced with the storefront .sn-check.
   --------------------------------------------------------------------- */
.sn-auth-page .sn-auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 4px 0 22px;
}

.sn-auth-page .sn-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.sn-auth-page .sn-check input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sn-auth-page .sn-check .sn-box {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border: 1px solid #767676;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s ease, border-color .12s ease;
}

.sn-auth-page .sn-check .sn-box::after {
    content: "";
    width: 10px;
    height: 6px;
    border-left: 2px solid var(--sn-on-accent);
    border-bottom: 2px solid var(--sn-on-accent);
    transform: rotate(-45deg) translateY(-1px);
    opacity: 0;
}

.sn-auth-page .sn-check input:checked + .sn-box {
    background: var(--sn-accent);
    border-color: var(--sn-accent);
}

.sn-auth-page .sn-check input:checked + .sn-box::after {
    opacity: 1;
}

.sn-auth-page .sn-check input:focus-visible + .sn-box {
    border-color: var(--sn-accent);
    box-shadow: 0 0 0 3px var(--sn-ring);
}

.sn-auth-page .sn-check .sn-check-txt {
    font-size: .8125rem;
    font-weight: 600;
    color: #666;
}

.sn-auth-page .sn-check input:checked ~ .sn-check-txt {
    color: var(--sn-ink);
}

/* ---------------------------------------------------------------------
   8. Links + buttons
   --------------------------------------------------------------------- */
.sn-auth-page .sn-auth-link {
    font-weight: 900;
    font-size: .6875rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--sn-accent);
    text-decoration: none;
    white-space: nowrap;
}

/* BS4 reboot re-adds a:hover { text-decoration: underline } — same reason
   spornation.css L23-45 exists on the storefront. */
.sn-auth-page .sn-auth-link:hover,
.sn-auth-page .sn-auth-link:focus,
.sn-auth-page .sn-auth-logo:hover,
.sn-auth-page .sn-auth-logo:focus {
    text-decoration: none;
    color: var(--sn-accent);
    opacity: .82;
}

.sn-auth-page .sn-buy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    height: 56px;
    padding: 0 1rem;
    border: 0;
    border-radius: var(--sn-ctrl-radius);
    background: var(--sn-accent);
    color: var(--sn-on-accent);
    font-family: inherit;
    font-weight: 900;
    font-size: 1rem;
    line-height: 1;
    text-transform: none;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .15s;
}

.sn-auth-page .sn-buy-btn:hover,
.sn-auth-page .sn-buy-btn:focus {
    color: var(--sn-on-accent);
    text-decoration: none;
    opacity: .92;
}

.sn-auth-page .sn-buy-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--sn-ring);
}

.sn-auth-page .sn-buy-btn[disabled],
.sn-auth-page .sn-buy-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.sn-auth-page .sn-auth-actions {
    display: block;
    margin-top: 4px;
}

.sn-auth-page .sn-auth-sep {
    height: 1px;
    margin: 26px 0 20px;
    background: var(--sn-border);
    border: 0;
}

.sn-auth-page .sn-auth-foot {
    margin: 20px 0 0;
    text-align: center;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--sn-muted);
}

.sn-auth-page .sn-auth-foot .sn-auth-link {
    margin-left: .35rem;
}

/* ---------------------------------------------------------------------
   9. Message boxes.

   #error_box (login) is class-tagged at runtime by custom.js:2444 with
   msg_error / msg_success / rounded / p-3 and toggled via .d-none.
   #forgot_pass_error_box and #set_password_error_box get NO classes —
   custom.js:9501 only calls .html(msg) and never .show() — so they must be
   visible by default and self-hide when empty.
   --------------------------------------------------------------------- */
.sn-auth-page .sn-auth-msg {
    margin: 0 0 16px;
    padding: .75rem 1rem;
    border-radius: 10px;
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
}

.sn-auth-page .sn-auth-msg:empty {
    display: none !important;
}

/* untagged (the two forgot-password boxes) -> error look */
.sn-auth-page .sn-auth-msg:not(.msg_success),
.sn-auth-page .sn-auth-msg.msg_error {
    background: #fdecec;
    border: 1px solid #f7cdcf;
    color: #b3151c;
}

.sn-auth-page .sn-auth-msg.msg_success {
    background: #e8f6ec;
    border: 1px solid #cfe9d7;
    color: #1e7a3c;
}

/* custom.js adds .p-3 — don't let BS4 double the padding */
.sn-auth-page .sn-auth-msg.p-3 {
    padding: .75rem 1rem !important;
}

/* ---------------------------------------------------------------------
   10. intl-tel-input (#forgot_password_number, separateDialCode: true).

   assets/admin/css/intlTelInput.css ships NO .separate-dial-code rules, so
   today the dial code renders unstyled inside the 46px .selected-flag and
   collides with .iti-arrow. Fixed here.

   The hi-DPI flag-sprite 404 is a separate, panel-wide bug — fixed in
   assets/admin/custom/custom.css, not here, because the same widget also
   renders on seller and delivery-boy registration.
   --------------------------------------------------------------------- */
.sn-auth-page .intl-tel-input {
    display: block;
    width: 100%;
}

.sn-auth-page .intl-tel-input .selected-flag {
    border-right: 1px solid var(--sn-border);
    border-radius: var(--sn-ctrl-radius) 0 0 var(--sn-ctrl-radius);
    outline: 0;
}

.sn-auth-page .intl-tel-input.separate-dial-code .selected-flag {
    width: 96px;
    padding-left: 14px;
    background-color: transparent;
}

.sn-auth-page .intl-tel-input.separate-dial-code .selected-dial-code {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0;
    font-size: .875rem;
    font-weight: 700;
    color: var(--sn-ink);
    white-space: nowrap;
}

.sn-auth-page .intl-tel-input.separate-dial-code .selected-flag .iti-arrow {
    right: 10px;
    border-top-color: var(--sn-muted-strong);
}

/* the plugin sets padding-right:36px !important on this input */
.sn-auth-page .intl-tel-input.separate-dial-code > input.sn-input {
    padding-left: 108px;
    padding-right: 16px !important;
}

.sn-auth-page .intl-tel-input .country-list {
    border: 1px solid var(--sn-border);
    border-radius: var(--sn-ctrl-radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
    padding: 6px 0;
    font-size: .8125rem;
    z-index: 5;
}

.sn-auth-page .intl-tel-input .country-list .country.highlight {
    background-color: var(--sn-well);
}

.sn-auth-page .intl-tel-input .country-list .dial-code {
    color: var(--sn-muted);
}

/* Firebase reCAPTCHA slot. init_forgot_recaptcha() empties and hides this
   whenever the auth mode is not firebase, so never force display here. */
.sn-auth-page .sn-recaptcha {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.sn-auth-page .sn-recaptcha:empty {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------------
   11. Responsive
   --------------------------------------------------------------------- */
@media (max-width: 575.98px) {
    body.sn-auth-page.login-page {
        padding: 1.5rem .875rem;
    }

    .sn-auth-page .sn-auth-card {
        padding: 24px 20px;
    }

    .sn-auth-page .sn-auth-title {
        font-size: 1.5rem;
    }

    .sn-auth-page .sn-auth-row {
        gap: .75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sn-auth-page * {
        transition: none !important;
    }
}
