/* ==========================================
   LOSTVERSE
   AUTHENTICATION STYLESHEET
   Login / Register / Account Security
========================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800&display=swap');

/* ==========================================
   01. DESIGN SYSTEM
========================================== */

:root {
    --auth-navy: #102340;
    --auth-navy-dark: #0b192e;

    --auth-blue: #245bd5;
    --auth-blue-dark: #1949b8;
    --auth-blue-light: #eff6ff;

    --auth-text: #14233d;
    --auth-muted: #64748b;

    --auth-white: #ffffff;
    --auth-surface: #f8fafc;
    --auth-border: #d6deea;

    --auth-success: #166534;
    --auth-danger: #b91c1c;
    --auth-warning: #92400e;

    --auth-radius: 9px;

    --auth-font:
        'Noto Sans Thai',
        Tahoma,
        sans-serif;

    --auth-transition: 180ms ease;
}

/* ==========================================
   02. GLOBAL RESET
========================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--auth-font);
    color: var(--auth-text);
    background: var(--auth-white);
    font-size: 14px;
    line-height: 1.65;
}

[hidden] {
    display: none !important;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

a {
    color: var(--auth-blue);
    text-decoration: none;
}

a:hover {
    color: var(--auth-blue-dark);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
    outline: 3px solid #93b4ed;
    outline-offset: 3px;
}

::selection {
    background: #dbeafe;
    color: var(--auth-navy);
}

/* ==========================================
   03. AUTHENTICATION LAYOUT
========================================== */

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;

    display: grid;

    grid-template-columns:
        minmax(0, 42fr)
        minmax(0, 58fr);
}

/* ==========================================
   04. BRAND PANEL
========================================== */

.auth-brand {
    position: sticky;
    top: 0;

    min-width: 0;

    height: 100vh;
    height: 100dvh;

    padding: 48px 60px;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    gap: 32px;

    color: #ffffff;

    background:
        radial-gradient(
            circle at 85% 75%,
            rgba(53, 94, 151, .65),
            transparent 55%
        ),
        linear-gradient(
            155deg,
            #0c1c33 0%,
            #102340 50%,
            #18365b 100%
        );

    overflow-y: auto;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    width: fit-content;

    color: #ffffff;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: .8px;

    text-decoration: none;
}

.brand:hover {
    color: #ffffff;
}

.brand img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.brand svg {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
}

.brand-content {
    position: relative;
    min-width: 0;
}

.eyebrow {
    display: inline-block;

    color: #a4c4f5;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2.5px;
}

.brand-content h1 {
    max-width: 560px;

    margin: 24px 0;

    color: #ffffff;

    font-size: clamp(34px, 4vw, 58px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -1.5px;

    overflow-wrap: anywhere;
}

.brand-content p {
    max-width: 390px;

    margin: 0;

    color: #c2d0e4;
    font-size: 15px;
    line-height: 1.9;
}

.auth-brand small {
    color: #a0b2ca;
    font-size: 12px;
}

/* ==========================================
   05. AUTH MAIN CONTENT
========================================== */

.auth-main {
    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 48px 40px;

    background: #ffffff;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    min-width: 0;
}

/* ==========================================
   06. BACK TO HOMEPAGE
========================================== */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 26px;

    color: var(--auth-muted);

    font-size: 13px;
    font-weight: 500;
    text-decoration: none;

    transition:
        color var(--auth-transition);
}

.back-link:hover {
    color: var(--auth-blue);
}

.back-link svg {
    width: 17px;
    height: 17px;
}

/* ==========================================
   07. AUTHENTICATION TABS
========================================== */

.auth-tabs {
    display: flex;

    margin-bottom: 28px;

    border-bottom:
        1px solid #e2e8f0;
}

.auth-tabs a {
    position: relative;

    flex: 1;

    padding: 13px 12px;

    text-align: center;
    text-decoration: none;

    color: var(--auth-muted);
    font-weight: 500;

    border-bottom: 2px solid transparent;

    transition:
        color var(--auth-transition),
        border-color var(--auth-transition),
        background var(--auth-transition);
}

.auth-tabs a:hover {
    color: var(--auth-blue);
    background: #f8fafc;
}

.auth-tabs a.active {
    color: var(--auth-blue);
    border-bottom-color: var(--auth-blue);
    font-weight: 700;
}

/* ==========================================
   08. PAGE HEADINGS
========================================== */

.auth-container h2 {
    margin: 0 0 8px;

    color: var(--auth-text);

    font-size: 28px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -.5px;

    overflow-wrap: anywhere;
}

.subtitle {
    margin: 0 0 26px;

    color: var(--auth-muted);

    font-size: 14px;
    line-height: 1.7;
}

/* ==========================================
   09. AUTHENTICATION FORMS
========================================== */

.auth-container form {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.auth-container label {
    display: block;

    margin-bottom: 7px;

    color: var(--auth-text);
    font-size: 13px;
    font-weight: 600;
}

.auth-container input:not([type="checkbox"]):not([type="radio"]) {
    display: block;

    width: 100%;
    min-width: 0;
    height: 46px;

    padding: 0 14px;
    margin-bottom: 16px;

    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);

    background: #ffffff;
    color: var(--auth-text);

    font-family: inherit;
    font-size: 14px;

    outline: none;

    transition:
        border-color var(--auth-transition),
        box-shadow var(--auth-transition),
        background var(--auth-transition);
}

.auth-container input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.auth-container input:not([type="checkbox"]):not([type="radio"]):hover {
    border-color: #a9b9d0;
}

.auth-container input:not([type="checkbox"]):not([type="radio"]):focus {
    border-color: var(--auth-blue);

    box-shadow:
        0 0 0 3px rgba(36, 91, 213, .10);
}

.auth-container input:disabled,
.auth-container input[readonly] {
    background: #f1f5f9;
    color: var(--auth-muted);
}

.auth-container input[aria-invalid="true"] {
    border-color: #dc2626;
}

.auth-container input[aria-invalid="true"]:focus {
    box-shadow:
        0 0 0 3px rgba(220, 38, 38, .10);
}

.auth-container input[type="checkbox"],
.auth-container input[type="radio"] {
    width: 17px;
    height: 17px;

    margin: 0;

    flex: 0 0 17px;

    accent-color: var(--auth-blue);

    cursor: pointer;
}

/* ==========================================
   10. FORM FIELD COMPONENTS
========================================== */

.auth-field {
    position: relative;

    display: grid;
    gap: 7px;

    margin-bottom: 16px;
}

.auth-field label {
    margin: 0;
}

.auth-container .auth-field input {
    margin-bottom: 0;
}

.field-hint {
    display: block;

    color: var(--auth-muted);

    font-size: 12px;
    line-height: 1.7;
}

.field-error {
    color: var(--auth-danger);

    font-size: 12px;
    line-height: 1.6;

    overflow-wrap: anywhere;
}

.required-mark {
    color: #b91c1c;
}

/* ==========================================
   11. PASSWORD INPUT
========================================== */

.password-field {
    position: relative;

    width: 100%;

    margin-bottom: 16px;
}

.auth-container .password-field input {
    margin-bottom: 0;

    padding-right: 48px;
}

.password-toggle {
    position: absolute;

    top: 50%;
    right: 8px;

    transform: translateY(-50%);

    width: 34px;
    height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    border-radius: 7px;

    background: transparent;
    color: var(--auth-muted);

    cursor: pointer;
}

.password-toggle:hover {
    color: var(--auth-blue);
    background: #eff6ff;
}

.password-toggle svg {
    width: 19px;
    height: 19px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.password-requirements {
    display: grid;
    gap: 5px;

    padding: 0;
    margin: -4px 0 16px;

    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.7;

    list-style: none;
}

.password-requirements li {
    display: flex;
    align-items: center;
    gap: 7px;
}

.password-requirements li.valid {
    color: var(--auth-success);
}

.password-strength {
    display: grid;
    gap: 7px;

    margin-bottom: 16px;
}

.password-strength-track {
    height: 5px;

    background: #e2e8f0;
    border-radius: 10px;

    overflow: hidden;
}

.password-strength-fill {
    width: 0;
    height: 100%;

    border-radius: 10px;

    transition:
        width var(--auth-transition),
        background var(--auth-transition);
}

.password-strength-fill.weak {
    width: 33%;
    background: #dc2626;
}

.password-strength-fill.medium {
    width: 66%;
    background: #d97706;
}

.password-strength-fill.strong {
    width: 100%;
    background: #15803d;
}

.password-strength-label {
    color: var(--auth-muted);
    font-size: 12px;
}

/* ==========================================
   12. LOGIN OPTIONS
========================================== */

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 10px;

    margin: 0 0 16px;
}

.auth-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    margin: 0;

    color: #475569;
    font-weight: 400;
    font-size: 13px;
}

.forgot-password {
    color: var(--auth-blue);
    font-size: 13px;
    font-weight: 600;
}

.forgot-password:hover {
    text-decoration: underline;
}

/* ==========================================
   13. PRIMARY ACTION BUTTON
========================================== */

.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    width: 100%;
    min-height: 47px;

    padding: 11px 18px;
    margin-top: 8px;

    border: 1px solid transparent;
    border-radius: var(--auth-radius);

    background: var(--auth-blue);
    color: #ffffff;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;

    cursor: pointer;

    transition:
        background var(--auth-transition),
        box-shadow var(--auth-transition);
}

.primary-btn:not(:disabled):hover {
    background: var(--auth-blue-dark);

    box-shadow:
        0 4px 12px rgba(36, 91, 213, .16);
}

.primary-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.primary-btn svg {
    width: 18px;
    height: 18px;
}

/* ==========================================
   14. SECONDARY ACTION BUTTON
========================================== */

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: 100%;
    min-height: 44px;

    padding: 10px 16px;

    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);

    background: #ffffff;
    color: var(--auth-text);

    font-size: 13px;
    font-weight: 600;

    transition:
        background var(--auth-transition),
        border-color var(--auth-transition);
}

.secondary-btn:not(:disabled):hover {
    background: #f8fafc;
    border-color: #a9b9d0;
}

.secondary-btn:disabled {
    opacity: .6;
}

/* ==========================================
   15. PRIVACY INFORMATION
========================================== */

.privacy-note {
    margin: 0 0 12px;

    color: var(--auth-muted);

    font-size: 12px;
    line-height: 1.8;
}

.privacy-note a {
    color: var(--auth-blue);
    font-weight: 500;
}

.privacy-note a:hover {
    text-decoration: underline;
}

.auth-privacy-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    padding: 13px 14px;
    margin: 4px 0 16px;

    border: 1px solid #e2e8f0;
    border-radius: var(--auth-radius);

    background: #f8fafc;
    color: #475569;

    font-size: 12px;
    line-height: 1.8;
}

.auth-privacy-box svg {
    width: 19px;
    height: 19px;

    flex-shrink: 0;

    color: var(--auth-blue);
}

.auth-privacy-box p {
    margin: 0;
}

/* ==========================================
   16. TERMS & PRIVACY AGREEMENT
========================================== */

.auth-container .terms-agreement {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    margin: 6px 0 16px;

    color: #475569;

    font-size: 12px;
    font-weight: 400;
    line-height: 1.8;

    cursor: pointer;
}

.auth-container .terms-agreement input {
    flex-shrink: 0;
    margin-top: 3px;
}

.terms-agreement a {
    color: var(--auth-blue);
    font-weight: 600;
}

.terms-agreement a:hover {
    text-decoration: underline;
}

.terms-version {
    display: block;

    margin: 5px 0 12px;

    color: var(--auth-muted);

    font-size: 11px;
    line-height: 1.6;
}

/* ==========================================
   17. SYSTEM MESSAGES
========================================== */

#message:empty {
    display: none;
}

#message {
    padding: 13px 14px;
    margin-top: 14px;

    border: 1px solid transparent;
    border-radius: var(--auth-radius);

    font-size: 13px;
    line-height: 1.8;

    overflow-wrap: anywhere;
}

#message.success {
    color: var(--auth-success);
    background: #f0fdf4;
    border-color: #bbf7d0;
}

#message.error {
    color: var(--auth-danger);
    background: #fef2f2;
    border-color: #fecaca;
}

#message.warning {
    color: var(--auth-warning);
    background: #fffbeb;
    border-color: #fde68a;
}

#message.info {
    color: #1e40af;
    background: #eff6ff;
    border-color: #bfdbfe;
}

/* ==========================================
   18. EMAIL VERIFICATION
========================================== */

.verification-panel {
    display: grid;
    gap: 14px;

    padding: 24px;

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    background: #f8fafc;

    text-align: center;
}

.verification-icon {
    width: 62px;
    height: 62px;

    display: grid;
    place-items: center;

    margin: 0 auto 4px;

    border: 1px solid #bfdbfe;
    border-radius: 50%;

    background: #eff6ff;
    color: var(--auth-blue);
}

.verification-icon svg {
    width: 29px;
    height: 29px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.verification-panel h3 {
    margin: 0;

    color: var(--auth-text);

    font-size: 19px;
    font-weight: 700;
}

.verification-panel p {
    margin: 0;

    color: var(--auth-muted);

    font-size: 13px;
    line-height: 1.8;

    overflow-wrap: anywhere;
}

.verification-email {
    color: var(--auth-text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.resend-verification {
    padding: 8px;

    border: 0;
    background: transparent;

    color: var(--auth-blue);

    font-size: 13px;
    font-weight: 600;
}

.resend-verification:hover {
    text-decoration: underline;
}

.resend-verification:disabled {
    color: var(--auth-muted);
    opacity: .7;
}

/* ==========================================
   19. AUTHENTICATION FOOTER
========================================== */

.auth-footer {
    margin-top: 24px;

    color: var(--auth-muted);

    font-size: 13px;
    text-align: center;
    line-height: 1.8;
}

.auth-footer a {
    color: var(--auth-blue);

    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-legal-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 8px 16px;

    padding-top: 20px;
    margin-top: 22px;

    border-top: 1px solid #e2e8f0;

    font-size: 11px;
}

.auth-legal-links a {
    color: var(--auth-muted);
}

.auth-legal-links a:hover {
    color: var(--auth-blue);
    text-decoration: underline;
}

/* ==========================================
   20. AUTHENTICATION DIVIDER
========================================== */

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;

    margin: 22px 0;

    color: var(--auth-muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';

    flex: 1;
    height: 1px;

    background: #e2e8f0;
}

/* ==========================================
   21. LEGAL DOCUMENT DIALOG
========================================== */

.auth-dialog {
    width: min(620px, calc(100% - 32px));

    max-height: 85vh;
    max-height: 85dvh;

    padding: 26px;

    border: 1px solid #e2e8f0;
    border-radius: 16px;

    background: #ffffff;
    color: var(--auth-text);

    overflow-y: auto;

    box-shadow:
        0 24px 70px rgba(15, 23, 42, .22);
}

.auth-dialog::backdrop {
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
}

.auth-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 18px;
}

.auth-dialog-header h2 {
    margin: 0;

    font-size: 21px;
    font-weight: 700;
}

.auth-dialog-close {
    display: grid;
    place-items: center;

    width: 34px;
    height: 34px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: #f1f5f9;
    color: #64748b;

    font-size: 23px;

    flex-shrink: 0;
}

.auth-dialog-close:hover {
    background: #e2e8f0;
}

.auth-dialog-content {
    color: #475569;

    font-size: 13px;
    line-height: 1.9;

    overflow-wrap: anywhere;
}

.auth-dialog-content h3 {
    margin: 20px 0 8px;

    color: var(--auth-text);

    font-size: 15px;
    font-weight: 700;
}

.auth-dialog-content p {
    margin: 0 0 12px;
}

.auth-dialog-content ul,
.auth-dialog-content ol {
    padding-left: 22px;
}

.auth-dialog-content li {
    margin-bottom: 8px;
}

.auth-dialog-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 10px;

    margin-top: 22px;
    padding-top: 18px;

    border-top: 1px solid #e2e8f0;
}

.auth-dialog-actions button {
    width: auto;
    margin: 0;
}

/* ==========================================
   22. LOADING INDICATOR
========================================== */

.auth-spinner {
    display: inline-block;

    width: 18px;
    height: 18px;

    flex-shrink: 0;

    border:
        2px solid rgba(255, 255, 255, .4);

    border-top-color: #ffffff;
    border-radius: 50%;

    animation:
        auth-spin .8s linear infinite;
}

@keyframes auth-spin {

    to {
        transform: rotate(360deg);
    }

}

/* ==========================================
   23. DESKTOP RESPONSIVE
========================================== */

@media (max-width: 1200px) {

    .auth-brand {
        padding: 40px;
    }

    .auth-main {
        padding: 40px 32px;
    }

    .brand-content h1 {
        font-size: clamp(32px, 4vw, 48px);
    }

}

/* ==========================================
   24. TABLET RESPONSIVE
========================================== */

@media (max-width: 800px) {

    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        position: static;

        height: auto;
        min-height: 80px;

        padding: 22px 28px;

        justify-content: center;
    }

    .brand {
        font-size: 24px;
    }

    .brand-content {
        display: none;
    }

    .auth-brand small {
        display: none;
    }

    .auth-main {
        align-items: flex-start;

        padding: 36px 24px 48px;
    }

    .auth-container {
        max-width: 440px;
    }

}

/* ==========================================
   25. MOBILE RESPONSIVE
========================================== */

@media (max-width: 480px) {

    .auth-brand {
        min-height: 68px;

        padding: 18px 20px;
    }

    .brand {
        font-size: 22px;
        letter-spacing: .5px;
    }

    .auth-main {
        padding: 26px 20px 36px;
    }

    .auth-container h2 {
        font-size: 24px;
    }

    .back-link {
        margin-bottom: 20px;
    }

    .auth-tabs {
        margin-bottom: 24px;
    }

    .auth-tabs a {
        padding: 12px 8px;
        font-size: 13px;
    }

    .subtitle {
        margin-bottom: 22px;
        font-size: 13px;
    }

    .auth-container input:not([type="checkbox"]):not([type="radio"]) {
        height: 48px;

        font-size: 16px;
    }

    .primary-btn {
        min-height: 48px;
    }

    .privacy-note,
    .terms-agreement {
        font-size: 12px;
    }

    .auth-footer {
        font-size: 12px;
    }

    .auth-dialog {
        width: calc(100% - 24px);

        max-height: 92dvh;

        padding: 18px;
    }

    .auth-dialog-header h2 {
        font-size: 18px;
    }

    .auth-dialog-actions {
        flex-wrap: wrap;
    }

    .auth-dialog-actions button {
        flex: 1;
    }

    .verification-panel {
        padding: 20px 16px;
    }

}

/* ==========================================
   26. ACCESSIBILITY
========================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }

}