/* Auth modals (login / register) — Apple-inspired sheet style.
   Scoped entirely under .modal-auth so it never touches the shared
   .form-user/.input-user classes used elsewhere (member info, etc). */

.modal-backdrop.show {
    opacity: 1;
    background: rgba(0, 0, 0, .42);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
}

.modal-auth {
    --auth-blue: #0071e3;
    --auth-blue-hover: #0077ed;
    --auth-blue-active: #0060c0;
    --auth-btn: #EE8A36;
    --auth-btn-hover: #E67E28;
    --auth-btn-active: #D9721C;
    --auth-ink: #1d1d1f;
    --auth-gray: #86868b;
    --auth-field-bg: #f5f5f7;
    --auth-border: rgba(0, 0, 0, .06);
    --auth-danger: #ff3b30;
    --auth-success: #1a7f37;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.modal-auth a {
    text-decoration: none;
}

.modal-auth .modal-dialog {
    max-width: 420px;
    margin: 1.75rem auto;
    min-height: calc(100% - 3.5rem);
    display: flex;
    align-items: center;
}

.modal-auth.fade .modal-dialog {
    transform: scale(.92) translateY(12px);
    transition: transform .38s cubic-bezier(.16, 1, .3, 1), opacity .38s cubic-bezier(.16, 1, .3, 1);
}

.modal-auth.show .modal-dialog {
    transform: scale(1) translateY(0);
}

.modal-auth .modal-content {
    border: none;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .35), 0 2px 10px rgba(0, 0, 0, .06);
    overflow: hidden;
    /* Chromium/WebKit can fail to clip rounded corners on an element that sits
       inside a transformed ancestor + overflow:hidden; forcing its own
       compositing layer keeps the corner clip correct. */
    -webkit-mask-image: -webkit-radial-gradient(circle, #fff, #000);
    will-change: transform;
}

.modal-auth .modal-header {
    position: relative;
    border-bottom: none;
    justify-content: center;
    padding: 34px 40px 0;
}

.modal-auth .modal-header .modal-title {
    width: 100%;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--auth-ink);
}

.modal-auth .btn-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    background: #f0f0f2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23515154' d='M4 4l8 8m0-8l-8 8' stroke='%23515154' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center/13px no-repeat;
    border-radius: 50%;
    opacity: 1;
    transition: background-color .15s ease, transform .15s ease;
}

.modal-auth .btn-close:hover {
    background-color: #e4e4e6;
    transform: rotate(90deg);
}

.modal-auth .auth-subtitle {
    margin: 6px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--auth-gray);
}

.modal-auth .modal-body {
    padding: 22px 40px 36px;
}

/* Step indicator (registration) */
.modal-auth .auth-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    margin: 22px 0 28px;
}

.modal-auth .auth-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 88px;
    text-align: center;
}

.modal-auth .auth-step-dot {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: var(--auth-field-bg);
    transition: background-color .3s ease;
}

.modal-auth .auth-step-label {
    font-size: 11px;
    font-weight: 500;
    color: #c7c7cc;
    letter-spacing: .01em;
    transition: color .3s ease;
}

.modal-auth .auth-step.is-done .auth-step-dot,
.modal-auth .auth-step.is-active .auth-step-dot {
    background: var(--auth-blue);
}

.modal-auth .auth-step.is-done .auth-step-label,
.modal-auth .auth-step.is-active .auth-step-label {
    color: var(--auth-ink);
}

/* Message banner */
.modal-auth .thongbao-form {
    margin-bottom: 18px;
    padding: 11px 14px;
    border-radius: 12px;
    background: var(--auth-field-bg);
    font-size: 13.5px;
    line-height: 1.4;
    text-align: center;
}

.modal-auth .thongbao-form.text-danger {
    background: #fff1f0;
    color: var(--auth-danger) !important;
}

.modal-auth .thongbao-form.text-success {
    background: #eefaf0;
    color: var(--auth-success) !important;
}

/* Contextual banner shown when a protected page redirected the user here */
.modal-auth .auth-gate-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0, 113, 227, .08);
    color: var(--auth-blue-active);
    font-size: 13.5px;
    line-height: 1.4;
    text-align: left;
}

.modal-auth .auth-gate-notice i {
    margin-top: 1px;
    font-size: 14px;
    flex: none;
}

/* Form fields */
.modal-auth .form-user label {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-ink);
}

.modal-auth .form-user p {
    font-size: 13.5px;
    color: var(--auth-gray);
    margin-bottom: 14px;
}

.modal-auth .form-user > p strong {
    color: var(--auth-ink);
}

.modal-auth .input-user {
    position: relative;
    margin-bottom: 16px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid #d2d2d7 !important;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.modal-auth .input-user:focus-within {
    border-color: var(--auth-blue) !important;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, .12);
}

.modal-auth .input-user .input-group-prepend {
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    pointer-events: none;
    z-index: 5;
}

.modal-auth .input-user .input-group-text {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--auth-gray);
    font-size: 14px;
}

.modal-auth .input-user:focus-within .input-group-text {
    color: var(--auth-blue);
}

.modal-auth .input-user .form-control {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 40px;
    border: none !important;
    background: transparent;
    border-radius: 12px;
    font-size: 15px;
    color: var(--auth-ink);
    box-shadow: none !important;
}

.modal-auth .input-user .form-control::placeholder {
    color: #a1a1a6;
}

.modal-auth .input-user .form-control:focus {
    outline: none;
    box-shadow: none !important;
}

.modal-auth .input-user .form-control:-webkit-autofill,
.modal-auth .input-user .form-control:-webkit-autofill:hover,
.modal-auth .input-user .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-ink);
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    box-shadow: 0 0 0 1000px #fff inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* login.css has a legacy focus rule (.input-user input[type=...]:focus) that
   forces an opaque white background + 30px inset shadow on focus, which — combined
   with Bootstrap's z-index:3 on a focused .input-group > .form-control — paints
   over our icons. That legacy rule beats class selectors on specificity, so
   neutralize it here by id (ids always win over classes/attributes/elements). */
#login-username:focus,
#login-password:focus,
#register-fullname:focus,
#register-phone:focus,
#register-otp:focus,
#register-password:focus,
#register-re-password:focus {
    background: transparent !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
}

.modal-auth .input-user.form-password-toggle .form-control {
    padding-right: 42px;
}

.modal-auth .show-pass {
    position: absolute;
    right: 14px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-gray);
    font-size: 14px;
    z-index: 5;
}

.modal-auth .show-pass i,
.modal-auth .input-group-text i {
    display: block;
    line-height: 1;
    margin: 0 !important;
}

.modal-auth .show-pass:hover {
    color: var(--auth-ink);
}

.modal-auth .invalid-feedback {
    display: none;
    margin: -8px 0 14px 4px;
    font-size: 12px;
    color: var(--auth-danger);
}

/* .invalid-feedback now sits as a sibling right after .input-user (outside its
   bordered box) instead of nested inside it — otherwise the red border of
   .input-user visually wraps around the error text too, making it look like
   the message renders inside the input instead of below it. Bootstrap's own
   ":invalid ~ .invalid-feedback" rule no longer matches once they're not
   direct siblings of the same parent, so re-trigger visibility here. */
.modal-auth .was-validated .input-user:has(:invalid) + .invalid-feedback {
    display: block;
}

/* Buttons */
.modal-auth .button-user {
    margin-top: 4px;
}

.modal-auth .btn-login {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: var(--auth-btn);
    color: #fff;
    font-size: 15.5px;
    font-weight: 590;
    letter-spacing: -.01em;
    transition: background-color .15s ease, transform .1s ease;
}

.modal-auth .btn-login:hover {
    background: var(--auth-btn-hover);
}

.modal-auth .btn-login:active {
    background: var(--auth-btn-active);
    transform: scale(.985);
}

.modal-auth .btn-link {
    display: block;
    width: 100%;
    margin-top: 10px;
    background: none;
    border: none;
    color: var(--auth-blue);
    font-size: 13.5px;
    font-weight: 500;
    text-align: center;
}

.modal-auth .btn-link:hover {
    text-decoration: underline;
}

/* Remember-me + forgot-password row */
.modal-auth .auth-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -4px 0 20px;
    font-size: 13.5px;
}

.modal-auth .auth-form-row a {
    color: var(--auth-blue);
    font-weight: 500;
}

.modal-auth .auth-form-row a:hover {
    text-decoration: underline;
}

.modal-auth .checkbox-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.modal-auth .checkbox-user .custom-control-input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--auth-blue);
}

.modal-auth .checkbox-user .custom-control-label {
    font-size: 13px;
    color: var(--auth-gray);
    margin: 0;
}

/* Footer notes / links */
.modal-auth .note-user {
    margin-top: 18px;
    text-align: center;
    font-size: 13.5px;
    color: var(--auth-gray);
}

.modal-auth .note-user + .note-user {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--auth-border);
}

.modal-auth .note-user a {
    color: var(--auth-blue);
    font-weight: 500;
    margin-left: 4px;
}

.modal-auth .note-user a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .modal-auth .modal-dialog {
        margin: 16px auto;
        max-width: calc(100% - 32px);
        min-height: calc(100% - 32px);
        display: flex;
        align-items: center;
    }

    .modal-auth .modal-content {
        border-radius: 20px;
        width: 100%;
        max-height: calc(100vh - 32px);
        display: flex;
        flex-direction: column;
    }

    .modal-auth .modal-header {
        padding: 20px 20px 0;
        flex: 0 0 auto;
    }

    .modal-auth .modal-header .modal-title {
        font-size: 19px;
    }

    .modal-auth .btn-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    .modal-auth .modal-body {
        padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1 1 auto;
    }

    .modal-auth .auth-subtitle {
        font-size: 13px;
    }

    .modal-auth .auth-steps {
        margin: 16px 0 20px;
    }

    .modal-auth .auth-step {
        width: 72px;
    }

    .modal-auth .input-user {
        margin-bottom: 12px;
    }

    .modal-auth .input-user .form-control {
        font-size: 16px;
    }
}
