/* =========================================================
   VAYNEX LOGIN — Premium light / dark themes
   ========================================================= */

:root {
    --vx-font: "Inter", "Noto Sans Thai", "Tahoma", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    min-height: 100%;
    margin: 0;
}

body {
    font-family: var(--vx-font);
    -webkit-font-smoothing: antialiased;
}

.login-page {
    --page-bg: #f3f5f8;
    --panel-bg: #ffffff;
    --form-bg: #ffffff;
    --text: #172033;
    --muted: #758196;
    --line: #e5e9ef;
    --input-bg: #fbfcfe;
    --input-text: #172033;
    --accent: #087e9b;
    --accent-2: #12a7b6;
    --accent-soft: #e7f5f7;
    --shadow: 0 28px 90px rgba(15, 31, 54, .13);
    --subtle: #a2adbc;

    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    overflow: hidden;
    padding: 38px;
    color: var(--text);
    background:
        radial-gradient(ellipse at 8% 12%, rgba(11, 142, 166, .10), transparent 32%),
        radial-gradient(ellipse at 95% 90%, rgba(211, 174, 101, .12), transparent 32%),
        var(--page-bg);
    transition: background .3s ease, color .3s ease;
}

.login-page[data-theme="dark"] {
    --page-bg: #080f19;
    --panel-bg: #111c2a;
    --form-bg: #111c2a;
    --text: #f1f5f9;
    --muted: #9aaabd;
    --line: rgba(176, 195, 215, .16);
    --input-bg: #0c1521;
    --input-text: #f1f5f9;
    --accent: #39c1cf;
    --accent-2: #d9bd7c;
    --accent-soft: rgba(57, 193, 207, .12);
    --shadow: 0 30px 100px rgba(0, 0, 0, .42);
    --subtle: #78889b;
}

.login-orb {
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(1px);
}
.login-orb-one {
    width: 460px;
    height: 460px;
    top: -250px;
    left: -150px;
    background: rgba(17, 153, 174, .08);
}
.login-orb-two {
    width: 520px;
    height: 520px;
    right: -240px;
    bottom: -310px;
    background: rgba(207, 174, 111, .10);
}
.login-grid {
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: .15;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(100, 125, 150, .10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100, 125, 150, .10) 1px, transparent 1px);
    background-size: 58px 58px;
    mask-image: linear-gradient(120deg, black, transparent 65%);
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.03fr) minmax(430px, .97fr);
    width: min(1180px, 100%);
    min-height: 720px;
    position: relative;
    z-index: 1;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.52);
    border-radius: 28px;
    background: var(--panel-bg);
    box-shadow: var(--shadow);
    transition: background .3s ease, box-shadow .3s ease;
}

/* Brand panel */
.login-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    padding: 34px 42px 30px;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 76% 25%, rgba(33, 177, 194, .22), transparent 32%),
        radial-gradient(circle at 14% 90%, rgba(210, 180, 120, .15), transparent 32%),
        linear-gradient(145deg, #001c3f 10%, #000000 53%, #123e53 100%);
}
.login-brand-panel::before,
.login-brand-panel::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(224, 207, 164, .18);
    border-radius: 50%;
    pointer-events: none;
}
.login-brand-panel::before {
    width: 570px;
    height: 570px;
    right: -280px;
    top: 80px;
    box-shadow: 0 0 0 38px rgba(255,255,255,.025), 0 0 0 78px rgba(255,255,255,.018);
}
.login-brand-panel::after {
    width: 310px;
    height: 310px;
    left: -220px;
    bottom: -170px;
    box-shadow: 0 0 0 28px rgba(255,255,255,.025);
}
.brand-topline,
.brand-bottom {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand-topline {
    justify-content: flex-start;
    color: rgba(232, 241, 247, .72);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
}
.brand-live-dot,
.brand-status {
    display: inline-block;
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #50d6ae;
    box-shadow: 0 0 13px rgba(80, 214, 174, .75);
}
.brand-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 1;
    padding: 18px 0;
}
.brand-art-wrap {
    width: min(390px, 100%);
    margin: -4px auto 10px;
    overflow: hidden;
    border-radius: 22px;
    filter: drop-shadow(0 18px 28px rgba(0,0,0,.18));
}
.brand-art {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}
.brand-art-light { display: none; }
.login-page[data-theme="light"] .brand-art-dark { display: block; }
.login-page[data-theme="dark"] .brand-art-dark { display: block; }
.brand-copy { width: 100%; text-align: left; padding: 0 5px; }
.brand-kicker {
    margin-bottom: 13px;
    color: #d8c18a;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.3px;
}
.brand-copy h1 {
    margin: 0 0 14px;
    color: #fff;
    font-size: clamp(29px, 3.1vw, 42px);
    font-weight: 800;
    line-height: 1.42;
    letter-spacing: -.7px;
}
.brand-copy h1 span { color: #64d2dc; }
.brand-copy p {
    margin: 0;
    color: rgba(231, 240, 247, .72);
    font-size: 13px;
    line-height: 2;
}
.brand-bottom {
    color: rgba(224, 235, 242, .52);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.15px;
}
.brand-status { width: 6px; height: 6px; margin-right: 7px; }

/* Form panel */
.login-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    padding: 30px 54px 27px;
    background: var(--form-bg);
    transition: background .3s ease;
}
.form-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 38px;
}
.mobile-brand { display: none; }
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    font: 600 11px var(--vx-font);
    cursor: pointer;
    transition: .2s ease;
}
.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.theme-toggle svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.theme-icon-moon { display: none; }
.login-page[data-theme="dark"] .theme-icon-sun { display: none; }
.login-page[data-theme="dark"] .theme-icon-moon { display: block; }

.login-form-inner {
    width: 100%;
    max-width: 390px;
    margin: 22px auto;
}
.form-heading { margin-bottom: 34px; }
.form-overline {
    margin-bottom: 12px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2.1px;
}
.form-heading h2 {
    margin: 0 0 9px;
    color: var(--text);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -.6px;
}
.form-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

/* Fields */
.login-field { margin-bottom: 22px; }
.login-field label,
.field-label-row label {
    display: block;
    margin-bottom: 9px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}
.login-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 54px;
    padding: 0 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--input-bg);
    transition: border-color .2s ease, box-shadow .2s ease, background .3s ease;
}
.login-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent);
}
.login-input-wrap > svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: var(--subtle);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.login-input-wrap input {
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: 0;
    color: var(--input-text);
    background: transparent;
    font: 500 13px var(--vx-font);
    box-shadow: none;
}
.login-input-wrap input::placeholder { color: var(--subtle); opacity: .85; }
.login-input-wrap.is-invalid { border-color: #df5965; }
.password-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--subtle);
    background: transparent;
    cursor: pointer;
}
.password-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.password-toggle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.field-error { margin-top: 7px; color: #e05b68; font-size: 11px; }
.login-options { display: flex; align-items: center; margin: 3px 0 25px; }
.remember-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 11px;
    cursor: pointer;
}
.remember-check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.custom-check {
    position: relative;
    width: 17px;
    height: 17px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--input-bg);
}
.remember-check input:checked + .custom-check {
    border-color: var(--accent);
    background: var(--accent);
}
.remember-check input:checked + .custom-check::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.remember-check input:focus-visible + .custom-check {
    outline: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
    outline-offset: 2px;
}

/* Submit and footer */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 54px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(105deg, #087e9b 0%, #11a8b6 100%);
    box-shadow: 0 9px 22px rgba(8, 126, 155, .22);
    font: 800 13px var(--vx-font);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.login-page[data-theme="dark"] .btn-login {
    color: #07151d;
    background: linear-gradient(105deg, #5bd1d7 0%, #d8bd7d 100%);
    box-shadow: 0 9px 25px rgba(55, 186, 198, .16);
}
.btn-login:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
    box-shadow: 0 13px 28px rgba(8, 126, 155, .28);
}
.btn-login svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 27px;
    color: var(--subtle);
    font-size: 10px;
    line-height: 1.7;
    text-align: center;
}
.security-note svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    fill: none;
    stroke: var(--subtle);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.login-bottom {
    color: var(--subtle);
    font-size: 10px;
    line-height: 1.7;
    text-align: center;
}
.login-alert {
    margin: -13px 0 20px;
    padding: 11px 13px;
    border-radius: 9px;
    font-size: 11px;
    line-height: 1.6;
}
.login-alert-success { color: #087b57; background: #e8f8f1; border: 1px solid #c5efdc; }
.login-alert-error { color: #b93845; background: #fff0f1; border: 1px solid #ffd5d9; }
.login-page[data-theme="dark"] .login-alert-success { color: #8de0bc; background: rgba(35, 145, 104, .13); border-color: rgba(91, 207, 157, .2); }
.login-page[data-theme="dark"] .login-alert-error { color: #ff9ca5; background: rgba(185, 56, 69, .13); border-color: rgba(255, 120, 133, .2); }

/* Responsive */
@media (max-width: 980px) {
    .login-page { padding: 22px; }
    .login-shell {
        max-width: 560px;
        min-height: auto;
        display: block;
        border-radius: 24px;
    }
    .login-brand-panel { display: none; }
    .login-form-panel { min-height: 680px; padding: 25px 48px 24px; }
    .mobile-brand {
        display: block;
        width: 64px;
        height: 64px;
        overflow: hidden;
        border-radius: 15px;
    }
    .mobile-brand img { display: block; width: 100%; height: 100%; object-fit: cover; }
    .mobile-logo-dark { display: none !important; }
    .mobile-logo-light { display: block !important; }
    .login-page[data-theme="dark"] .mobile-logo-light { display: none !important; }
    .login-page[data-theme="dark"] .mobile-logo-dark { display: block !important; }
    .form-topbar { justify-content: space-between; }
    .login-form-inner { margin: 36px auto 30px; }
}
@media (max-width: 520px) {
    .login-page { display: block; padding: 0; background: var(--form-bg); }
    .login-shell {
        min-height: 100vh;
        min-height: 100dvh;
        width: 100%;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .login-form-panel {
        min-height: 100vh;
        min-height: 100dvh;
        padding: 22px 24px 20px;
    }
    .login-form-inner { margin: 42px auto 28px; }
    .form-heading { margin-bottom: 29px; }
    .form-heading h2 { font-size: 29px; }
    .login-bottom { padding-top: 5px; }
}
@media (max-width: 360px) {
    .login-form-panel { padding-right: 19px; padding-left: 19px; }
    .theme-toggle { padding: 0 9px; font-size: 10px; }
    .security-note { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
