/* ============================================================
   Access auth module — shared login/register/otp/forgot theme.
   Extracted from the legacy InternalLogin inline <style> so the
   new views stay CSP-clean (no inline style). Behaviour-identical.
   ============================================================ */

/* === Page background === */
.access-page-bg {
    background: linear-gradient(135deg, #e7f4f7 0%, #f0fbfd 50%, #fff 100%),
                url('/scdlr/images/scenic-view-farm-against-blue-sky.jpg') no-repeat center center;
    background-blend-mode: overlay;
    background-size: cover;
    min-height: 100vh;
    padding: 14px 8px;
}

.access-shell {
    max-width: 960px;
    margin: 0 auto;
}

.access-card {
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 60px color-mix(in srgb, var(--nav-bg) 18%, transparent),
                0 6px 20px rgba(0, 0, 0, 0.08);
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
}

/* === Left brand / hero panel === */
.access-brand {
    background: var(--nav-bg);
    color: #fff;
    padding: 26px 22px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.access-brand::before,
.access-brand::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.access-brand::before {
    width: 240px;
    height: 240px;
    top: -80px;
    right: -80px;
}

.access-brand::after {
    width: 160px;
    height: 160px;
    bottom: -50px;
    left: -50px;
}

/* Profile-only variant: vertically centred avatar + title */
.access-brand-profile {
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 28px;
}

.access-profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 3px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
    position: relative;
    color: #ffffff;
}

.access-profile-avatar i {
    font-size: 110px;
    line-height: 1;
    color: #ffffff;
}

.access-brand-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.15;
    text-align: center;
    letter-spacing: 0.3px;
    position: relative;
}

/* === Right form panel === */
.access-form-panel {
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.access-form-head {
    margin-bottom: 18px;
}

.access-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--nav-bg);
    margin: 0 0 4px;
    letter-spacing: 0.2px;
}

.access-form-sub {
    font-size: 12pt;
    color: #5e666d;
    margin: 0;
}

.access-field {
    margin-bottom: 14px;
}

.access-label {
    display: block;
    font-size: 12pt;
    font-weight: 600;
    color: #2d3a48;
    margin-bottom: 6px;
}

.access-input-wrap {
    position: relative;
}

.access-input-wrap > .access-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--nav-bg);
    font-size: 16px;
    pointer-events: none;
}

.form-control.access-input {
    height: 44px;
    padding: 0 14px;               /* default: no wasted left space */
    font-size: 12pt;
    border: 1px solid color-mix(in srgb, var(--nav-bg) 22%, #fff);
    border-radius: 10px;
    background: color-mix(in srgb, var(--nav-bg) 4%, #fff);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

/* Reserve the left icon space ONLY when a left icon is actually present
   (fields without an icon — e.g. registration — keep the full width for text). */
.access-input-icon ~ .form-control.access-input {
    padding-left: 38px;
}

.form-control.access-input:focus {
    border-color: var(--nav-bg);
    background: #ffffff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--nav-bg) 15%, transparent);
    outline: none;
}

.form-control.access-input:-webkit-autofill,
.form-control.access-input:-webkit-autofill:hover,
.form-control.access-input:-webkit-autofill:focus,
.form-control.access-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px color-mix(in srgb, var(--nav-bg) 4%, #fff) inset !important;
    box-shadow: 0 0 0 1000px color-mix(in srgb, var(--nav-bg) 4%, #fff) inset !important;
    -webkit-text-fill-color: #1f2937 !important;
    caret-color: var(--nav-bg);
    transition: background-color 5000s ease-in-out 0s;
}

/* Password input + show/hide toggle */
.access-password-wrap {
    position: relative;
}

.access-password-wrap .form-control.access-input {
    padding-right: 44px;
}

.access-password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: #5e666d;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.access-password-toggle:hover,
.access-password-toggle:focus-visible {
    background: color-mix(in srgb, var(--nav-bg) 12%, #fff);
    color: var(--nav-bg);
    outline: none;
}

/* Captcha block */
.access-captcha {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 6px;
}

.access-captcha-display {
    flex: 0 0 auto;
    min-width: 130px;
    background: repeating-linear-gradient(
        45deg,
        color-mix(in srgb, var(--nav-bg) 6%, #fff),
        color-mix(in srgb, var(--nav-bg) 6%, #fff) 6px,
        color-mix(in srgb, var(--nav-bg) 12%, #fff) 6px,
        color-mix(in srgb, var(--nav-bg) 12%, #fff) 12px
    );
    border: 1px solid color-mix(in srgb, var(--nav-bg) 22%, #fff);
    border-radius: 10px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    font-size: 22px;
    color: var(--nav-bg);
    letter-spacing: 6px;
    text-decoration: line-through;
    text-decoration-color: color-mix(in srgb, var(--nav-bg) 40%, transparent);
    user-select: none;
}

.access-captcha-input {
    flex: 1 1 auto;
}

/* Captcha refresh (AJAX) — mirrors the Account refresh affordance; additive only. */
.access-captcha-refresh {
    flex: 0 0 auto;
    width: 44px;
    border: 1px solid color-mix(in srgb, var(--nav-bg) 22%, #fff);
    border-radius: 10px;
    background: #fff;
    color: var(--nav-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.access-captcha-refresh:hover,
.access-captcha-refresh:focus-visible {
    background: var(--nav-bg);
    color: #fff;
}

.access-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 14px;
}

.btn-access-primary {
    flex: 1 1 auto;
    height: 46px;
    background: var(--nav-bg);
    background: linear-gradient(135deg, var(--nav-bg) 0%, color-mix(in srgb, var(--nav-bg) 80%, #000) 100%);
    color: #ffffff !important;
    font-weight: 600;
    font-size: 12pt;
    border: none;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--nav-bg) 28%, transparent);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-access-primary:hover,
.btn-access-primary:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--nav-bg) 36%, transparent);
    filter: brightness(1.05);
    color: #ffffff !important;
    outline: none;
}

.btn-access-otp {
    flex: 0 0 auto;
    height: 46px;
    padding: 0 18px;
    background: #ffffff;
    color: var(--nav-bg) !important;
    font-weight: 600;
    font-size: 12pt;
    border: 1.5px solid var(--nav-bg);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-access-otp:hover,
.btn-access-otp:focus-visible {
    background: color-mix(in srgb, var(--nav-bg) 12%, #fff);
    color: var(--nav-bg) !important;
    text-decoration: none;
    outline: none;
}

.access-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.access-link {
    font-size: 12pt;
    color: var(--nav-bg);
    text-decoration: none;
    font-weight: 500;
}

.access-link:hover,
.access-link:focus-visible {
    text-decoration: underline;
    color: color-mix(in srgb, var(--nav-bg) 80%, #000);
}

.access-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: #5e666d;
    font-size: 11pt;
    font-weight: 500;
}

.access-divider::before,
.access-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #d8e2e6;
}

.access-register {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #d8e2e6;
    text-align: center;
    font-size: 12pt;
    color: #5e666d;
}

.access-register-links {
    margin-top: 6px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.access-register-links a {
    color: #b91c1c;
    text-decoration: none;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fef2f2;
    border: 1px solid #fde2e2;
    transition: background 0.15s ease, color 0.15s ease;
}

.access-register-links a:hover,
.access-register-links a:focus-visible {
    background: #b91c1c;
    color: #ffffff;
    text-decoration: none;
    outline: none;
}

.alert.access-alert {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fde2e2;
    border-left: 4px solid #b91c1c;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 12pt;
}

/* asp-validation-summary renders a <div><ul><li>. Keep it inline beside the alert
   icon and drop the default list bullets/indent. */
.alert.access-alert .validation-summary-errors,
.alert.access-alert .validation-summary-errors ul,
.alert.access-alert .validation-summary-errors li {
    display: inline;
}

.alert.access-alert .validation-summary-errors ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* "You already have an account" links partial */
.access-exists {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    border-left: 4px solid #d97706;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 12pt;
}

.access-exists-links {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Two-column form grid for the registration pages */
.access-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

/* Denser rows on the multi-field registration pages so the whole card fits
   in the viewport without page scrolling (does not affect single-column pages). */
.access-grid-2 .access-field {
    margin-bottom: 10px;
}

.access-grid-2 .access-label {
    margin-bottom: 4px;
}

@media (max-width: 900px) {
    .access-card,
    .access-shell-login .access-card {
        grid-template-columns: 1fr;
    }

    .access-form-panel {
        padding: 24px 22px;
    }
}

/* ============================================================
   Compact login (Option A — tightened two-column).
   The shared shell is 960px, which over-stretches the single-column
   LOGIN form (email/password span ~640px). Narrow it to 620px for the
   login page ONLY — scoped via `.access-shell-login` so the multi-field
   registration pages keep the full width their 2-column grids need.
   Grid ratio is untouched, so the mobile 1-column collapse still works.
   ============================================================ */
.access-shell-login {
    max-width: 800px;
}

/* Brand column ~42% of the card (like the reference InternalLogin), so the
   panel has real presence next to the form instead of a thin strip. */
.access-shell-login .access-card {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

.access-shell-login .access-brand-profile {
    padding: 36px 30px;
}

.access-shell-login .access-profile-avatar {
    width: 150px;
    height: 150px;
    margin-bottom: 24px;
    border-width: 3px;
}

.access-shell-login .access-profile-avatar i {
    font-size: 118px;
}

.access-shell-login .access-brand-title {
    font-size: 1.7rem;
}

.access-shell-login .access-form-panel {
    /* Tighter left padding pulls the fields closer to the brand panel so the
       gap matches the reference; tight top/bottom so the whole card fits one
       screen without scrolling. */
    padding: 16px 22px;
}

/* === Fit the login card in ONE screen (no page scroll) ===
   The shared `.access-page-bg` is `min-height:100vh`, but a ~180px site header
   sits above it, so the page is always 100vh + header tall → forced scroll.
   Reserve the header height instead and centre the card in what's left.
   `:has()` scopes this to the login page only, so the taller register / OTP
   pages keep their natural (scrollable) height. */
.access-page-bg:has(.access-shell-login) {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 991px) {
    .access-page-bg:has(.access-shell-login) {
        min-height: calc(100vh - 120px);
    }
}

/* Compact vertical rhythm so the form fits the reserved space. */
.access-shell-login .access-field {
    margin-bottom: 9px;
}

.access-shell-login .access-label {
    margin-bottom: 4px;
}

.access-shell-login .form-control.access-input {
    height: 40px;
}

.access-shell-login .access-row {
    margin-bottom: 2px;
}

.access-shell-login .access-actions {
    margin: 10px 0 8px;
}

.access-shell-login .btn-access-primary,
.access-shell-login .btn-access-otp {
    height: 42px;
}

.access-shell-login .access-divider {
    margin: 10px 0;
}

.access-shell-login .access-register {
    margin-top: 10px;
    padding-top: 10px;
}

@media (max-width: 480px) {
    .access-actions {
        flex-direction: column;
    }

    .btn-access-primary,
    .btn-access-otp {
        width: 100%;
    }

    .access-captcha {
        flex-direction: column;
    }

    .access-captcha-display {
        min-width: 0;
        width: 100%;
        justify-content: center;
    }

    .access-grid-2 {
        grid-template-columns: 1fr;
    }
}
