/* ============================================================
   Member Auth — Alina template overrides (login + register)
   Requires: alina/assets/css/style.css
   ============================================================ */

body.auth-container-body {
    margin: 0;
    background-color: var(--bodybg-color, #eef2f5) !important;
    font-family: 'Lexend Deca', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Template auth bg images are not bundled — use member-panel matching fallbacks */
.auth-container {
    background-color: var(--bodybg-color, #eef2f5) !important;
    background-image:
        radial-gradient(ellipse 70% 50% at 50% -10%, rgba(var(--primary), 0.08), transparent),
        radial-gradient(ellipse 40% 30% at 100% 100%, rgba(var(--primary), 0.05), transparent) !important;
}

.auth-container .form-container {
    background: rgba(var(--white), 1) !important;
    background-image: none !important;
    border: 1px solid rgba(var(--secondary), 0.12) !important;
    border-radius: var(--app-border-radius, 1.25rem) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
}

.auth-container .bg-auth-icon {
    margin-left: auto;
    margin-right: auto;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
}

.auth-container .bg-auth-icon .ti,
.auth-container .bg-auth-icon i.ti,
.auth-container .bg-auth-icon [class^="ti-"],
.auth-container .bg-auth-icon [class*=" ti-"] {
    font-family: "tabler-icons" !important;
    font-style: normal !important;
    font-weight: 400 !important;
    font-variant: normal !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
    font-size: 1.75rem !important;
    color: rgba(var(--primary), 1) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1em;
    height: 1em;
}

.auth-container .bg-auth-icon .ti::before,
.auth-container .bg-auth-icon i.ti::before {
    font-family: "tabler-icons" !important;
    letter-spacing: 0 !important;
    line-height: 1 !important;
}

/* ── Login card: fixed width, logo contained ── */
.auth-container.member-auth-login {
    padding: 1.5rem 1rem;
}

.auth-container.member-auth-login .form-container,
.auth-container.member-auth-login .member-auth-card {
    width: 100% !important;
    max-width: 440px !important;
    margin: 0 auto !important;
    overflow: hidden !important;
}

.auth-container.member-auth-login .form-container .card-body {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.75rem 1.5rem 2rem !important;
    box-sizing: border-box !important;
}

.member-auth-top {
    margin-bottom: 1.25rem;
}

.member-auth-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: rgba(var(--dark), 1);
    margin: 0.75rem 0 0.35rem;
    line-height: 1.35;
    word-break: break-word;
}

.member-auth-subtitle {
    font-size: 0.9rem;
    color: rgba(var(--secondary), 1);
    margin: 0 0 0.25rem;
    font-weight: 500;
}

.member-auth-lock-icon {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.auth-container.member-auth-register .member-auth-top {
    text-align: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(var(--secondary), 0.15);
}

.auth-container.member-auth-register .member-auth-register-actions {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
}

/* Brand logo — never use Alina .auth-logo (expects small circular avatar) */
.member-auth-brand-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 0.5rem;
    padding: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-container img.member-auth-brand {
    display: block !important;
    width: auto !important;
    max-width: min(180px, 70vw) !important;
    height: auto !important;
    max-height: 60px !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    border: none !important;
    outline: none !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.member-auth-copy {
    text-align: center;
    margin: 1rem 0 0;
    font-size: 0.82rem;
    color: rgba(var(--secondary), 1);
    font-weight: 500;
}

.member-auth-alerts {
    margin-bottom: 1rem;
}

.member-auth-alerts .alert {
    margin-bottom: 0;
    border-radius: var(--app-border-radius, 1.25rem);
    font-size: 0.9rem;
}

/* ── Register: wider card ── */
.auth-container.member-auth-register .form-container {
    width: 100% !important;
    max-width: 820px !important;
    margin: 0 auto !important;
    overflow: hidden !important;
}

.auth-container.member-auth-register .form-container .card-body {
    width: min(820px, 100%);
    max-width: 820px;
    text-align: left;
}

.auth-container.member-auth-register {
    padding: 1.5rem 1rem 2rem;
    align-items: flex-start;
}

.member-auth-register-head {
    text-align: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(var(--secondary), 0.15);
}

.member-auth-register-head h2 {
    font-size: calc(20px + 4 * (100vw - 300px) / 1620);
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.member-auth-register-head p {
    color: rgba(var(--secondary), 1);
    margin: 0;
    font-size: 0.9rem;
}

.member-auth-register-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.member-auth-register-actions a {
    font-size: 0.88rem;
    color: rgba(var(--secondary), 1);
    text-decoration: none;
}

.member-auth-register-actions a span {
    color: rgba(var(--primary), 1);
    font-weight: 700;
}

/* Register form sections (multi-step) */
.auth-container .auth-section {
    background: rgba(var(--light), 0.35);
    border: 1px solid rgba(var(--secondary), 0.12);
    border-radius: var(--app-border-radius, 1.25rem);
    padding: 1.1rem 1.1rem 0.25rem;
    margin-bottom: 1rem;
}

.auth-container .auth-section-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1rem;
    font-weight: 700;
    color: rgba(var(--dark), 1);
    margin: 0 0 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid rgba(var(--secondary), 0.12);
}

.auth-container .auth-section-title i {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(var(--primary), 0.1);
    color: rgba(var(--primary), 1);
    font-size: 0.9rem;
}

.auth-container .auth-form-group {
    margin-bottom: 1rem;
}

.auth-container .auth-form-group label {
    color: var(--font-color, #082f32);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0.45rem;
}

.auth-container .auth-form-group label small {
    font-weight: 500;
    color: rgba(var(--secondary), 1);
}

.auth-container .auth-input-wrap {
    position: relative;
}

.auth-container .auth-input-wrap > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(var(--secondary), 0.85);
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 2;
}

.auth-container .auth-input-wrap .form-control,
.auth-container .auth-input-wrap select.form-control {
    padding-left: 2.5rem !important;
}

.auth-container .auth-hint {
    display: block;
    font-size: 0.82rem;
    margin-top: 0.35rem;
    color: rgba(var(--secondary), 1);
    font-weight: 500;
}

.auth-container .auth-referral-status {
    min-height: 1.25rem;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
}

.auth-container .auth-referral-status.is-valid {
    color: #10b981 !important;
    background: rgba(16, 185, 129, 0.08);
}

.auth-container .auth-referral-status.is-invalid {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.08);
}

.auth-container .auth-referral-status.is-checking {
    color: rgba(var(--primary), 1) !important;
    background: rgba(var(--primary), 0.06);
}

.auth-container .auth-referral-status i {
    margin-right: 0.25rem;
}

.auth-container .auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(var(--secondary), 1);
    cursor: pointer;
    z-index: 3;
    padding: 4px;
}

.auth-container .auth-password-toggle:hover {
    color: rgba(var(--primary), 1);
}

.auth-container .auth-strength {
    margin-top: 0.5rem;
    height: 4px;
    background: rgba(var(--secondary), 0.15);
    border-radius: 2px;
    overflow: hidden;
}

.auth-container .auth-strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.auth-container .auth-strength-text {
    font-size: 0.78rem;
    color: rgba(var(--secondary), 1);
    margin-top: 0.25rem;
    display: block;
}

.auth-container .auth-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(var(--secondary), 0.12);
    flex-wrap: wrap;
}

.auth-container .auth-nav .btn {
    min-width: 140px;
}

.auth-container .auth-terms {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    background: rgba(var(--primary), 0.06);
    border: 1px solid rgba(var(--primary), 0.15);
    border-radius: var(--app-border-radius, 1.25rem);
}

.auth-container .auth-terms label {
    font-size: 0.88rem;
    color: rgba(var(--secondary), 1);
    margin: 0;
    cursor: pointer;
}

.auth-container .auth-terms a {
    color: rgba(var(--primary), 1) !important;
    font-weight: 600;
}

.auth-container .auth-bottom-link {
    text-align: center;
    padding: 0.85rem 0 0;
    margin-top: 0.5rem;
}

.auth-container .auth-bottom-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 10px;
    background: rgba(var(--primary), 0.08);
    border: 1px solid rgba(var(--primary), 0.18);
    color: rgba(var(--primary), 1) !important;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none !important;
}

.auth-container .sec2,
.auth-container .sec3 {
    display: none;
}

.auth-container .showSection {
    display: block;
}

/* Select2 — match Alina app-form */
.auth-container .select2-container--default .select2-selection--single {
    background: rgba(var(--light), 0.1) !important;
    border: 1.5px solid rgba(var(--dark), 0.4) !important;
    border-radius: var(--app-border-radius, 1.25rem) !important;
    height: calc(1.5em + 1.6rem + 2px) !important;
    display: flex;
    align-items: center;
}

.auth-container .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: rgba(var(--dark), 0.75) !important;
    font-size: 14px !important;
    font-weight: 600;
    line-height: normal !important;
    padding-left: 2.5rem !important;
}

.auth-container .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
}

.auth-container .select2-dropdown {
    background: rgba(var(--white), 1) !important;
    border: 1px solid rgba(var(--secondary), 0.2) !important;
    border-radius: var(--app-border-radius, 1.25rem) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

.auth-container .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: rgba(var(--primary), 0.12) !important;
    color: rgba(var(--primary), 1) !important;
}

.auth-container .select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid rgba(var(--secondary), 0.25) !important;
    border-radius: 10px;
    font-size: 14px;
}

/* ── Themed popup modal (replaces native alert) ── */
.auth-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.auth-popup-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.auth-popup {
    width: 100%;
    max-width: 380px;
    background: rgba(var(--white), 1);
    border: 1px solid rgba(var(--secondary), 0.12);
    border-radius: var(--app-border-radius, 1.25rem);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
    padding: 2rem 1.75rem 1.75rem;
    text-align: center;
    transform: translateY(12px) scale(0.97);
    transition: transform 0.25s ease;
}

.auth-popup-overlay.is-visible .auth-popup {
    transform: translateY(0) scale(1);
}

.auth-popup-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: rgba(var(--primary), 0.12);
    color: rgba(var(--primary), 1);
}

.auth-popup-success .auth-popup-icon {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.auth-popup-error .auth-popup-icon {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.auth-popup-info .auth-popup-icon {
    background: rgba(var(--primary), 0.12);
    color: rgba(var(--primary), 1);
}

.auth-popup-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: rgba(var(--dark), 1);
    margin: 0 0 0.5rem;
}

.auth-popup-message {
    font-size: 0.92rem;
    color: rgba(var(--secondary), 1);
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.auth-popup-btn {
    min-width: 130px;
}

@media screen and (max-width: 576px) {
    .auth-container.member-auth-login .form-container,
    .auth-container.member-auth-register .form-container {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }

    .auth-container.member-auth-login .form-container .card-body,
    .auth-container.member-auth-register .form-container .card-body {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

@media (max-width: 768px) {
    .auth-container.member-auth-login .form-container .card-body {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 1.25rem 1rem 1.5rem !important;
    }

    .auth-container .form-container img.member-auth-brand,
    .auth-container .form-container .auth-logo.member-auth-brand {
        max-width: min(150px, 75vw) !important;
        max-height: 52px !important;
        width: auto !important;
        height: auto !important;
    }

    .auth-container.member-auth-register .form-container .card-body {
        width: 100%;
        padding-top: 1.25rem;
    }

    .auth-container .auth-nav {
        flex-direction: column-reverse;
    }

    .auth-container .auth-nav .btn {
        width: 100%;
    }

    .member-auth-register-actions {
        justify-content: center;
    }
}
