/*
 * TUTULMANIA AUTH CSS
 * Baseline: 6.2.66
 * Purpose: single source of truth for Login + Register authentication UI.
 * Login and Register intentionally share the same field/captcha/button system.
 */

:root {
    --tm-auth-bg: #030303;
    --tm-auth-card: #111111;
    --tm-auth-field: #1b1b1b;
    --tm-auth-field-top: #222222;
    --tm-auth-border: #363636;
    --tm-auth-gold: #ffd21a;
    --tm-auth-gold-2: #ffad00;
    --tm-auth-red: #f30d16;
    --tm-auth-muted: #8c8c8c;
    --tm-auth-text: #ffffff;

    --tm-auth-field-height: 42px;
    --tm-auth-field-radius: 12px;
    --tm-auth-field-border: 2px;
    --tm-auth-field-font: 15px;
    --tm-auth-field-icon: 21px;

    --tm-auth-captcha-image-width: 78px;
    --tm-auth-captcha-refresh-width: 53px;
    --tm-auth-captcha-gap: 7px;
    --tm-auth-captcha-text-inset: 13px;

    --tm-auth-action-height: 50px;
    --tm-auth-action-radius: 13px;
    --tm-auth-action-font: 22px;

    --tm-auth-secondary-font: 13px;
    --tm-auth-secondary-line: 1.25;
    --tm-auth-rhythm: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
}

html {
    background: var(--tm-auth-bg);
}

body.auth-page {
    min-height: 100svh;
    background: var(--tm-auth-bg);
    color: var(--tm-auth-text);
    font-family: Arial, Helvetica, sans-serif;
}

/* =========================
   PAGE SHELL
========================= */

.auth-wrapper {
    position: relative;
    width: 100%;
    min-height: 100svh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 12px 10px 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 193, 7, .12), transparent 28%),
        radial-gradient(circle at 50% 92%, rgba(255, 0, 0, .07), transparent 30%),
        var(--tm-auth-bg);
}

.auth-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(212, 175, 55, .55) 1px, transparent 1px);
    background-size: 8px 8px;
    opacity: .16;
}

.auth-container {
    position: relative;
    z-index: 1;
    width: min(100%, 430px);
    margin: 0 auto;
    text-align: center;
}

/* =========================
   LOGIN BRAND + PROMO
========================= */

.login-logo {
    width: 100%;
    height: 40px;
    margin: 4px 0 12px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.auth-brand-logo {
    display: block;
    width: min(205px, 55vw);
    height: 40px;
    max-width: 100%;
    margin: 0;
    object-fit: contain;
    object-position: center;
}

.promo-banner {
    position: relative;
    overflow: hidden;
    margin: 0 0 18px;
    padding: 22px 10px 20px;
    border: 2px solid rgba(255, 235, 120, .55);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffd91a 0%, #ffae00 100%);
    box-shadow: 0 0 24px rgba(255, 193, 7, .48), inset 0 1px rgba(255, 255, 255, .42);
}

.promo-banner::before {
    content: "";
    position: absolute;
    inset: -20% auto -20% -45%;
    width: 40%;
    background: rgba(255, 255, 255, .28);
    transform: skewX(-24deg);
    animation: tm-auth-shine 3.4s infinite;
}

.promo-title {
    position: relative;
    z-index: 1;
    color: #050505;
    font-size: clamp(22px, 6.7vw, 30px);
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: -.4px;
}

.promo-cta {
    position: relative;
    z-index: 1;
    width: max-content;
    max-width: 100%;
    margin: 14px auto 0;
    padding: 7px 15px;
    border: 2px solid rgba(0, 0, 0, .9);
    background: linear-gradient(90deg, #070707, #171717, #070707);
    color: #fff;
    font-size: clamp(14px, 4.2vw, 18px);
    line-height: 1.15;
    font-weight: 900;
    letter-spacing: .2px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .35);
    clip-path: polygon(4% 0, 100% 0, 96% 100%, 0 100%);
}

.promo-cta span {
    color: #ff1b1b;
    text-shadow: 0 0 7px rgba(255, 0, 0, .45);
}

@keyframes tm-auth-shine {
    to { left: 145%; }
}

/* Register has no promo banner. */
.register-page .promo-banner {
    display: none;
}

/* =========================
   SHARED CARD SYSTEM
========================= */

.login-card,
.register-card {
    width: 100%;
    margin: 0;
    padding: 16px 20px 14px;
    border: var(--tm-auth-field-border) solid rgba(255, 210, 26, .28);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(18, 18, 18, .985), rgba(5, 5, 5, .985));
    box-shadow: 0 0 22px rgba(255, 193, 7, .12), 0 18px 42px rgba(0, 0, 0, .5);
    text-align: left;
}

.login-card {
    padding-top: 16px;
}

.login-card form,
.register-card form {
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* =========================
   STATUS / REGISTER ALERT
========================= */

.login-status {
    width: 100%;
    min-height: 20px;
    margin: 0 0 16px;
    color: #999;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    text-align: center;
}

.login-status-error {
    color: #ff5a5a;
}

.login-status-success {
    color: #6ee7a2;
}

.login-status-neutral {
    color: #999;
}

.tm-form-alert {
    width: 100%;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.25;
    text-align: center;
}

.tm-form-alert.error {
    color: #fff;
    background: rgba(255, 30, 30, .12);
    border: 1px solid rgba(255, 60, 60, .45);
}

.tm-form-alert.success {
    color: #fff;
    background: rgba(70, 220, 120, .12);
    border: 1px solid rgba(70, 220, 120, .4);
}

/* =========================
   LANGUAGE SWITCHER
========================= */

.auth-language-switcher {
    width: 100%;
    height: var(--tm-auth-field-height);
    min-height: var(--tm-auth-field-height);
    margin: 0 0 var(--tm-auth-rhythm);
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border: var(--tm-auth-field-border) solid var(--tm-auth-border);
    border-radius: var(--tm-auth-field-radius);
    background: var(--tm-auth-field);
    overflow: hidden;
}

.auth-language-btn {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border: 0;
    border-right: var(--tm-auth-field-border) solid var(--tm-auth-border);
    border-radius: 0;
    background: transparent;
    color: #c8c8c8;
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--tm-auth-secondary-font);
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.auth-language-btn:last-child {
    border-right: 0;
}

.auth-language-btn img {
    display: none;
}

.auth-language-btn > span {
    display: block;
    margin-top: 7px;
    white-space: nowrap;
    line-height: 1;
}

.auth-language-btn::after {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    min-width: 8px;
    min-height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: #777;
}

.auth-language-btn.active {
    color: var(--tm-auth-gold);
}

.auth-language-btn.active::after {
    background: var(--tm-auth-gold);
    box-shadow: 0 0 8px rgba(255, 210, 26, .45);
}

.auth-language-btn:focus-visible {
    outline: 2px solid rgba(255, 210, 26, .75);
    outline-offset: -2px;
}

/* =========================
   SHARED FORM FIELD
========================= */

.field-box {
    position: relative;
    width: 100%;
    height: var(--tm-auth-field-height);
    min-height: var(--tm-auth-field-height);
    max-height: var(--tm-auth-field-height);
    margin: 0 0 var(--tm-auth-rhythm);
    padding: 0;
    display: flex;
    align-items: center;
    border: var(--tm-auth-field-border) solid var(--tm-auth-border);
    border-radius: var(--tm-auth-field-radius);
    background: linear-gradient(180deg, var(--tm-auth-field-top), var(--tm-auth-field));
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}

.field-box:focus-within {
    border-color: rgba(255, 210, 26, .68);
    box-shadow: 0 0 0 3px rgba(255, 210, 26, .08), 0 0 15px rgba(255, 193, 7, .08);
}

.field-icon {
    width: 42px;
    min-width: 42px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8e8e8e;
}

.field-icon svg {
    width: var(--tm-auth-field-icon);
    height: var(--tm-auth-field-icon);
}

.field-box input,
.register-select-box select {
    min-width: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 12px 0 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--tm-auth-field-font);
    font-weight: 400;
    line-height: 1;
    box-shadow: none;
}

.field-box input::placeholder {
    color: var(--tm-auth-muted);
    opacity: 1;
}

.password-box input {
    padding-right: 42px;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 5px;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #c7c7c7;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.toggle-password:hover,
.toggle-password:focus-visible {
    color: var(--tm-auth-gold);
    outline: none;
    background: rgba(255, 210, 26, .07);
}

.toggle-password svg {
    width: var(--tm-auth-field-icon);
    height: var(--tm-auth-field-icon);
}

.eye-closed {
    display: none;
}

/* =========================
   REGISTER FIELD HELP
========================= */

.register-field-group {
    width: 100%;
    margin: 0 0 var(--tm-auth-rhythm);
    padding: 0;
}

.register-field-group .field-box {
    margin-bottom: 0;
}

.register-field-help {
    display: block;
    margin: 4px 0 0;
    padding: 0;
    color: #888;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9px;
    font-weight: 400;
    line-height: 1.2;
    text-align: left;
}

/* =========================
   BANK SELECTOR
========================= */

.register-select-box {
    position: relative;
}

.register-select-box select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 36px;
    cursor: pointer;
}

.register-select-box select:invalid {
    color: var(--tm-auth-muted);
}

.register-select-box select option {
    color: #111;
    background: #fff;
}

.register-select-arrow {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 9px;
    height: 9px;
    border-right: 2px solid #d0d0d0;
    border-bottom: 2px solid #d0d0d0;
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}

/* =========================
   SHARED CAPTCHA
   Login + Register use this exact structure and geometry.
========================= */

.auth-captcha-row {
    width: 100%;
    height: var(--tm-auth-field-height);
    min-height: var(--tm-auth-field-height);
    margin: 0 0 var(--tm-auth-rhythm);
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--tm-auth-captcha-image-width) var(--tm-auth-captcha-refresh-width);
    gap: var(--tm-auth-captcha-gap);
    align-items: stretch;
}

.auth-captcha-input,
.auth-captcha-image,
.auth-captcha-refresh {
    width: 100%;
    min-width: 0;
    height: var(--tm-auth-field-height);
    min-height: var(--tm-auth-field-height);
    max-height: var(--tm-auth-field-height);
    margin: 0;
    align-self: stretch;
    box-sizing: border-box;
}

.auth-captcha-input {
    overflow: hidden;
}

.auth-captcha-input input {
    width: 100%;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 16px 0 var(--tm-auth-captcha-text-inset);
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--tm-auth-field-font);
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    text-indent: 0;
    box-shadow: none;
}

.auth-captcha-input input::placeholder {
    color: var(--tm-auth-muted);
    opacity: 1;
}

.auth-captcha-image {
    display: block;
    object-fit: fill;
    border: var(--tm-auth-field-border) solid #e3e3e3;
    border-radius: var(--tm-auth-field-radius);
    background: #101010;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
}

.auth-captcha-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: var(--tm-auth-field-border) solid #e3e3e3;
    border-radius: var(--tm-auth-field-radius);
    background: #101010;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
    -webkit-tap-highlight-color: transparent;
}

.auth-captcha-refresh span {
    display: block;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 29px;
    font-weight: 400;
    line-height: 1;
    transform: translateY(-1px);
}

.auth-captcha-refresh:hover,
.auth-captcha-refresh:focus-visible {
    color: #fff;
    border-color: #e3e3e3;
    background: #151515;
    outline: none;
}

/* =========================
   ACTION BUTTONS
========================= */

.login-btn,
.register-btn,
.register-submit-btn {
    width: 100%;
    height: var(--tm-auth-action-height);
    min-height: var(--tm-auth-action-height);
    max-height: var(--tm-auth-action-height);
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--tm-auth-action-radius);
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--tm-auth-action-font);
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform .2s, filter .2s;
}

.login-btn {
    background: linear-gradient(180deg, #ffd91a, #ffad00);
    color: #050505;
    box-shadow: 0 0 18px rgba(255, 193, 7, .72);
    animation: tm-auth-pulse 1.7s infinite;
}

.register-btn,
.register-submit-btn {
    background: linear-gradient(180deg, #ff1818, #d80000);
    color: #fff;
    box-shadow: 0 0 17px rgba(255, 0, 0, .5);
}

.login-btn:hover,
.register-btn:hover,
.register-submit-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.login-btn:focus-visible,
.register-btn:focus-visible,
.register-submit-btn:focus-visible {
    outline: 2px solid rgba(255, 210, 26, .8);
    outline-offset: 2px;
}

@keyframes tm-auth-pulse {
    0%, 100% { box-shadow: 0 0 9px rgba(255, 193, 7, .58); }
    50% { box-shadow: 0 0 22px rgba(255, 193, 7, .86); }
}

/* One shared vertical rhythm between CAPTCHA and actions. */
.login-btn,
.register-submit-btn {
    margin-top: 0;
}

.login-card .register-btn {
    margin-top: var(--tm-auth-rhythm);
}

/* =========================
   SECONDARY AUTH TEXT
========================= */

.login-note,
.tm-terms,
.tm-auth-note {
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--tm-auth-secondary-font);
    font-weight: 400;
    line-height: var(--tm-auth-secondary-line);
}

.login-note {
    margin: var(--tm-auth-rhythm) 0 0;
    color: #999;
    text-align: center;
}

.login-note a,
.tm-terms a,
.tm-auth-note a {
    color: var(--tm-auth-gold);
    font-size: inherit;
    line-height: inherit;
    font-weight: 800;
    text-decoration: none;
}

.login-note a:hover,
.tm-terms a:hover,
.tm-auth-note a:hover {
    text-decoration: underline;
}

.tm-terms {
    width: 100%;
    margin: 0 0 var(--tm-auth-rhythm);
    padding: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    color: #aaa;
    white-space: nowrap;
}

.tm-terms input {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    margin: 0;
    flex: 0 0 16px;
    accent-color: var(--tm-auth-gold);
}

.tm-terms small {
    margin: 0;
    padding: 0;
    font: inherit;
}

.tm-auth-note {
    margin: var(--tm-auth-rhythm) 0 0;
    color: #999;
    text-align: center;
}

/* =========================
   REGISTER TITLE
========================= */

.tm-auth-top {
    width: 100%;
    margin: 4px 0 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tm-auth-top h1 {
    margin: 0;
    padding: 0;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--tm-auth-action-font);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0;
    text-align: center;
}

/* =========================
   COPYRIGHT
   Normal document flow: directly below the Login card.
========================= */

.auth-copyright {
    width: 100%;
    margin: 16px 0 0;
    padding: 0 16px 0;
    color: #727272;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: .2px;
    text-align: center;
    pointer-events: none;
}

/* Register intentionally has no copyright element in its current HTML. */
.register-page .auth-copyright {
    display: none;
}

/* =========================
   DESKTOP / LARGER VIEWPORTS
========================= */

@media (min-width: 601px) {
    .auth-wrapper {
        align-items: center;
        padding: 24px 20px;
        overflow-y: auto;
    }

    .auth-container {
        width: min(100%, 640px);
    }

    .login-logo {
        height: 42px;
        margin: 16px 0;
    }

    .auth-brand-logo {
        width: min(240px, 52vw);
        height: 42px;
    }

    .promo-banner {
        margin-bottom: 18px;
        padding: 27px 18px 24px;
        border-radius: 20px;
    }

    .promo-title {
        font-size: clamp(25px, 6vw, 43px);
    }

    .promo-cta {
        margin-top: 16px;
        padding: 7px 19px;
        font-size: clamp(16px, 4vw, 25px);
    }

    .login-card,
    .register-card {
        padding: 28px 34px 27px;
        border-radius: 23px;
    }

    .field-box {
        height: 66px;
        min-height: 66px;
        max-height: 66px;
        border-radius: 16px;
    }

    .field-icon {
        width: 66px;
        min-width: 66px;
    }

    .field-icon svg {
        width: 28px;
        height: 28px;
    }

    .field-box input,
    .register-select-box select {
        font-size: 20px;
    }

    .auth-language-switcher {
        height: 64px;
        min-height: 64px;
        border-radius: 16px;
    }

    .auth-language-btn {
        font-size: 14px;
    }

    .auth-language-btn > span {
        margin-top: 15px;
    }

    .auth-language-btn::after {
        margin-top: 8px;
    }

    .auth-captcha-row {
        height: 58px;
        min-height: 58px;
        grid-template-columns: minmax(0, 1fr) 88px 58px;
        gap: 8px;
    }

    .auth-captcha-input,
    .auth-captcha-image,
    .auth-captcha-refresh {
        height: 58px;
        min-height: 58px;
        max-height: 58px;
    }

    .auth-captcha-image,
    .auth-captcha-refresh {
        border-radius: 10px;
    }

    .login-btn,
    .register-btn,
    .register-submit-btn {
        height: 62px;
        min-height: 62px;
        max-height: 62px;
        border-radius: 16px;
    }
}

/* =========================
   COMPACT MOBILE
========================= */

@media (max-width: 430px) {
    body.auth-page.register-page {
        overflow-y: auto;
    }

    .register-page .auth-wrapper {
        min-height: 100svh;
        padding: 18px 10px 0;
        overflow: visible;
    }

    .register-page .auth-container {
        width: 100%;
        max-width: 430px;
    }

    .register-page .tm-auth-top {
        margin: 4px 0 16px;
    }

    .register-page .register-card {
        padding: 16px 20px 14px;
        border-radius: 20px;
    }

    .login-card {
        padding: 16px 20px 14px;
    }

    .login-status {
        margin-bottom: 16px;
        font-size: 18px;
    }

    .auth-language-switcher {
        height: var(--tm-auth-field-height);
        min-height: var(--tm-auth-field-height);
        margin-bottom: var(--tm-auth-rhythm);
    }

    .auth-language-btn {
        height: var(--tm-auth-field-height);
        min-height: var(--tm-auth-field-height);
        max-height: var(--tm-auth-field-height);
        font-size: var(--tm-auth-secondary-font);
    }

    .auth-language-btn > span {
        margin-top: 7px;
    }

    .auth-language-btn::after {
        margin-top: 6px;
    }

    .auth-captcha-row {
        height: var(--tm-auth-field-height);
        min-height: var(--tm-auth-field-height);
        grid-template-columns: minmax(0, 1fr) var(--tm-auth-captcha-image-width) var(--tm-auth-captcha-refresh-width);
        gap: var(--tm-auth-captcha-gap);
    }

    .auth-captcha-input,
    .auth-captcha-image,
    .auth-captcha-refresh {
        height: var(--tm-auth-field-height);
        min-height: var(--tm-auth-field-height);
        max-height: var(--tm-auth-field-height);
    }

    .login-note,
    .tm-terms,
    .tm-auth-note {
        font-size: var(--tm-auth-secondary-font);
        line-height: var(--tm-auth-secondary-line);
    }

    .auth-copyright {
        margin-top: 16px;
        padding-bottom: 18px;
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    :root {
        --tm-auth-captcha-image-width: 72px;
        --tm-auth-captcha-refresh-width: 49px;
        --tm-auth-captcha-gap: 6px;
    }

    .auth-captcha-row {
        grid-template-columns: minmax(0, 1fr) var(--tm-auth-captcha-image-width) var(--tm-auth-captcha-refresh-width);
    }
}
