/**
 * Auth pages — MPKWIN Theme9 style (auto.mpkwin.co/login)
 */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

.mpk-auth,
.mpk-auth body {
    min-height: 100vh;
    margin: 0;
    font-family: 'Kanit', 'Segoe UI', sans-serif;
    color: #fff;
}

.mpk-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px 16px 40px;
    position: relative;
    background: linear-gradient(270deg, var(--MainBG, var(--ui-bg)) 0%, var(--MainBG, var(--ui-bg)) 70%);
    background-image: var(--auth-bg-image, var(--page-bg-image, none));
    background-size: cover;
    background-position: bottom right;
    background-repeat: no-repeat;
}

.mpk-auth-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.15) 40%, rgba(0, 0, 0, 0.45) 100%);
    pointer-events: none;
}

.mpk-auth-card-wrap {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
}

.mpk-auth-card {
    background: rgba(var(--ui-bg-rgb), 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 4px solid var(--ColorM2, var(--ui-accent));
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

/* ─── Panel ─── */
.mpk-auth-panel {
    padding: 24px 28px 28px;
    color: #fff;
}

.body-login,
.body-register {
    color: #fff;
}

.img-logo-modal {
    display: block;
    max-width: 220px;
    width: 100%;
    height: auto;
    margin: 0 auto 20px;
    object-fit: contain;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

.text-box-login {
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    font-weight: 700;
}

.auth-form-label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.textbox-t5,
.form-control-custom,
.form-select-custom {
    width: 100%;
    height: 45px;
    padding: 10px 16px;
    background: #eee !important;
    border: none !important;
    border-radius: 13px;
    color: #000 !important;
    font-family: 'Kanit', sans-serif;
    font-size: 15px;
    text-align: center;
    transition: box-shadow var(--duration-base) var(--ease-out);
}

.form-control-custom:focus,
.form-select-custom:focus,
.textbox-t5:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--ui-accent-rgb), 0.35);
    background: #fff !important;
}

.form-control-custom::placeholder {
    color: #888;
}

.form-group-auth {
    margin-bottom: 16px;
}

.form-group-auth--password {
    position: relative;
}

.ic-password-t5,
.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #333;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.form-group-auth.form-group-auth--password .ic-password-t5,
.form-group-auth.form-group-auth--password .password-toggle {
    top: calc(50% + 14px);
}

.auth-forgot-link {
    display: block;
    text-align: right;
    color: #ff6b6b !important;
    font-size: 14px;
    text-decoration: underline;
    cursor: pointer;
    margin: -4px 0 18px;
    background: none;
    border: none;
    padding: 0;
    width: 100%;
}

.auth-forgot-link:hover {
    color: #ff8787 !important;
}

.remember-me-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 16px;
}

.remember-me-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--ColorM2, var(--ui-accent));
}

.btn-submit,
.btn-login-custom,
.btn-next,
.btn-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    border: none;
    border-radius: 13px;
    padding: 12px 20px;
    font-family: 'Kanit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25);
    background: linear-gradient(180deg, var(--ColorM1, var(--ui-primary)) 0%, var(--ColorM2, var(--ui-accent)) 100%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
    cursor: pointer;
}

.btn-submit:hover,
.btn-login-custom:hover:not(:disabled),
.btn-next:hover,
.btn-confirm:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
    background: linear-gradient(180deg, var(--ColorM2, var(--ui-accent)) 0%, var(--ColorM1, var(--ui-primary)) 100%);
}

.btn-submit:disabled,
.btn-login-custom:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-back {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 13px;
    padding: 12px;
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn-contact-custom {
    background: linear-gradient(180deg, #7cb342 0%, #558b2f 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 13px;
    padding: 12px;
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
    width: 100%;
}

.btn-contact-custom:hover {
    color: #fff;
    filter: brightness(1.06);
}

.login-or {
    color: #aaa;
    margin: 18px 0;
    padding: 8px 0;
    position: relative;
    text-align: center;
    font-size: 13px;
}

.login-or::before,
.login-or::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: rgba(255, 255, 255, 0.25);
}

.login-or::before { left: 0; }
.login-or::after { right: 0; }

.auth-switch {
    text-align: center;
    margin: 0 0 16px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
}

.auth-switch a {
    color: var(--ColorM2, var(--ui-accent));
    font-weight: 600;
    text-decoration: underline;
    margin-left: 4px;
}

.auth-switch a:hover {
    color: var(--ui-accent-hover, #ffed4e);
}

/* ─── Language toggle ─── */
.box-lng-login {
    position: fixed;
    right: 16px;
    top: 14px;
    z-index: 9999;
}

.lang-switch {
    width: 72px;
    height: 36px;
    background: linear-gradient(180deg, var(--ColorM1, var(--ui-primary)) 0%, rgba(var(--ui-primary-rgb), 0.85) 100%);
    border-radius: 25px;
    cursor: pointer;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.25);
    transition: all 0.3s ease;
}

.lang-switch.active {
    background: linear-gradient(180deg, var(--ColorM2, var(--ui-accent)) 0%, rgba(var(--ui-accent-rgb), 0.9) 100%);
}

.lang-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.lang-switch.active .lang-slider {
    transform: translateX(36px);
}

.lang-text {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    transition: opacity 0.3s ease;
}

.lang-text.en { right: 8px; opacity: 1; }
.lang-text.th { left: 8px; opacity: 0; }
.lang-switch.active .lang-text.en { opacity: 0; }
.lang-switch.active .lang-text.th { opacity: 1; color: #333; }

.versiontxt {
    position: fixed;
    bottom: 2px;
    left: 6px;
    z-index: 9999;
    color: #d6d6d6;
    opacity: 0.25;
    font-size: 10px;
    pointer-events: none;
}

.logo-fallback {
    display: none;
    width: 200px;
    height: 100px;
    margin: 0 auto 20px;
    background: linear-gradient(145deg, var(--ColorM2, #ffd700) 0%, rgba(var(--ui-accent-rgb), 0.8) 100%);
    border-radius: 15px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--ColorM2, #ffd700);
}

.logo-image[style*="display: none"] + .logo-fallback,
.logo-image:not([src]) + .logo-fallback {
    display: flex;
}

@media (max-width: 480px) {
    .mpk-auth-page {
        padding: 64px 12px 32px;
        align-items: flex-start;
        padding-top: 72px;
    }

    .mpk-auth-panel {
        padding: 20px 18px 24px;
    }

    .img-logo-modal {
        max-width: 180px;
    }

    .box-lng-login {
        right: 10px;
        top: 10px;
    }
}
