/* =========================================================
   LOGIN / FORGOT USERNAME / FORGOT PASSWORD
   Shared layout, card, form fields, and tab highlighting
   ========================================================= */

body.cp-login-page {
    background-color: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    font-family: var(--fontBook, 'ITC Franklin Gothic LT Book', sans-serif, Arial, Helvetica);
    font-size: 1rem;
    line-height: 1.6;
    --cp-login-shell-width: 1006px;
    --cp-login-shell-gutter: 16px;
    --cp-login-band: min(var(--cp-login-shell-width), calc(100vw - (2 * var(--cp-login-shell-gutter))));
}

/* Shared width — header, main (image + form), footer */
.cp-login-shell-band,
.cp-login-top-inner,
.cp-login-main-container,
body.cp-login-page #footer_end {
    width: var(--cp-login-band);
    max-width: var(--cp-login-shell-width);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.cp-login-top-inner {
    margin-bottom: 20px;
    padding: 0;
    border-bottom: 3px solid #f8991d;
    line-height: 0;
}

.cp-login-top-banner {
    width: 100%;
    background: transparent;
    padding: 0;
    flex-shrink: 0;
}

.cp-login-top-banner img {
    width: 100%;
    max-width: 1006px;
    height: auto;
    max-height: 127px;
    display: block;
    margin: 0;
    image-rendering: auto;
}

.cp-login-main-container {
    margin-bottom: 0;
    padding: 0 0 12px;
    flex: 0 0 auto;
}

/* Keep row inside band — cancel Bootstrap negative margins */
.cp-login-main-container > .row {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    --bs-gutter-x: 1.5rem;
}

/* Outer edges match the header band (Bootstrap column padding was insetting both sides) */
body.cp-login-page .cp-login-main-container .row > [class*="col-"]:first-child {
    padding-left: 0;
}

body.cp-login-page .cp-login-main-container .row > [class*="col-"]:last-child {
    padding-right: 0;
}

/* Equal-height columns — banner + login card stretch together */
.cp-login-main-container .row {
    align-items: stretch;
    row-gap: 1.5rem;
}

.cp-login-main-container .row > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

/* Left promotional banner — fills column height to match login card */
.cp-login-left-banner {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    min-height: 420px;
    height: 100%;
    overflow: hidden;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0, 82, 156, 0.10);
    border: 1px solid #e2e8f0;
    background: #eef4fa;
}

.cp-login-left-banner img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 420px;
    object-fit: cover;
    object-position: center center;
    border-radius: 14px;
}

/* Login Card — stretch to same height as banner column */
.cp-login-card {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    width: 100%;
    flex: 1 1 auto;
    height: 100%;
    min-height: 420px;
    display: flex;
    flex-direction: column;
}

/* Card Header & Tabs
   Active tab = navy + white text
   Inactive tab = white + navy text */
.cp-card-nav-header {
    background: #ffffff;
    padding: 0;
    border-bottom: 3px solid #f8991d;
}

.cp-login-page-title {
    margin: 0;
    padding: 0.9rem 1.25rem;
    text-align: center;
    font-size: 1rem;
    line-height: 1.3;
    font-family: var(--fontDemi, 'ITC Franklin Gothic LT Demi', sans-serif, Arial, Helvetica);
    font-weight: 600;
    font-synthesis: none;
    color: #ffffff;
    background: #00529c;
    letter-spacing: 0;
    text-shadow: none;
    filter: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
}

.cp-login-nav-tabs {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    border: none;
}

.cp-login-nav-tabs.nav-tabs {
    border-bottom: none;
}

.cp-login-nav-tabs .nav-item {
    flex: 1;
    margin: 0;
}

.cp-login-nav-tabs .nav-link {
    width: 100%;
    padding: 0.9rem 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    line-height: 1.3;
    font-family: var(--fontDemi, 'ITC Franklin Gothic LT Demi', sans-serif, Arial, Helvetica);
    font-weight: 600;
    font-synthesis: none;
    color: #00529c;
    background: #ffffff;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    letter-spacing: 0;
    text-shadow: none;
    filter: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.cp-login-nav-tabs .nav-link.active,
.cp-login-nav-tabs .nav-link.active:hover,
.cp-login-nav-tabs .nav-link.active:focus {
    color: #ffffff !important;
    background: #00529c !important;
    border-color: transparent transparent #f8991d transparent !important;
    border-bottom-color: #f8991d !important;
}

.cp-login-nav-tabs .nav-link:hover:not(.active) {
    color: #00529c;
    background: #eef4fa;
}

/* Card Body — grow so card matches banner when form is shorter */
.cp-card-body {
    padding: 1.5rem 1.75rem;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Forms fill the card — legacy style.css caps form.forgot_password at 350px */
body.cp-login-page .cp-card-body form,
body.cp-login-page form.forgot_password,
body.cp-login-page form.active {
    width: 100%;
    max-width: 100%;
    float: none;
    margin: 0;
    background: transparent;
    display: block;
}

/* Form Labels & Fields */
.cp-login-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.375rem;
}

.cp-login-label a {
    float: right;
    text-transform: none;
    font-weight: 600;
    font-size: 0.75rem;
    color: #00529c;
    text-decoration: none;
    letter-spacing: 0;
}

.cp-login-label a:hover {
    text-decoration: underline;
}

.cp-login-field {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1.1rem;
}

.cp-login-input {
    width: 100%;
    max-width: 100%;
    padding: 0.6rem 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
    box-sizing: border-box;
}

body.cp-login-page .cp-login-input:focus,
body.cp-login-page .cp-login-input:focus-visible {
    border-color: #00529c;
    box-shadow: 0 0 0 3px rgba(0, 82, 156, 0.12);
    outline: none;
}

.cp-login-error,
.cp-login-field .error,
#warn.error,
span.error,
#err_dob {
    display: block;
    color: #ef4444;
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 4px;
}

.cp-login-error:empty,
.cp-login-field .error:empty,
#warn:empty,
#err_dob:empty {
    display: none;
    margin: 0;
}

/* Captcha wrap */
.cp-captcha-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.cp-captcha-wrap img {
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    height: 44px;
    flex: 0 0 auto;
}

.cp-captcha-wrap .cp-login-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

/* DOB row — stretch equally, matching username-tab input height */
.cp-dob-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.cp-dob-row select,
body.cp-login-page .cp-dob-row #dob_day,
body.cp-login-page .cp-dob-row #dob_month,
body.cp-login-page .cp-dob-row #dob_year {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    height: auto;
    display: block;
    text-align: left;
    margin: 0;
    padding: 0.6rem 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.875rem;
    font-family: inherit;
    color: #1e293b;
    background: #fff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.cp-dob-row select:focus,
.cp-dob-row select:focus-visible,
body.cp-login-page .cp-dob-row #dob_day:focus,
body.cp-login-page .cp-dob-row #dob_day:focus-visible,
body.cp-login-page .cp-dob-row #dob_month:focus,
body.cp-login-page .cp-dob-row #dob_month:focus-visible,
body.cp-login-page .cp-dob-row #dob_year:focus,
body.cp-login-page .cp-dob-row #dob_year:focus-visible {
    border-color: #00529c;
    box-shadow: 0 0 0 3px rgba(0, 82, 156, 0.12);
    outline: none;
}

/* Submit Button — icon glyphs use Font Awesome only */
.cp-login-btn {
    width: 100%;
    padding: 0.725rem;
    background: #00529c;
    color: #ffffff;
    font-size: 0.9375rem;
    font-family: var(--fontDemi, 'ITC Franklin Gothic LT Demi', sans-serif, Arial, Helvetica);
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.18s ease;
    margin-top: 0.5rem;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 14px -4px rgba(0, 82, 156, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.cp-login-btn .fa,
.cp-login-btn .fas,
.cp-login-btn .far,
.cp-login-btn .fa-solid,
.cp-login-btn .fa-regular,
.cp-login-btn i[class*="fa-"] {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
    font-style: normal;
    line-height: 1;
}

.cp-login-btn:hover {
    background: #002e5a;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -4px rgba(0, 82, 156, 0.5);
}

/* Card Footer */
.cp-card-foot {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 0.875rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8125rem;
}

.cp-card-foot a {
    color: #00529c;
    text-decoration: none;
    font-weight: 600;
}

.cp-card-foot a:hover {
    text-decoration: underline;
}

/* Footer — aligned band; override ui-sync full-bleed #footer_end on login pages */
body.cp-login-page #footer_end {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 1;
    width: var(--cp-login-band) !important;
    max-width: var(--cp-login-shell-width) !important;
    transform: none;
    margin-top: 16px;
    margin-bottom: 0;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    background: transparent;
    border: none;
    text-align: center;
    flex-shrink: 0;
    box-sizing: border-box;
}

body.cp-login-page #footer_end > center {
    display: block;
    width: 100%;
    max-width: none;
    text-align: center;
}

/* footer.php spacer table is empty on login pages and throws the bar off-center */
body.cp-login-page #cpfooter {
    display: none;
}

body.cp-login-page footer.cp-page-footer,
body.cp-login-page footer {
    display: block;
    position: static;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 12px 16px;
    background: #00529c;
    border: none;
    border-radius: 0;
    border-top: 3px solid #f8991d;
    box-shadow: 0 -6px 18px rgba(0, 46, 90, 0.18);
    box-sizing: border-box;
}

body.cp-login-page footer .container {
    max-width: none;
    width: 100%;
    margin: 0;
    padding-left: 0;
    padding-right: 0;
}

body.cp-login-page footer .cp-page-footer-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    color: #ffffff;
    font-size: 0.8125rem;
    font-family: var(--fontBook, 'ITC Franklin Gothic LT Book', sans-serif, Arial, Helvetica);
    font-weight: 600;
    line-height: 1.4;
}

body.cp-login-page footer .cp-page-footer-copy span,
body.cp-login-page footer.cp-page-footer span {
    color: #ffffff;
    font-weight: 600;
    padding: 0;
}

body.cp-login-page footer .cp-page-footer-sep,
body.cp-login-page footer.cp-page-footer .cp-page-footer-sep {
    padding: 0 7px;
    color: #ffffff;
    opacity: 0.65;
}

body.cp-login-page footer a,
body.cp-login-page footer.cp-page-footer a {
    color: #ffcb09;
    font-weight: 700;
    text-decoration: none;
}

body.cp-login-page footer a:hover,
body.cp-login-page footer a:focus,
body.cp-login-page footer.cp-page-footer a:hover,
body.cp-login-page footer.cp-page-footer a:focus {
    color: #ffffff;
    text-decoration: underline;
}

@media (max-width: 991.98px) {
    .cp-login-top-inner {
        margin-bottom: 16px;
    }

    .cp-login-left-banner,
    .cp-login-left-banner img,
    .cp-login-card {
        min-height: 320px;
    }

    .cp-login-left-banner img {
        min-height: 320px;
    }
}

@media (max-width: 767.98px) {
    .cp-login-top-inner {
        margin-bottom: 14px;
    }

    body.cp-login-page {
        --cp-login-shell-gutter: 12px;
    }

    .cp-login-main-container .row > [class*="col-"] {
        display: block;
        padding-left: 0;
        padding-right: 0;
    }

    .cp-login-left-banner,
    .cp-login-card {
        min-height: 0;
        height: auto;
    }

    .cp-login-left-banner {
        min-height: 200px;
    }

    .cp-login-left-banner img {
        min-height: 200px;
        max-height: 260px;
    }

    .cp-login-card {
        min-height: 0;
    }

    .cp-card-body {
        justify-content: flex-start;
    }

    .cp-captcha-wrap {
        flex-wrap: wrap;
    }

    .cp-captcha-wrap .cp-login-input {
        flex: 1 1 100%;
        width: 100%;
    }
}

/* Announcement Popup */
#popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 50px 2px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    border-radius: 12px;
    overflow: hidden;
}

/* Beat any leftover compact-theme rules if common.css tokens change.
   Keep border/shadow out of !important here — that was blocking :focus highlight. */
body.cp-login-page .cp-login-input,
body.cp-login-page .cp-dob-row select,
body.cp-login-page .cp-dob-row #dob_day,
body.cp-login-page .cp-dob-row #dob_month,
body.cp-login-page .cp-dob-row #dob_year {
    height: auto !important;
    border-radius: 10px !important;
}

/* Focus highlight must win over base + theme overrides (login + forgot pages) */
body.cp-login-page .cp-login-input:focus,
body.cp-login-page .cp-login-input:focus-visible,
body.cp-login-page .cp-dob-row select:focus,
body.cp-login-page .cp-dob-row select:focus-visible,
body.cp-login-page .cp-dob-row #dob_day:focus,
body.cp-login-page .cp-dob-row #dob_day:focus-visible,
body.cp-login-page .cp-dob-row #dob_month:focus,
body.cp-login-page .cp-dob-row #dob_month:focus-visible,
body.cp-login-page .cp-dob-row #dob_year:focus,
body.cp-login-page .cp-dob-row #dob_year:focus-visible {
    border-color: #00529c !important;
    box-shadow: 0 0 0 3px rgba(0, 82, 156, 0.12) !important;
    outline: none;
}

body.cp-login-page .cp-login-btn {
    padding: 0.725rem !important;
    border-radius: 10px !important;
    font-weight: 700 !important;
    font-size: 0.9375rem !important;
    background: #00529c !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 4px 14px -4px rgba(0, 82, 156, 0.4) !important;
}

body.cp-login-page .cp-login-btn:hover {
    background: #002e5a !important;
    color: #fff !important;
    box-shadow: 0 6px 18px -4px rgba(0, 82, 156, 0.5) !important;
    transform: translateY(-1px);
}
