/*
 * auth.css
 *
 * Self-contained stylesheet for IdentityServer auth pages.
 * Replaces bootstrap.css + core.css + components.css + colors.css
 * (~36,600 lines) with a single focused file.
 *
 * Provides only the Bootstrap 3 classes actually used by the 8 auth pages,
 * styled to match the deployed benefits-platform login at admin-benefits.thb.sh/login.
 *
 * Design tokens:
 *   Primary:    #003322 (dark green)
 *   Accent:     #E6EC82 (lime)
 *   Background: #FCF7EE (cream)
 *   Card:       #FFFFFF, shadow 0 8px 32px rgba(0,0,0,0.1), radius 8px
 *   Input:      border #E0E0E0, radius 4px, height 56px, focus 2px solid #003322
 *   Button:     pill 50px radius, height 48px, MUI elevation shadow
 *   Font:       Karla (self-hosted, 3 weights)
 *   Danger:     #e53935
 *   Muted:      #9E9E9E
 */

/* ============================================================
   1. RESET / BOX MODEL
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 10px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
    margin: 0;
    font-size: 14px;
    line-height: 1.5384616;
    color: #333;
    background-color: #FCF7EE;
}

a {
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

a:focus {
    outline: 5px auto -webkit-focus-ring-color;
    outline-offset: -2px;
}

img {
    vertical-align: middle;
    border: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: inherit;
    font-weight: 400;
    line-height: 1.1;
    color: inherit;
}

h1 { font-size: 25px; margin-top: 3px; margin-bottom: 13px; }
h5 { font-size: 15px; margin-top: 3px; margin-bottom: 13px; }
h6 { font-size: 13px; margin-top: 3px; margin-bottom: 13px; }

h5 small {
    font-size: 13px;
}

h5 small.display-block {
    margin-top: 3px;
}

small,
.small {
    font-size: 12px;
    line-height: 1.6666667;
}

label {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 7px;
    font-weight: 500;
}

p {
    margin: 0 0 10px;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ============================================================
   2. KARLA FONT (@font-face + base)
   ============================================================ */

@font-face {
    font-family: Karla;
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/karla/Karla-Regular.ttf') format('truetype');
}

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

@font-face {
    font-family: Karla;
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/karla/Karla-ExtraBold.ttf') format('truetype');
}

body.login-container {
    background-color: #FCF7EE !important;
    color: #333 !important;
    font-family: Karla, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.login-container input,
.login-container button,
.login-container select,
.login-container textarea,
.login-container a {
    font-family: Karla, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
}

/* ============================================================
   3. LAYOUT (.page-container, centering)
   ============================================================ */

.login-container .page-container {
    padding-top: 48px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.login-container .page-content,
.login-container .content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.login-container .content {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    justify-content: center;
}

/* ============================================================
   4. CARD (.panel, .panel-body, .panel-flat, .login-form)
   ============================================================ */

.panel {
    margin-bottom: 20px;
    background-color: #fff;
    border: 1px solid transparent;
    border-radius: 3px;
}

.panel-body {
    padding: 20px;
}

.panel-flat {
    border: none;
    border-radius: 3px;
    box-shadow: none;
}

/* Card styling for login form */
.login-container .page-container .login-form {
    width: 400px;
    background: #FFFFFF;
    border: none !important;
    border-color: transparent !important;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 32px;
}

.login-container .panel.panel-body.login-form {
    border: none !important;
    border-color: transparent !important;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   5. FORM CONTROLS (.form-group, .form-control)
   ============================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 7px 12px;
    font-size: 14px;
    line-height: 1.5384616;
    color: #333;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}

.form-control:focus {
    border-color: #66afe9;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}

.form-control::placeholder { color: #999; opacity: 1; }


.form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
    background-color: #eee;
    opacity: 1;
}

/* Override: MUI-inspired inputs in login context */
.login-container .form-control {
    border: 1px solid #E0E0E0;
    border-radius: 4px;
    height: 56px;
    padding: 16.5px 14px;
    font-size: 16px;
    line-height: 1.4375;
    color: #333;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-container .form-control:focus {
    border: 2px solid #003322;
    box-shadow: none;
    outline: none;
}

.login-container .form-control::placeholder {
    color: #9E9E9E;
    font-size: 16px;
}

/* ============================================================
   6. BUTTONS (.btn, .btn-primary, .btn-block, .btn-danger, .btn-default)
   ============================================================ */

.btn {
    display: inline-block;
    margin-bottom: 0;
    font-weight: normal;
    text-align: center;
    vertical-align: middle;
    touch-action: manipulation;
    cursor: pointer;
    background-image: none;
    border: 1px solid transparent;
    white-space: nowrap;
    padding: 7px 12px;
    font-size: 14px;
    line-height: 1.5384616;
    border-radius: 3px;
    user-select: none;
    text-decoration: none;
}

.btn:hover,
.btn:focus,
.btn.focus {
    color: #333;
    text-decoration: none;
}

.btn:active,
.btn.active {
    outline: 0;
    background-image: none;
}

.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn {
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
}

/* btn-primary */
.btn-primary {
    color: #fff;
    background-color: #2196F3;
    border-color: #2196F3;
}

/* btn-danger */
.btn-danger {
    color: #fff;
    background-color: #F44336;
    border-color: #F44336;
}

.btn-danger:hover,
.btn-danger:focus {
    color: #fff;
    background-color: #d32f2f;
    border-color: #c62828;
}

/* btn-default */
.btn-default {
    color: #333;
    background-color: #fafafa;
    border-color: #ddd;
}

.btn-default:hover,
.btn-default:focus {
    color: #333;
    background-color: #f5f5f5;
    border-color: #bbb;
}

/* btn-block */
.btn-block {
    display: block;
    width: 100%;
}

.btn-block + .btn-block {
    margin-top: 5px;
}

/* Override: MUI-inspired primary button in login context */
.login-container .btn-primary {
    background-color: #003322 !important;
    border: none !important;
    color: #E6EC82 !important;
    font-weight: 500;
    font-size: 15px;
    min-width: 64px;
    height: 48px;
    padding: 8px 22px;
    border-radius: 50px;
    appearance: none;
    text-transform: none;
    letter-spacing: 0.4px;
    line-height: 1.75;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 24px 0 16px 0;
    box-shadow: 0px 3px 1px -2px rgba(0,0,0,0.2),
                0px 2px 2px 0px rgba(0,0,0,0.14),
                0px 1px 5px 0px rgba(0,0,0,0.12);
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-container .btn-primary:hover,
.login-container .btn-primary:focus {
    background-color: #002419 !important;
    border: none !important;
    color: #E6EC82 !important;
    box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.2),
                0px 4px 5px 0px rgba(0,0,0,0.14),
                0px 1px 10px 0px rgba(0,0,0,0.12);
}

.login-container .btn-primary:active {
    background-color: #00261a !important;
    border: none !important;
}

.login-container .btn-primary:disabled {
    background-color: #003322 !important;
    border: none !important;
    opacity: 0.6;
}

/* Remove the icon arrow from buttons */
.login-container .btn-primary .icon-circle-right2 {
    display: none;
}

/* ============================================================
   7. MODAL SYSTEM (Bootstrap 3 JS compatible)
   ============================================================ */

/* Body class toggled by Bootstrap JS */
.modal-open {
    overflow: hidden;
}

/* Modal wrapper */
.modal {
    display: none;
    overflow: hidden;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    -webkit-overflow-scrolling: touch;
    outline: 0;
}

/* Fade transition: start off-screen */
.modal.fade .modal-dialog {
    transform: translate(0, -25%);
    transition: transform 0.3s ease-out;
}

/* Fade transition: slide into view */
.modal.in .modal-dialog {
    transform: translate(0, 0);
}

/* Allow scrolling when modal is open */
.modal-open .modal {
    overflow-x: hidden;
    overflow-y: auto;
}

/* Modal dialog */
.modal-dialog {
    position: relative;
    width: auto;
    margin: 10px;
}

/* Modal content box */
.modal-content {
    position: relative;
    background-color: #fff;
    border: 1px solid transparent;
    border-radius: 5px;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
    background-clip: padding-box;
    outline: 0;
}

/* Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    background-color: #000;
}

.modal-backdrop.fade {
    opacity: 0;
}

.modal-backdrop.in {
    opacity: 0.5;
}

/* Modal header */
.modal-header {
    padding: 20px;
    border-bottom: 1px solid transparent;
}

.modal-header .close {
    margin-top: -2px;
}

/* Modal title */
.modal-title {
    margin: 0;
    line-height: 1.5384616;
}

/* Modal body */
.modal-body {
    position: relative;
    padding: 20px;
}

/* Modal footer */
.modal-footer {
    padding: 20px;
    text-align: right;
    border-top: 1px solid transparent;
}

.modal-footer .btn + .btn {
    margin-left: 5px;
    margin-bottom: 0;
}

.modal-footer .btn-block + .btn-block {
    margin-left: 0;
}

/* Scrollbar measure helper (used by Bootstrap JS) */
.modal-scrollbar-measure {
    position: absolute;
    top: -9999px;
    width: 50px;
    height: 50px;
    overflow: scroll;
}

/* Desktop: centered 600px dialog */
@media (min-width: 769px) {
    .modal-dialog {
        width: 600px;
        margin: 30px auto;
    }
    .modal-content {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    }
}

/* Close button (used in modals) */
.close {
    float: right;
    font-size: 21px;
    font-weight: bold;
    line-height: 1;
    color: #000;
    text-shadow: none;
    text-decoration: none;
    cursor: pointer;
    opacity: 0.5;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
    opacity: 0.75;
}

button.close {
    padding: 0;
    cursor: pointer;
    background: transparent;
    border: 0;
    -webkit-appearance: none;
}

/* Login-context modal overrides */
.login-container .modal-content {
    border-radius: 8px;
    border: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.login-container .modal-header.bg-primary {
    background-color: #003322 !important;
    color: #E6EC82;
    border-radius: 8px 8px 0 0;
}

.login-container .modal-header.bg-primary .modal-title {
    color: #E6EC82;
    font-weight: 700;
}

.login-container .modal-header.bg-primary .close {
    color: #E6EC82;
    opacity: 0.7;
}

.login-container .modal-footer .btn-primary {
    height: auto;
    margin: 0;
    padding: 8px 20px;
}

.login-container .modal-footer .btn-danger {
    border-radius: 8px;
}

/* ============================================================
   8. UTILITY CLASSES
   ============================================================ */

/* Text alignment */
.text-center {
    text-align: center;
}

/* Text colors */
.text-danger {
    color: #F44336;
}

.text-muted {
    color: #999;
}

/* Grid: .row */
.row {
    margin-left: -15px;
    margin-right: -15px;
}

.row::before,
.row::after {
    content: " ";
    display: table;
}

.row::after {
    clear: both;
}

/* Grid: .col-md-12 (used in legacy login MFA popup) */
.col-md-12 {
    position: relative;
    min-height: 1px;
    padding-left: 15px;
    padding-right: 15px;
    width: 100%;
}

/* .control-label (used in legacy login MFA popup) */
.control-label {
    font-weight: 500;
}

/* .display-block (used in legacy login heading) */
.display-block {
    display: block;
}

/* Icon positioning (from core.css) */
.position-left {
    margin-right: 7px;
}

.position-right {
    margin-left: 7px;
}

/* .bg-primary (used on modal headers) */
.bg-primary {
    background-color: #2196F3;
    color: #fff;
}

/* ============================================================
   9. LOGOS (.login-logo, .login-logo-tenant)
   ============================================================ */

.login-container .login-logo {
    height: 80px;
    width: 336px;
    object-fit: contain;
    margin-bottom: 16px;
}

.login-container .login-logo-tenant {
    width: 100%;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 0;
}

/* Remove Bootstrap .form-group margin from logo wrappers */
.login-container .form-group.has-login-logo {
    margin-bottom: 8px;
}

.login-container .form-group.has-login-logo-tenant {
    margin-bottom: 16px;
}

/* ============================================================
   10. LINKS
   ============================================================ */

.login-container a {
    color: #003322;
    font-size: 14px;
    text-decoration: underline;
    text-decoration-color: rgba(0, 51, 34, 0.4);
}

.login-container a:hover {
    color: #003322;
    text-decoration-color: rgba(0, 51, 34, 0.87);
}

/* ============================================================
   12. FOOTER
   ============================================================ */

.login-container .footer {
    color: #666;
    font-size: 12px;
    margin-top: auto;
    padding-top: 24px;
    padding-bottom: 24px;
}

.login-container .footer a {
    color: #666;
}

.login-container .footer a:hover {
    color: #092047;
}

/* ============================================================
   13. SSO PHASE
   ============================================================ */

.login-container #sso-phase {
    margin-bottom: 15px;
}

.login-container #sso-buttons-container .btn {
    text-align: center;
    border-radius: 50px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container #sso-password-fallback {
    text-align: center;
    margin-top: 12px;
}

.login-container #sso-password-fallback a {
    color: #666;
    font-size: 13px;
}

.login-container #sso-password-fallback a:hover {
    color: #092047;
}

.login-container #change-email-link {
    font-size: 12px;
    color: #666;
    cursor: pointer;
}

.login-container #change-email-link:hover {
    color: #092047;
}

/* ============================================================
   14. VALIDATION, HIDDEN ELEMENTS, SWEETALERT COMPAT
   ============================================================ */

/* Validation messages */
.login-container .text-danger {
    color: #e53935 !important;
    font-size: 12px;
    margin-top: 4px;
}

/* Collapse hidden inputs and empty validation divs */
.login-container .agree-term {
    display: none;
}

.login-container .login-form .text-danger[role="alert"] {
    margin: 0;
    padding: 0;
}

.login-container .login-form input[type="hidden"] {
    display: none;
}

/* SweetAlert button overrides (used in terms decline) */
.swal-button--confirm {
    background-color: #FF7043;
}

.swal-button--confirm:not([disabled]):hover {
    background-color: #FF7043;
}

.swal-content__p {
    color: black;
}

.sweet-alert h2 {
    color: #000000;
}

.sweet-alert p {
    color: #000000;
}

/* ============================================================
   15. HEADINGS (.content-group)
   ============================================================ */

.content-group {
    margin-bottom: 20px;
}

.login-container .content-group {
    font-size: 32px;
    font-weight: 400;
    color: #262626;
    margin: 0 0 40px 0;
    line-height: 1.235;
}

.login-container .content-group small {
    font-size: 14px;
    font-weight: 400;
    color: #9E9E9E;
    line-height: 1.5;
    margin-top: 11.2px;
}

/* ============================================================
   16. PACE LOADER (top bar)
   ============================================================ */

.login-container .pace .pace-progress {
    background: #003322;
}

/* ============================================================
   17. RESPONSIVE
   ============================================================ */

@media (max-width: 480px) {
    .login-container .page-container .login-form {
        width: calc(100% - 32px);
        padding: 24px 16px;
    }

    .login-container .login-logo {
        width: 260px;
        height: 60px;
    }

    .login-container .content-group {
        font-size: 26px;
    }

    .login-container .content-group small {
        margin-bottom: 24px;
    }
}
