:root {
    --color-navy: #0D1B2A;
    --color-navy-deep: #081625;
    --color-panel: #0A1A2B;
    --color-gold: #D4A843;
    --color-gold-light: #F0D080;
    --color-foreground: #E8EDF2;
    --color-success: #64B478;
    --color-error: #EF4444;
    --color-warning: #F59E0B;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
}

.auth-body {
    min-height: 100vh;
    background-color: var(--color-navy);
    color: var(--color-foreground);
    overflow-x: hidden;
}

.auth-container {
    display: grid;
    grid-template-columns: minmax(420px, 46vw) minmax(440px, 1fr);
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    background-color: var(--color-navy);
    overflow: hidden;
}

.auth-branding {
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 100vh;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    display: flex;
    align-items: center;
    background-image:
        linear-gradient(90deg, rgba(8, 18, 31, 0.7), rgba(8, 18, 31, 0.34)),
        linear-gradient(180deg, rgba(8, 18, 31, 0.06), rgba(8, 18, 31, 0.9)),
        url('/images/landing/login.png');
    background-size: cover;
    background-position: center;
    isolation: isolate;
}

.auth-branding::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(8, 18, 31, 0) 68%, var(--color-navy) 100%);
    pointer-events: none;
    z-index: 0;
}

.brand-mark {
    position: absolute;
    z-index: 1;
    top: clamp(1.25rem, 3.4vw, 2rem);
    left: clamp(1.25rem, 3.4vw, 2rem);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-gold-light);
    font-size: 0.95rem;
    font-weight: 700;
}

.brand-mark-icon {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
    color: var(--color-navy-deep);
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(212, 168, 67, 0.24);
}

.branding-content {
    width: min(100%, 520px);
    margin-top: clamp(8rem, 22vh, 14rem);
    position: relative;
    z-index: 1;
}

.branding-title {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 3.35rem;
    line-height: 1.1;
    font-weight: 800;
    color: var(--color-foreground);
}

.branding-title span:last-child {
    color: var(--color-gold);
}

.branding-subtitle {
    width: min(100%, 520px);
    margin-top: 1.75rem;
    color: rgba(232, 237, 242, 0.72);
    font-size: 1rem;
    line-height: 1.85;
}

.branding-stats {
    display: flex;
    align-items: flex-start;
    gap: clamp(1.25rem, 3vw, 2.5rem);
    margin-top: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-item strong {
    color: var(--color-gold);
    font-size: 1.3rem;
    line-height: 1;
}

.stat-item span {
    color: rgba(232, 237, 242, 0.58);
    font-size: 0.78rem;
}

.auth-form-container {
    min-width: 0;
    min-height: 100vh;
    height: 100vh;
    padding: clamp(1.75rem, 4vw, 4rem);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: var(--color-navy);
    overflow-y: auto;
}

.auth-panel {
    width: 100%;
    max-width: 620px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.auth-login-page .auth-panel {
    margin-top: clamp(2.5rem, 8vh, 4rem);
    gap: 2rem;
}

.auth-register-page .auth-panel {
    max-width: 620px;
    margin-top: 0;
    gap: 2rem;
}

.auth-register-page .auth-form-wrapper {
    padding: 3rem;
}

.auth-login-page .auth-form-wrapper {
    padding: 2rem 3rem;
}

.auth-login-page .form-header {
    margin-bottom: 1.5rem;
}

.auth-login-page .auth-form {
    gap: 1rem;
}

.auth-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 58px;
    min-height: 58px;
    padding: 4px;
    border: 1px solid rgba(212, 168, 67, 0.12);
    border-radius: 10px;
    background-color: rgba(8, 22, 37, 0.74);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.auth-switch-link {
    height: 100%;
    min-height: 0;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: rgba(232, 237, 242, 0.46);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 800;
    transition: color var(--transition-normal), background var(--transition-normal), box-shadow var(--transition-normal);
}

.auth-switch-link:hover {
    color: var(--color-gold-light);
}

.auth-switch-link.active {
    color: var(--color-navy-deep);
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
    box-shadow: 0 7px 18px rgba(212, 168, 67, 0.2);
}

.auth-form-wrapper {
    width: 100%;
    min-width: 0;
    padding: 3rem;
    border: 1px solid rgba(212, 168, 67, 0.13);
    border-radius: 12px;
    background: rgba(8, 22, 37, 0.55);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 22px 60px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(14px);
}

.form-header {
    margin-bottom: 2.25rem;
    text-align: left;
}

.form-title {
    color: var(--color-foreground);
    font-size: 2.125rem;
    line-height: 1.25;
    font-weight: 900;
}

.form-subtitle {
    margin-top: 0.5rem;
    color: rgba(232, 237, 242, 0.56);
    font-size: 1.1rem;
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.55rem;
}

.auth-register-page .auth-form {
    gap: 1.35rem;
}

.auth-register-page .form-label {
    color: rgba(232, 237, 242, 0.72);
    font-size: 1.2rem;
    font-weight: 800;
}

.required-mark {
    color: #FF4D4F;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-label {
    color: rgba(232, 237, 242, 0.72);
    font-size: 1.1rem;
    font-weight: 800;
}

.form-input,
.country-code-select {
    min-height: 58px;
    border: 1px solid rgba(212, 168, 67, 0.12);
    border-radius: 8px;
    background-color: rgba(7, 20, 33, 0.72);
    color: var(--color-foreground);
    font: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal);
}

.form-input {
    width: 100%;
    padding: 0.95rem 1.15rem;
}

.auth-register-page .form-input,
.auth-register-page .country-code-select,
.verification-code-btn {
    min-height: 58px;
    border-radius: 8px;
    font-size: 1rem;
}

.auth-register-page .form-input {
    padding: 0.95rem 1.15rem;
}

.id-number-input {
    text-transform: uppercase;
}

.form-input:focus,
.country-code-select:focus {
    outline: none;
    border-color: rgba(212, 168, 67, 0.5);
    background-color: rgba(8, 22, 37, 0.95);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.08);
}

.form-input::placeholder {
    color: rgba(232, 237, 242, 0.34);
}

.phone-input-group {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 0.75rem;
}

.country-code-select {
    width: 100%;
    padding: 0 0.75rem;
    appearance: none;
    cursor: pointer;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.auth-register-page .input-with-icon .form-input,
.auth-register-page .password-input-group .form-input {
    padding-left: 3.25rem;
}

.input-icon {
    position: absolute;
    left: 1.15rem;
    z-index: 1;
    color: rgba(212, 168, 67, 0.64);
    pointer-events: none;
}

.register-phone-group {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 0.75rem;
}

.country-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.country-select-wrapper .country-code-select {
    padding: 0 2.35rem 0 0.9rem;
    font-weight: 700;
}

.select-chevron {
    position: absolute;
    right: 0.95rem;
    color: rgba(232, 237, 242, 0.82);
    pointer-events: none;
}

.verification-input-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 152px;
    gap: 0.75rem;
}

.verification-code-btn {
    border: 1px solid rgba(212, 168, 67, 0.3);
    background-color: rgba(232, 237, 242, 0.08);
    color: var(--color-gold-light);
    font-family: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: border-color var(--transition-normal), background-color var(--transition-normal), color var(--transition-normal);
}

.verification-code-btn:hover {
    border-color: rgba(212, 168, 67, 0.55);
    background-color: rgba(212, 168, 67, 0.13);
}

.verification-code-btn:disabled {
    cursor: not-allowed;
    color: rgba(232, 237, 242, 0.45);
    background-color: rgba(232, 237, 242, 0.06);
}

.password-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input,
.confirm-password-input {
    padding-right: 3rem;
}

.password-input-group .password-input,
.password-input-group .confirm-password-input {
    padding-right: 3.2rem;
}

.toggle-password-btn {
    position: absolute;
    right: 0.5rem;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(212, 168, 67, 0.54);
    cursor: pointer;
    transition: color var(--transition-normal), background-color var(--transition-normal);
}

.toggle-password-btn:hover {
    color: var(--color-gold-light);
    background-color: rgba(212, 168, 67, 0.08);
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: rgba(232, 237, 242, 0.58);
    font-size: 0.95rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.52rem;
    color: rgba(232, 237, 242, 0.62);
    font-size: 0.95rem;
    cursor: pointer;
}

.checkbox-input {
    width: 17px;
    height: 17px;
    margin-top: 0.13rem;
    flex: 0 0 auto;
    accent-color: var(--color-gold);
    cursor: pointer;
}

.link-primary {
    color: var(--color-gold);
    text-decoration: none;
    font-weight: 900;
    transition: color var(--transition-normal);
}

.link-primary:hover {
    color: var(--color-gold-light);
}

.support-link {
    color: rgba(232, 237, 242, 0.5);
    font-size: 1rem;
    font-weight: 800;
    text-align: center;
}

.btn-large {
    width: 100%;
    min-height: 58px;
    margin-top: 0.35rem;
    padding: 0.95rem 1.2rem;
    border: 0;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 900;
    font-family: inherit;
}

.auth-form .btn-primary {
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
    color: var(--color-navy-deep);
    box-shadow: 0 14px 28px rgba(212, 168, 67, 0.18);
}

.auth-form .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(212, 168, 67, 0.24);
}

.auth-form .btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.66;
    transform: none;
}

.error-message {
    margin-top: 1rem;
    padding: 0.75rem 0.95rem;
    border: 1px solid rgba(239, 68, 68, 0.28);
    border-radius: 6px;
    background-color: rgba(239, 68, 68, 0.1);
    color: #FCA5A5;
    font-size: 0.95rem;
}

@media (min-width: 961px) {
    html.auth-login-root,
    html.auth-register-root {
        height: 100%;
        overflow: hidden;
    }

    .auth-body {
        height: 100vh;
        overflow: hidden;
    }

    .auth-container {
        height: 100vh;
        min-height: 100vh;
    }

    .auth-form-container {
        height: 100vh;
        min-height: 0;
        overflow-y: auto;
    }
}

@media (max-width: 960px) {
    .auth-body {
        height: auto;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .auth-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .auth-branding {
        position: relative;
        top: auto;
        height: auto;
        min-height: 360px;
        align-items: flex-end;
        padding-bottom: 2.5rem;
    }

    .auth-branding::after {
        background: linear-gradient(180deg, rgba(8, 18, 31, 0) 62%, var(--color-navy) 100%);
    }

    .branding-content {
        margin-top: 6rem;
    }

    .branding-title {
        font-size: 2.7rem;
    }

    .auth-form-container {
        height: auto;
        min-height: auto;
        padding: 2rem 1.25rem 3rem;
        overflow: visible;
    }

    .auth-login-page .auth-panel,
    .auth-register-page .auth-panel {
        margin-top: 0;
    }
}

@media (max-width: 560px) {
    .auth-branding {
        min-height: 300px;
        padding: 1.25rem;
    }

    .brand-mark {
        top: 1.25rem;
        left: 1.25rem;
        font-size: 0.86rem;
    }

    .brand-mark-icon {
        width: 30px;
        height: 30px;
    }

    .branding-title {
        font-size: 2rem;
    }

    .branding-subtitle {
        margin-top: 1rem;
        font-size: 0.86rem;
        line-height: 1.7;
    }

    .branding-stats {
        gap: 1rem;
        margin-top: 1.3rem;
    }

    .auth-form-container {
        padding: 1.25rem 1rem 2rem;
    }

    .auth-panel {
        gap: 1rem;
    }

    .auth-switch {
        height: 58px;
        min-height: 58px;
    }

    .auth-switch-link {
        font-size: 0.9rem;
    }

    .auth-form-wrapper {
        padding: 1.25rem;
    }

    .auth-register-page .auth-form-wrapper {
        padding: 1.25rem;
    }

    .form-header {
        margin-bottom: 1.25rem;
    }

    .phone-input-group {
        grid-template-columns: 1fr;
    }

    .verification-input-group {
        grid-template-columns: 1fr;
    }
}
