/* ==========================================================================
   PMCSMS sign-in page (scripts/autobiz/login_pmcsms.php)
   Same palette and type as the PMCSMS landing page. Brand colours follow the
   backend theme tokens (--primary, --dark, --warning, ...) set by
   themes/blue_pmcsms_theme.css, with the PMCSMS values as fallbacks.
   ========================================================================== */

.pm-auth {
    --pm-blue: var(--primary, #0558ee);
    --pm-blue-700: #003eaf;
    --pm-blue-50: #eaf1ff;
    --pm-navy: var(--dark, #041449);
    --pm-deep: #012472;
    --pm-deep-2: #00318e;
    --pm-amber: var(--warning, #fec730);
    --pm-green: var(--success, #138a52);
    --pm-danger: var(--danger, #d6455d);
    --pm-body: #3d4b72;
    --pm-muted: #6c7aa0;
    --pm-line: #e0e7f5;
    --pm-line-2: #cdd8ee;
    --pm-tint: #f3f7ff;
    --pm-on-dark: #c9d8f8;
    --pm-bubble: 22px 22px 22px 4px;
    --pm-head: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --pm-sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    min-height: 100vh;
    font-family: var(--pm-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--pm-body);
    background: #fff;
    -webkit-font-smoothing: antialiased;
}

.pm-auth *, .pm-auth *::before, .pm-auth *::after { box-sizing: border-box; }
.pm-auth a { color: var(--pm-blue); text-decoration: none; }
.pm-auth a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pm-auth :focus-visible { outline: 2px solid var(--pm-blue); outline-offset: 3px; border-radius: 6px; }
.pm-auth h1, .pm-auth h2 { font-family: var(--pm-head); letter-spacing: -.025em; line-height: 1.1; margin: 0; }
.pm-auth p { margin: 0; }

/* ── Brand panel ──────────────────────────────────────────────────────── */
.pm-auth-brand {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 40px 56px 56px;
    color: var(--pm-on-dark);
    background:
        radial-gradient(circle at 88% 8%, color-mix(in srgb, var(--pm-amber) 22%, transparent), transparent 34%),
        linear-gradient(155deg, var(--pm-navy) 0%, var(--pm-deep) 45%, var(--pm-deep-2) 75%, var(--pm-blue) 100%);
}

.pm-auth-logo { display: inline-block; align-self: flex-start; }
.pm-auth-logo img { display: block; height: 40px; width: auto; }
.pm-auth-logo span { font: 800 28px/1 var(--pm-head); color: #fff; letter-spacing: -.02em; }

.pm-auth-brand-copy { max-width: 440px; margin-top: auto; }
/* The last block before the wave closes the vertically centred group (copy + visual). */
.pm-auth-brand > .pm-auth-points, .pm-auth-brand > .pm-auth-steps { margin-bottom: auto !important; }
.pm-auth-eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--pm-amber); }
.pm-auth-brand h2 { margin-top: 16px; font-size: clamp(36px, 3.6vw, 52px); font-weight: 800; color: #fff; }
.pm-auth-brand h2 em { position: relative; font-style: italic; }
.pm-auth-brand h2 em::after {
    content: "";
    position: absolute;
    left: -6%;
    right: 2%;
    bottom: -4px;
    height: 5px;
    border-radius: 5px;
    background: var(--pm-amber);
    transform: rotate(-2deg);
}
.pm-auth-brand-copy > p:last-child { margin-top: 20px; font-size: 17px; max-width: 400px; }

.pm-auth-phone { max-width: 360px; }
.pm-auth-sms {
    padding: 16px 18px;
    border-radius: var(--pm-bubble);
    background: #fff;
    color: var(--pm-navy);
    box-shadow: 0 24px 40px -24px rgba(0, 0, 0, .55);
    transform: rotate(-2deg);
}
.pm-auth-sms-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--pm-muted); }
.pm-auth-sms-meta b { color: var(--pm-navy); letter-spacing: .04em; }
.pm-auth-sms p { margin-top: 6px; font-size: 15px; line-height: 1.5; }
.pm-auth-sms-status { margin: 12px 0 0 6px; font-size: 13px; font-weight: 600; color: var(--pm-amber); }

.pm-auth-points { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 24px; padding: 0; list-style: none; }
.pm-auth-points li {
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .06);
    font-size: 14px;
    color: #fff;
}
.pm-auth-points .fa-check { margin-right: 6px; color: var(--pm-amber); }

.pm-auth-wave { position: absolute; left: 0; right: 0; bottom: 0; z-index: -1; width: 100%; height: 120px; color: rgba(255, 255, 255, .07); }

/* ── Form side ───────────────────────────────────────────────────────── */
.pm-auth-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 28px 40px;
    background: linear-gradient(180deg, #fff 0%, var(--pm-tint) 100%);
}

.pm-auth-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pm-auth-back { font-size: 14px; font-weight: 600; color: var(--pm-muted) !important; }
.pm-auth-back .fa-arrow-left { margin-right: 6px; }
.pm-auth a.pm-auth-chat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--pm-line-2);
    border-radius: 999px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: var(--pm-navy);
}
.pm-auth a.pm-auth-chat:hover { border-color: var(--pm-green); text-decoration: none; }
.pm-auth a.pm-auth-chat .fa-whatsapp { color: var(--pm-green); font-size: 16px; }

.pm-auth-panel { width: 100%; max-width: 480px; margin: auto; }

.pm-auth-head { margin-bottom: 28px; }
.pm-auth-head h1 { font-size: clamp(30px, 3vw, 38px); font-weight: 800; color: var(--pm-navy); }
.pm-auth-head p { margin-top: 10px; color: var(--pm-muted); }
.pm-auth-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    border-radius: 14px 14px 14px 4px;
    background: var(--pm-blue-50);
    color: var(--pm-blue);
    font-size: 18px;
}

.pm-auth-field { margin-bottom: 20px; }
.pm-auth-field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--pm-navy); }
.pm-auth-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pm-auth-label-row a { font-size: 14px; font-weight: 600; }

.pm-auth .form-control {
    display: block;
    width: 100%;
    height: 52px;
    padding: 12px 16px;
    border: 1px solid var(--pm-line-2);
    border-radius: 12px;
    background: #fff;
    font: 500 16px/1.4 var(--pm-sans);
    color: var(--pm-navy);
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}
.pm-auth .form-control::placeholder { color: #9aa6c4; }
.pm-auth .form-control:focus { border-color: var(--pm-blue); box-shadow: 0 0 0 4px var(--pm-blue-50); }
.pm-auth select.form-control { appearance: auto; padding-top: 0; padding-bottom: 0; }

.pm-auth-password { position: relative; }
.pm-auth-password .form-control { padding-right: 52px; }
.pm-auth-eye {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--pm-muted);
    transform: translateY(-50%);
    cursor: pointer;
}
.pm-auth-eye:hover { color: var(--pm-blue); background: var(--pm-blue-50); }

.pm-auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 54px;
    margin-top: 8px;
    padding: 14px 24px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--pm-blue-700) 0%, var(--pm-blue) 100%);
    box-shadow: 0 12px 24px -12px color-mix(in srgb, var(--pm-blue) 80%, transparent);
    font: 700 17px/1 var(--pm-sans);
    color: #fff;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, opacity .15s;
}
.pm-auth-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 16px 28px -12px color-mix(in srgb, var(--pm-blue) 85%, transparent); }
.pm-auth-submit:disabled { opacity: .65; cursor: not-allowed; }

/* login.js renders a Bootstrap 4.2+ spinner; the page ships Bootstrap 4.1, so draw it here. */
.pm-auth .spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: pm-auth-spin .75s linear infinite;
}
.pm-auth .spinner-border.me-2 { margin-right: 4px; }
@keyframes pm-auth-spin { to { transform: rotate(360deg); } }

.pm-auth-switch { margin-top: 24px !important; text-align: center; font-size: 15px; color: var(--pm-muted); }
.pm-auth-switch a { font-weight: 700; }
.pm-auth-switch .fa-arrow-left, .pm-auth-links .fa-arrow-left { margin-right: 6px; }

.pm-auth-aside { margin-top: 20px; padding: 14px 16px; border: 1px solid var(--pm-line); border-radius: 14px; background: #fff; text-align: center; font-size: 14px; }
.pm-auth-aside a { font-weight: 700; }
.pm-auth-aside p { margin-top: 4px; color: var(--pm-muted); }

.pm-auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; font-size: 14px; font-weight: 600; }
.pm-auth-links a.disabled { pointer-events: none; color: var(--pm-muted); }

.pm-auth .alert { margin-bottom: 20px; padding: 12px 16px; border: 1px solid transparent; border-radius: 14px !important; font-size: 14px; }
/* Explicit states: the base theme (blue_voltage_theme.min.css) compiles .alert-danger green. */
.pm-auth .alert-danger { background: color-mix(in srgb, var(--pm-danger) 9%, #fff); border-color: color-mix(in srgb, var(--pm-danger) 28%, #fff); color: color-mix(in srgb, var(--pm-danger) 75%, #000); }
.pm-auth .alert-success { background: color-mix(in srgb, var(--pm-green) 9%, #fff); border-color: color-mix(in srgb, var(--pm-green) 28%, #fff); color: color-mix(in srgb, var(--pm-green) 80%, #000); }
.pm-auth .alert-info { background: var(--pm-blue-50); border-color: color-mix(in srgb, var(--pm-blue) 20%, #fff); color: var(--pm-navy); }
.pm-auth .pm-auth-notice { margin-bottom: 24px; }

.pm-auth .otp-digit-group { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.pm-auth .otp-digit { height: 58px; padding: 0; text-align: center; font: 700 22px/1 var(--pm-head); }

.pm-auth-legal { text-align: center; font-size: 13px; color: var(--pm-muted); }

/* ── Registration (register_pmcsms.php) ──────────────────────────────── */
.pm-auth-register .pm-auth-panel { max-width: 520px; }

.pm-auth-steps { display: grid; gap: 14px; max-width: 400px; margin: 0 0 24px; padding: 0; list-style: none; }
.pm-auth-steps li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: var(--pm-bubble);
    background: rgba(255, 255, 255, .06);
}
.pm-auth-steps span { flex: none; font: 800 15px/1.4 var(--pm-head); color: var(--pm-amber); }
.pm-auth-steps b { display: block; font-size: 15px; color: #fff; }
.pm-auth-steps small { display: block; font-size: 13px; color: var(--pm-on-dark); }

.pm-auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.pm-auth-optional { font-weight: 500; color: var(--pm-muted); }
.pm-auth-hint { display: block; margin-top: 6px; font-size: 13px; color: var(--pm-muted); }
.pm-auth-hint:empty { display: none; }
.pm-auth-field-error { display: block; font-size: 13px; }
.pm-auth-field-error:empty { display: none; }
.pm-auth-field-error > div { margin-top: 6px; }
.pm-auth .password-requirements ul { margin: 4px 0 0; padding-left: 18px; }
.pm-auth .username-suggestion-link { font-weight: 600; }
.pm-auth .pm-auth-hint .fa, .pm-auth-field-error .fa { margin-right: 4px; }
.pm-auth .form-control:disabled { background: var(--pm-tint); color: var(--pm-muted); cursor: not-allowed; }

/* register.js toggles the submit with .val(), so it is an <input>; status cards reuse the class on an <a>. */
input.pm-auth-submit { appearance: none; -webkit-appearance: none; }
.pm-auth a.pm-auth-submit { color: #fff; text-decoration: none; }

/* ── Status cards (registration closed/moved, link expired, email confirmation) ── */
.pm-auth-notice-card h1 { font-size: clamp(28px, 3vw, 34px); font-weight: 800; color: var(--pm-navy); }
.pm-auth-notice-card > p { margin-top: 12px !important; color: var(--pm-muted); }
.pm-auth-notice-card .pm-auth-submit { margin-top: 24px; }
.pm-auth-icon.is-success { background: color-mix(in srgb, var(--pm-green) 12%, #fff); color: var(--pm-green); }
.pm-auth-icon.is-error { background: color-mix(in srgb, var(--pm-danger) 10%, #fff); color: var(--pm-danger); }

/* Bootstrap utility classes written by login.js / register.js (no Bootstrap CSS on these pages). */
.pm-auth .text-danger { color: var(--pm-danger) !important; }
.pm-auth .text-success { color: var(--pm-green) !important; }
.pm-auth .text-warning { color: #b7791f !important; }
.pm-auth .text-info { color: var(--pm-blue) !important; }
.pm-auth .text-muted { color: var(--pm-muted) !important; }
.pm-auth .d-block { display: block !important; }
.pm-auth .mt-1 { margin-top: 4px !important; }
.pm-auth .mb-0 { margin-bottom: 0 !important; }

/* ── Standalone document base (v/layouts/layout_pmcsms_auth.php loads no Bootstrap CSS) ── */
body.pm-auth-body { margin: 0; background: #fff; }
.d-none { display: none !important; }

/* bootbox (login.js "Sign in Options") emits Bootstrap 4 modal markup; minimal styles for it. */
.pm-auth-body .modal { position: fixed; inset: 0; z-index: 1050; display: none; overflow-y: auto; outline: 0; }
.pm-auth-body .modal.show { display: block; }
.pm-auth-body .modal-dialog { position: relative; width: auto; max-width: 440px; margin: 12vh auto 24px; padding: 0 16px; }
.pm-auth-body .modal.fade .modal-dialog { transform: translateY(-16px); transition: transform .2s ease-out; }
.pm-auth-body .modal.show .modal-dialog { transform: none; }
.pm-auth-body .modal-content { overflow: hidden; border-radius: 20px; background: #fff; box-shadow: 0 30px 60px -20px rgba(4, 20, 73, .45); font-family: "DM Sans", system-ui, sans-serif; color: #3d4b72; }
.pm-auth-body .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.pm-auth-body .modal-title { margin: 0; font: 800 20px/1.2 "Schibsted Grotesk", system-ui, sans-serif; color: var(--dark, #041449); }
.pm-auth-body .modal-header .close, .pm-auth-body .bootbox-close-button { border: 0; background: none; font-size: 24px; line-height: 1; color: #6c7aa0; cursor: pointer; }
.pm-auth-body .modal-body > .bootbox-close-button { float: right; margin: -4px -6px 0 12px; }
.pm-auth-body .modal-header + .modal-body { padding-top: 14px; }
.pm-auth-body .modal-body { padding: 22px 24px 8px; font-size: 15px; }
.pm-auth-body .modal-body p { margin: 0 0 8px; }
.pm-auth-body .modal-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 12px 24px 22px; }
.pm-auth-body .modal-footer .btn { padding: 11px 18px; border: 1px solid transparent; border-radius: 999px; font: 600 14px/1 "DM Sans", system-ui, sans-serif; cursor: pointer; }
.pm-auth-body .modal-footer .btn-primary { background: linear-gradient(90deg, #003eaf 0%, var(--primary, #0558ee) 100%); color: #fff; }
.pm-auth-body .modal-footer .btn-secondary { border-color: #cdd8ee; background: #fff; color: var(--dark, #041449); }
.pm-auth-body .modal-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(4, 20, 73, .55); }
.pm-auth-body .modal-backdrop.fade { opacity: 0; transition: opacity .15s linear; }
.pm-auth-body .modal-backdrop.show { opacity: 1; }
.pm-auth-body.modal-open { overflow: hidden; }

/* ── Add to Home Screen banner (mobile only) ──────────────────────────── */
.add-to-home-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    z-index: 10000;
    display: none;
    align-items: center;
    gap: 12px;
    max-width: 90%;
    padding: 12px 20px;
    border-radius: 999px;
    background: linear-gradient(90deg, #003eaf 0%, var(--primary, #0558ee) 100%);
    box-shadow: 0 12px 28px -12px rgba(4, 20, 73, .6);
    font: 500 14px/1.3 "DM Sans", system-ui, sans-serif;
    color: #fff;
    transform: translateX(-50%);
}
.add-to-home-banner.show { display: flex; }
.add-to-home-banner .icon { font-size: 16px; }
.add-to-home-banner .close-btn { margin-left: 4px; padding: 0; border: 0; background: none; font-size: 20px; line-height: 1; color: #fff; opacity: .75; cursor: pointer; }
.add-to-home-banner .close-btn:hover { opacity: 1; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (min-width: 992px) {
    .pm-auth-brand { position: sticky; top: 0; height: 100vh; max-height: 100vh; overflow-y: auto; scrollbar-width: none; }
    .pm-auth-brand::-webkit-scrollbar { display: none; }
}

@media (max-width: 1199.98px) {
    .pm-auth-brand { padding: 36px 40px 48px; }
}

@media (max-width: 991.98px) {
    .pm-auth { grid-template-columns: 1fr; }
    .pm-auth-brand { gap: 18px; padding: 24px 16px 36px; }
    .pm-auth-logo img { height: 32px; }
    .pm-auth-brand-copy { margin-top: 0; }
    .pm-auth-brand h2 { margin-top: 10px; font-size: 30px; }
    .pm-auth-brand-copy > p:last-child, .pm-auth-phone, .pm-auth-points, .pm-auth-steps { display: none; }
    .pm-auth-wave { height: 60px; }
    .pm-auth-main { padding: 20px 16px 28px; margin-top: -16px; border-radius: 20px 20px 0 0; position: relative; }
    .pm-auth-panel { margin: 8px auto 24px; }
}

@media (max-width: 575.98px) {
    .pm-auth-grid { grid-template-columns: 1fr; }
    .pm-auth-eyebrow { font-size: 11px; }
    .pm-auth-brand h2 { font-size: 26px; }
    .pm-auth-topbar { font-size: 13px; }
    .pm-auth .otp-digit-group { gap: 6px; }
    .pm-auth .otp-digit { height: 50px; font-size: 20px; }
    .pm-auth-links { flex-direction: column; align-items: center; }
}

@media (min-width: 768px) {
    .add-to-home-banner { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .pm-auth *, .pm-auth *::before, .pm-auth *::after { transition: none !important; animation-duration: .01ms !important; }
}
