/* ==========================================================================
   Treno Portal v4 — guest auth screens (auth/login + auth/register).
   Loaded after auth.css / lang.css / Bootstrap (vite) and treno-v4.css, by
   those two standalone pages only. Everything is scoped to body.tva so the
   shared auth.css / lang.css rules used by layouts/app stay untouched.
   ========================================================================== */

body.tva {
    margin: 0;
    color: var(--tv-ink);
    font-family: var(--tv-font) !important;
    overflow-x: hidden;
}

body.tva *,
body.tva *::before,
body.tva *::after { box-sizing: border-box; }

/* Layout ------------------------------------------------------------------ */
.tva-wrap {
    width: 100%;
    max-width: 1200px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px 28px 40px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.tva-topwrap {
    position: relative;
    z-index: 60;
}

.tva-top {
    height: 62px;
    padding: 0 10px 0 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    backdrop-filter: blur(22px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 18px 40px -28px rgba(4, 60, 56, 0.45);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.tva-logo { display: flex; align-items: center; }
.tva-logo img { display: block; height: 24px; width: auto; pointer-events: none; }

.tva-main {
    flex: 1 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 470px);
    gap: 28px;
    align-items: start;
    align-content: center;
}

.tva-main--wide { grid-template-columns: minmax(0, 1fr) minmax(0, 540px); }

/* Hero (desktop only) */
.tva-hero {
    position: sticky;
    top: 22px;
    min-height: 600px;
    padding: 44px 42px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tva-hero-title {
    margin: 0;
    max-width: 560px;
    font-size: clamp(34px, 3.8vw, 52px);
    line-height: 1.06;
    font-weight: 600;
    letter-spacing: -0.035em;
    color: var(--tv-ink);
    overflow-wrap: anywhere;
}

.tva-hero-title .tva-accent {
    display: block;
    background: linear-gradient(100deg, #046B60 0%, #00B5A6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.tva-hero-mark {
    position: absolute;
    right: -46px;
    bottom: -40px;
    width: 400px;
    max-width: 70%;
    height: auto;
    opacity: 0.28;
    pointer-events: none;
    filter: drop-shadow(0 30px 40px rgba(0, 196, 180, 0.35));
}

/* Form card */
.tva-card {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tva-card-head { display: flex; flex-direction: column; gap: 8px; }

.tva-title {
    margin: 0;
    font-size: clamp(26px, 2.6vw, 32px);
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--tv-ink);
    overflow-wrap: anywhere;
}

.tva-form { display: flex; flex-direction: column; gap: 16px; margin: 0; }

.tva-group { display: flex; flex-direction: column; min-width: 0; }

.tva-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 0 2px 8px;
}

.tva-label {
    display: block;
    margin: 0 2px 8px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--tv-muted);
}

.tva-label-row .tva-label { margin: 0; }

.tva-grid2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

/* Field = tv-input look on a wrapper (icon + bare input inside) */
.tva-field {
    position: relative;
    width: 100%;
    height: 50px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: var(--tv-r-sm);
    border: 1px solid var(--tv-glass-border-strong);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 1px 3px rgba(4, 60, 56, 0.08);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.tva-field:focus-within { border-color: var(--tv-cyan-2); box-shadow: var(--tv-ring); }
.tva-field:has(.is-invalid) { border-color: rgba(180, 68, 46, 0.55); }
.tva-field:has(.is-invalid):focus-within { box-shadow: 0 0 0 4px rgba(180, 68, 46, 0.12); }

.tva-field > svg,
.tva-field .tva-ico {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    color: var(--tv-teal);
}

.tva-field .tva-ico svg { width: 20px; height: 20px; display: block; }

body.tva .tva-field input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 0;
    outline: none;
    box-shadow: none !important;
    background-color: transparent !important;
    font-family: var(--tv-font) !important;
    font-size: 14px;
    font-weight: 500;
    line-height: normal;
    color: var(--tv-ink) !important;
}

body.tva .tva-field input.is-invalid { padding-right: 26px; }

body.tva .tva-field input::placeholder { color: var(--tv-muted-3); opacity: 1; }

body.tva .tva-field input:-webkit-autofill,
body.tva .tva-field input:-webkit-autofill:hover,
body.tva .tva-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--tv-ink) !important;
    box-shadow: 0 0 0 1000px #F8FDFC inset !important;
}

/* Server validation messages (tv-chip--danger look) */
body.tva .error-text {
    align-self: flex-start;
    max-width: 100%;
    margin: 8px 0 0;
    padding: 6px 12px;
    border-radius: 12px;
    background: var(--tv-danger-bg);
    color: var(--tv-danger);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

/* Buttons / links */
body.tva .tva-submit { height: 52px; font-size: 14.5px; margin-top: 4px; }
body.tva .tva-google { height: 50px; font-size: 14px; gap: 10px; border-color: rgba(12, 26, 32, 0.08); }
body.tva .tva-google svg { flex: 0 0 auto; }
body.tva .tva-alt-btn { height: 46px; font-size: 13.5px; gap: 6px; }
body.tva .tva-alt-btn svg { width: 16px; height: 16px; }

.tva-or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--tv-muted-2);
    font-size: 12px;
    font-weight: 600;
}

.tva-or::before,
.tva-or::after {
    content: '';
    flex: 1 1 0;
    height: 1px;
    background: var(--tv-line-2);
}

.tva-alt { display: flex; flex-direction: column; gap: 10px; }

.tva-alt-text {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--tv-muted);
}

body.tva .tva-forgot {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--tv-teal);
    cursor: pointer;
    white-space: nowrap;
}

body.tva .tva-forgot:hover { color: var(--tv-ink); }

/* auth.css .cute-text hover lift/colour — off on these screens */
body.tva .cute-text:hover { transform: none; opacity: 1; color: inherit; }

/* Language button + glass popover (#langBtn / #langPopup, .show toggled by JS) */
body.tva .lang-btn {
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    color: var(--tv-ink-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease;
}

body.tva .lang-btn:hover { background: #FFFFFF; }
body.tva .lang-btn svg { width: 19px; height: 19px; }
body.tva .lang-btn svg path { stroke: currentColor; }

body.tva .lang-popup {
    top: calc(100% + 10px);
    right: 8px;
    width: 230px;
    min-width: 0;
    max-height: min(calc(100vh - 110px), 580px);
    overflow-y: auto;
    margin: 0;
    padding: 10px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(28px) saturate(170%);
    backdrop-filter: blur(28px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: var(--tv-shadow-pop);
}

body.tva .lang-popup .lang-title {
    margin: 0;
    padding: 6px 10px 8px;
    border: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--tv-teal);
}

body.tva .lang-popup a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--tv-ink);
    text-decoration: none;
}

body.tva .lang-popup a:hover { background: rgba(0, 217, 201, 0.1); }
body.tva .lang-popup a.is-active { background: var(--tv-mint); color: var(--tv-teal); }
body.tva .lang-popup .fi { flex: 0 0 auto; border-radius: 3px; }

/* Register: phone country picker ------------------------------------------ */
body.tva .phone-row {
    display: grid;
    grid-template-columns: 124px minmax(0, 1fr);
    gap: 10px;
    width: 100%;
}

body.tva .tm-country-box {
    width: 100%;
    height: 50px;
    padding: 0 10px 0 12px;
    border-radius: var(--tv-r-sm);
    border: 1px solid var(--tv-glass-border-strong);
    outline: none;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 1px 3px rgba(4, 60, 56, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

body.tva .tm-country-box:hover { border-color: rgba(0, 217, 201, 0.55); }
body.tva .tm-country-left { gap: 8px; }
body.tva .tm-country-sep { display: none; }
body.tva .tm-country-text { color: var(--tv-ink); font-size: 14px; font-weight: 600; }
body.tva .tm-country-box svg path { stroke: var(--tv-muted-2); }

body.tva .tm-country-dropdown {
    top: calc(100% + 8px);
    width: 280px;
    max-width: calc(100vw - 56px);
    padding: 8px;
    border-radius: 20px;
    outline: none;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(28px) saturate(170%);
    backdrop-filter: blur(28px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: var(--tv-shadow-pop);
}

body.tva .tm-country-search-wrap { padding: 2px 2px 8px; background: transparent; }

body.tva .tm-country-search {
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--tv-line-2);
    border-radius: 999px;
    outline: none;
    background: #FFFFFF !important;
    color: var(--tv-ink) !important;
    font-family: var(--tv-font) !important;
    font-size: 13.5px;
}

body.tva .tm-country-search:focus { border-color: var(--tv-cyan-2); box-shadow: var(--tv-ring); }

body.tva .tm-country-item {
    height: 40px;
    padding: 0 10px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--tv-ink);
}

body.tva .tm-country-item:hover { background: rgba(0, 217, 201, 0.1); }

/* Register: account type (#select-container .cute-text, inline bg = selected) */
.tva-opts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(0, 217, 201, 0.1);
}

.tva-opt {
    min-width: 0;
    min-height: 38px;
    padding: 4px 10px;
    border-radius: 999px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    color: var(--tv-ink-3);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    transition: background .15s ease;
}

.tva-opt:hover { background: rgba(255, 255, 255, 0.6); }
.tva-opt .tva-opt-ico { flex: 0 0 auto; display: flex; }
.tva-opt .tva-opt-ico svg path { stroke: currentColor; }
.tva-opt .tva-opt-text { min-width: 0; overflow-wrap: anywhere; }

/* Register: agreements */
.tva-agree { display: flex; flex-direction: column; gap: 10px; padding-top: 2px; }

.tva-agree label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 20px;
    color: var(--tv-ink-3);
}

.tva-agree .tva-check { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 0; position: relative; }
.tva-agree .tva-check svg { display: block; }

.tva-agree .agreement-link {
    font-weight: 700;
    color: var(--tv-teal);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

/* Register: agreement PDF popup */
.tva-modal-bg {
    position: fixed;
    inset: 0;
    z-index: 100000;
    justify-content: center;
    align-items: center;
    padding: 14px;
    background: rgba(6, 22, 24, 0.36);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.tva-modal {
    width: 100%;
    max-width: 820px;
    height: 88%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: var(--tv-shadow-pop);
}

.tva-modal-head {
    padding: 16px 18px 14px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--tv-line-2);
}

.tva-modal-head h2 {
    margin: 0;
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--tv-ink);
}

body.tva .tva-x {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(12, 26, 32, 0.06);
    color: var(--tv-ink-3);
    font-family: inherit;
    font-size: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

body.tva .tva-x:hover { background: rgba(12, 26, 32, 0.1); }

.tva-modal-foot {
    padding: 12px 16px 16px;
    text-align: center;
    border-top: 1px solid var(--tv-line-2);
}

.tva-modal-hint {
    margin-bottom: 10px;
    font-size: 12.5px;
    color: var(--tv-muted-2);
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 1000px) {
    .tva-main,
    .tva-main--wide {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
    }

    .tva-hero { display: none; }

    .tva-card { width: 100%; max-width: 520px; }
}

@media (max-width: 560px) {
    .tva-wrap { padding: 14px 14px 32px; gap: 16px; }
    .tva-top { height: 58px; padding: 0 8px 0 18px; }
    .tva-logo img { height: 22px; }
    .tva-card { padding: 24px 20px; gap: 16px; border-radius: 26px; }
    .tva-grid2 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    body.tva .phone-row { grid-template-columns: 112px minmax(0, 1fr); }
    .tva-opt .tva-opt-ico { display: none; }
    .tva-opt { padding: 4px 6px; font-size: 12px; }
    body.tva .lang-popup { right: 4px; }
}
