/* ============================================================
   Misesso — Authentication pages (Login / Register / Forgot /
   Reset / Verify OTP)
   On-theme, header-visible layout: the normal site header & footer
   stay in place (menus are public), and the form sits in a clean,
   modern white card on a light background — matching the rest of
   the site's pages and the #006aff brand accent.
   ============================================================ */

/* ---- Tokens ---- */
:root {
    --auth-accent:     #006aff;   /* brand blue                  */
    --auth-accent-dk:  #0059d9;   /* hover                       */
    --auth-fg:         #0f172a;
    --auth-fg-muted:   #64748b;
    --auth-border:     #e5e9f0;
    --auth-field-bg:   #f8fafc;
    --auth-page-bg:    #f4f7fb;   /* light page behind the card  */
}

/* ============================================================
   Page shell — header & footer remain visible
   ============================================================ */
/* Paint the light page colour onto the document itself and force the
   wrapper full-width, so no white edge can show on the right even when a
   parent is narrower than the viewport (e.g. while Google Translate is
   active, which can shrink the layout). auth.css only loads on auth pages,
   so this is scoped to them. */
html, body { background-color: var(--auth-page-bg); }
/* Full-width + sticky footer: make the page fill the viewport so the site
   footer sits at the bottom on short pages (sign in), matching the taller
   content pages — instead of floating in the middle with a gap below it. */
#wrapper { width: 100% !important; max-width: 100% !important; min-height: 100vh; display: flex; flex-direction: column; }
#wrapper > footer { flex-shrink: 0; }

/* Keep the site header pinned at the top while only the content scrolls.
   Use overflow-x:clip (not hidden) on the document so it doesn't become a
   scroll container — overflow:hidden would stop position:sticky from working. */
html { overflow-x: clip; }
body { overflow-x: clip !important; }   /* override the theme's body{overflow-x:hidden} */
#header-container {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
}
/* Compact the site footer on auth pages so the whole page fits without scrolling */
#wrapper .second-footer { padding-top: 0.85rem; padding-bottom: 0.85rem; }

.auth-page {
    background-color: var(--auth-page-bg);
    /* subtle dotted texture echoing the home sections, kept very light */
    background-image: radial-gradient(rgba(0, 106, 255, 0.05) 1px, transparent 1px);
    background-size: 26px 26px;
    padding: 18px 16px 18px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex: 1 0 auto;       /* grow to fill the viewport so the footer is pushed to the bottom */
}

.auth-card {
    width: 100%;
    margin-top: 30px;
    max-width: 440px;
    margin-left: auto;    /* belt-and-suspenders centring (also works if flex falls back) */
    margin-right: auto;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 18px 50px rgba(16, 24, 40, 0.07);
    padding: 26px 34px;
    box-sizing: border-box;
}
.auth-card.wide { max-width: 720px; }

/* ---- Card header / brand area ---- */
.auth-head { text-align: center; margin-bottom: 16px; }
.auth-head-logo { display: inline-block; margin-bottom: 8px; }
.auth-head-logo img { height: 34px; width: auto; }
.auth-head h1 {
    font-size: 1.35rem; font-weight: 700; color: var(--auth-fg);
    letter-spacing: -0.028em; margin: 0 0 4px; text-transform: none;
}
.auth-head p { color: var(--auth-fg-muted); font-size: 0.85rem; margin: 0; }

/* keep legacy heading class working (left-aligned variant) */
.form-heading { margin-bottom: 26px; }
.form-heading h1 { font-size: 1.55rem; font-weight: 700; color: var(--auth-fg); letter-spacing: -0.028em; margin: 0 0 6px; text-transform: none; }
.form-heading p { color: var(--auth-fg-muted); font-size: 0.9rem; margin: 0; }

/* ---- Alerts ---- */
.auth-card .alert { border-radius: 11px; font-size: 0.88rem; border: 1px solid transparent; }
.auth-card .alert-success { background: #ecfdf3; color: #027a48; border-color: #abefc6; }
.auth-card .alert-danger  { background: #fef3f2; color: #b42318; border-color: #fecdca; }

/* ============================================================
   Section divider label (Register)
   ============================================================ */
.section-label {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: #94a3b8; margin: 10px 0 8px; display: flex; align-items: center; gap: 10px;
}
.section-label:first-child { margin-top: 0; }
.section-label::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, var(--auth-border), transparent); }

/* ============================================================
   Fields
   ============================================================ */
.f-group { margin-bottom: 12px; }
.f-label { display: block; font-size: 0.72rem; font-weight: 700; color: #374151; margin-bottom: 4px; letter-spacing: 0.05em; text-transform: uppercase; }
.f-label .req { color: #ef4444; margin-left: 2px; }
.f-wrap { position: relative; }
.f-wrap > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 0.85rem; pointer-events: none; }
.f-input {
    width: 100%; padding: 9px 14px 9px 40px;
    border: 1.5px solid var(--auth-border); border-radius: 10px;
    font-size: 0.9rem; color: var(--auth-fg); background: var(--auth-field-bg);
    outline: none; box-sizing: border-box; appearance: none;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.f-input::placeholder { color: #9ca3af; }
.f-input:hover { border-color: #cbd5e1; }
.f-input:focus { border-color: var(--auth-accent); background: #fff; box-shadow: 0 0 0 3px rgba(0, 106, 255, 0.12); }

.f-select {
    width: 100%; padding: 9px 34px 9px 14px;
    border: 1.5px solid var(--auth-border); border-radius: 10px;
    font-size: 0.9rem; color: var(--auth-fg);
    background: var(--auth-field-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    outline: none; box-sizing: border-box; appearance: none; cursor: pointer;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.f-select:focus { border-color: var(--auth-accent); background-color: #fff; box-shadow: 0 0 0 3px rgba(0, 106, 255, 0.12); }

/* password reveal toggle */
.f-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #9ca3af; cursor: pointer; font-size: 0.9rem; padding: 4px; line-height: 1; }
.f-toggle:hover { color: var(--auth-accent); }

/* register grids */
.fields-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 16px; }
.fields-grid .span-2 { grid-column: span 2; }
.fields-grid .span-3 { grid-column: 1 / -1; }
.fields-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.fields-grid .f-group, .fields-grid-2 .f-group { margin-bottom: 0; }

/* phone input (Register) */
.phone-wrap { display: flex; border: 1.5px solid var(--auth-border); border-radius: 10px; background: var(--auth-field-bg); transition: border-color .15s, box-shadow .15s; position: relative; }
.phone-wrap:focus-within { border-color: var(--auth-accent); box-shadow: 0 0 0 3px rgba(0, 106, 255, 0.12); background: #fff; }
.country-dropdown { position: relative; flex-shrink: 0; }
.country-trigger { display: flex; align-items: center; gap: 5px; padding: 9px 10px; min-width: 105px; background: #f1f5f9; border-right: 1.5px solid var(--auth-border); border-radius: 8px 0 0 8px; cursor: pointer; font-size: 0.84rem; color: #374151; user-select: none; white-space: nowrap; }
.country-trigger .caret { margin-left: auto; font-size: 0.6rem; color: #9ca3af; }
.country-panel { display: none; position: absolute; top: calc(100% + 4px); left: 0; width: 240px; background: #fff; border: 1.5px solid var(--auth-border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1); z-index: 9999; overflow: hidden; }
.country-panel.open { display: block; }
.country-search { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
.country-search input { width: 100%; padding: 7px 10px; border: 1.5px solid var(--auth-border); border-radius: 7px; font-size: 0.82rem; outline: none; background: #fafafa; box-sizing: border-box; }
.country-search input:focus { border-color: var(--auth-accent); }
.country-list { max-height: 200px; overflow-y: auto; padding: 4px 0; }
.country-list::-webkit-scrollbar { width: 4px; }
.country-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }
.country-option { padding: 8px 14px; font-size: 0.83rem; color: #374151; cursor: pointer; transition: background .1s; white-space: nowrap; }
.country-option:hover { background: #f0f5ff; color: var(--auth-accent); }
.country-option.selected { background: #e8f0ff; color: var(--auth-accent); font-weight: 600; }
.phone-number-input { border: none !important; border-radius: 0 8px 8px 0 !important; padding: 9px 13px !important; font-size: 0.9rem !important; font-family: monospace; letter-spacing: 1px; flex: 1; outline: none; box-shadow: none !important; background: transparent !important; color: var(--auth-fg); min-width: 0; }

/* ============================================================
   Row with remember / forgot
   ============================================================ */
.form-row { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 14px; flex-wrap: wrap; gap: 8px; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #374151; cursor: pointer; }
.check-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--auth-accent); cursor: pointer; }
.link-muted { font-size: 0.85rem; color: var(--auth-accent); text-decoration: none; font-weight: 500; }
.link-muted:hover { text-decoration: underline; }

/* terms (Register) */
.form-footer-block { margin-top: 10px; padding-top: 12px; border-top: 1px solid #f1f5f9; }
.terms-label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #374151; cursor: pointer; margin-bottom: 12px; }
.terms-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--auth-accent); flex-shrink: 0; cursor: pointer; }
.terms-label a { color: var(--auth-accent); text-decoration: none; font-weight: 500; }
.terms-label a:hover { text-decoration: underline; }
.submit-row { display: flex; align-items: center; gap: 12px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary-auth {
    width: 100%; padding: 11px; background: var(--auth-accent); color: #fff; border: none;
    border-radius: 10px; font-size: 0.92rem; font-weight: 600; cursor: pointer; letter-spacing: 0.01em;
    box-shadow: 0 1px 3px rgba(0, 106, 255, 0.3), 0 6px 18px rgba(0, 106, 255, 0.20);
    transition: background .15s, box-shadow .15s, transform .1s;
}
.btn-primary-auth:hover { background: var(--auth-accent-dk); box-shadow: 0 2px 8px rgba(0, 106, 255, 0.4), 0 10px 26px rgba(0, 106, 255, 0.24); }
.btn-primary-auth:active { transform: scale(0.99); }
.submit-row .btn-primary-auth { width: auto; padding: 11px 28px; white-space: nowrap; }

.or-line { display: flex; align-items: center; gap: 14px; margin: 12px 0; font-size: 0.78rem; color: #94a3b8; letter-spacing: 0.02em; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: #eef2f6; }

.btn-google-auth {
    width: 100%; padding: 10px; background: #fff; color: #374151; border: 1.5px solid var(--auth-border);
    border-radius: 10px; font-size: 0.88rem; font-weight: 500; cursor: pointer; text-decoration: none;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: border-color .15s, box-shadow .15s, color .15s;
}
.btn-google-auth:hover { border-color: #cbd5e1; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07); color: #111827; text-decoration: none; }
.submit-row .btn-google-auth { width: auto; padding: 10px 20px; }
.g-red { color: #ea4335; }

.form-footer-text { text-align: center; margin-top: 14px; font-size: 0.85rem; color: #64748b; }
.form-footer-text a { color: var(--auth-accent); font-weight: 600; text-decoration: none; }
.form-footer-text a:hover { text-decoration: underline; }

/* admin portal entry (Login) */
.sa-portal-entry { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #f1f5f9; }
.sa-portal-label { font-size: 0.72rem; color: #94a3b8; }
.sa-portal-link { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 0.75rem; font-weight: 600; color: #475569; text-decoration: none !important; background: var(--auth-field-bg); transition: border-color .15s, color .15s, background .15s; }
.sa-portal-link i { font-size: 0.7rem; color: #64748b; }
.sa-portal-link:hover { border-color: #cbd5e1; background: #f1f5f9; color: #1e293b; }

/* OTP code input — large, spaced, centered */
.otp-input { text-align: center; letter-spacing: 0.5em; font-size: 1.25rem !important; font-weight: 600; padding-left: 14px !important; font-family: monospace; }

/* a11y: visible focus rings for keyboard users */
.btn-primary-auth:focus-visible, .btn-google-auth:focus-visible, .link-muted:focus-visible,
.sa-portal-link:focus-visible, .form-footer-text a:focus-visible, .f-toggle:focus-visible {
    outline: 2px solid var(--auth-accent); outline-offset: 2px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
    .auth-card { padding: 32px 22px; border-radius: 16px; }
    .auth-page { padding: 36px 14px 56px; }
    .fields-grid { grid-template-columns: 1fr 1fr; }
    .fields-grid .span-2 { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
    .fields-grid, .fields-grid-2 { grid-template-columns: 1fr; }
    .fields-grid .span-2, .fields-grid .span-3 { grid-column: 1 / -1; }
    .submit-row { flex-direction: column-reverse; }
    .submit-row .btn-primary-auth, .submit-row .btn-google-auth { width: 100%; justify-content: center; }
    .auth-head h1 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
    .btn-primary-auth, .f-input { transition: none; }
}
