/* =========================================================
   Нэвтрэх / Бүртгүүлэх / Сургалтад бүртгүүлэх — хуудас хэлбэр
   Figma: "Frame 28" (login), "Frame 27" (signup), "Frame 29" (form)
   style.css-ийн .auth, .auth-field, .auth-btn класс дээр суурилна.
   ========================================================= */

/* ---------- Хуудасны дэвсгэр ---------- */
.auth-page {
    position: relative; overflow: hidden;
    display: flex; justify-content: center; align-items: flex-start;
    min-height: calc(100vh - 100px); padding: 64px 16px 96px;
    background: var(--bg, #f6f6f6);
}
.auth-page .petal-field { position: absolute; inset: 0; pointer-events: none; }
.auth-page .auth { z-index: 1; animation: none; filter: drop-shadow(8px 8px 5px rgba(13, 39, 80, .04)); }
.auth--wide { max-width: 720px; }

/* Хуудас дээр хаах товчны оронд "буцах" холбоос */
.auth__back {
    display: grid; place-items: center; width: 48px; height: 48px; flex: none;
    border-radius: 6px; color: #000; transition: background .2s;
}
.auth__back:hover { background: var(--black-5, rgba(0, 0, 0, .05)); }
.auth__back svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Сервер талын мэдэгдэл */
.auth-alert {
    display: flex; gap: 8px; align-items: flex-start;
    padding: 12px 16px; border-radius: 12px;
    font-size: 14px; line-height: 1.4;
}
.auth-alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-alert--error { color: #d92d20; background: rgba(255, 0, 0, .05); border: 1px solid rgba(255, 0, 0, .15); }
.auth-alert--ok { color: #1a7f37; background: rgba(0, 255, 0, .05); border: 1px solid rgba(0, 255, 0, .3); }
.auth-alert--info { color: #3232b5; background: rgba(0, 0, 255, .03); border: 1px solid rgba(0, 0, 255, .15); }

/* Талбарын алдаа / тусламж */
.auth-field__error { font-size: 13px; line-height: 1.3; color: #d92d20; }
.auth-field__hint { font-size: 13px; line-height: 1.3; color: var(--black-50, rgba(0, 0, 0, .5)); }
.auth-field__label i { font-style: normal; color: #d92d20; margin-left: 2px; }
.auth-field__label small { font-weight: 400; color: var(--black-50, rgba(0, 0, 0, .5)); }
.auth-field input.is-invalid,
.auth-field textarea.is-invalid { border-color: #e5484d; }

/* Textarea — input-тэй ижил загвар */
.auth-field textarea {
    width: 100%; min-height: 120px; padding: 12px 24px; resize: vertical;
    border: 1px solid var(--black-10, rgba(0, 0, 0, .1)); border-radius: 24px; background: #fff;
    font: inherit; font-size: 18px; line-height: 1.4; color: #000; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.auth-field textarea::placeholder { color: var(--black-50, rgba(0, 0, 0, .5)); }
.auth-field textarea:focus { border-color: var(--grad-a, #667eea); box-shadow: 0 0 0 3px rgba(102, 126, 234, .15); }

/* Нууц үг харуулах товч */
.auth-pass { position: relative; }
.auth-pass input { padding-right: 56px; }
.auth-eye {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    display: grid; place-items: center; width: 36px; height: 36px;
    border: 0; border-radius: 999px; background: none; color: rgba(0, 0, 0, .4); cursor: pointer;
    transition: background .2s, color .2s;
}
.auth-eye:hover { background: rgba(0, 0, 0, .05); color: #3232b5; }
.auth-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-eye .i-hide { display: none; }
.auth-eye[aria-pressed="true"] .i-show { display: none; }
.auth-eye[aria-pressed="true"] .i-hide { display: block; }

/* Disabled товч */
.auth-btn:disabled, .auth-btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; box-shadow: none; }
.auth-btn--primary .icon { width: 20px; height: 20px; }
.auth-btn--outline .icon { width: 20px; height: 20px; }
a.auth-btn { text-decoration: none; }

/* ---------- Сургалтад бүртгүүлэх ---------- */
.auth__sub { margin-top: 8px; font-size: 16px; line-height: 1.4; color: var(--black-60, rgba(0, 0, 0, .6)); }
.auth__sub b { color: #3232b5; font-weight: 500; }

/* Нэвтэрсэн хэрэглэгч */
.trr-me {
    display: flex; align-items: center; gap: 16px; padding: 16px;
    border-radius: 16px; background: rgba(0, 0, 255, .01); border: 1px solid rgba(0, 0, 255, .2);
}
.trr-me__avatar {
    display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 50%;
    background: var(--gradient); color: #fff; font-size: 20px; font-weight: 700;
}
.trr-me b { display: block; font-size: 16px; font-weight: 600; color: rgba(0, 0, 0, .8); }
.trr-me span { font-size: 14px; color: rgba(0, 0, 0, .5); }

/* Нэвтрэх санал */
.trr-login {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
    padding: 12px 16px 12px 24px; border-radius: 999px;
    background: rgba(0, 0, 255, .03); border: 1px solid rgba(0, 0, 255, .1);
    font-size: 16px; color: rgba(0, 0, 0, .7);
}
.trr-login a {
    display: inline-flex; align-items: center; gap: 4px;
    font-weight: 500; color: #3232b5; white-space: nowrap; transition: opacity .2s;
}
.trr-login a:hover { opacity: .7; }
.trr-login a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Бүлгийн гарчиг */
.trr-group {
    margin: 0; padding-top: 24px; border-top: 1px dashed rgba(0, 0, 0, .2);
    font-size: 14px; font-weight: 400; text-transform: uppercase; letter-spacing: .02em; color: var(--black-50, rgba(0, 0, 0, .5));
}
.trr-group:first-child { padding-top: 0; border-top: 0; }
.trr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.trr-grid .auth-field--full { grid-column: 1 / -1; }

/* Төлбөрийн хэлбэр — pill radio */
.trr-pay { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.trr-pay label {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 12px 24px; border: 1px solid var(--black-10, rgba(0, 0, 0, .1)); border-radius: 999px; background: #fff;
    font-size: 18px; line-height: 1.36; color: rgba(0, 0, 0, .8); cursor: pointer;
    transition: border-color .2s, background-color .2s, color .2s;
}
.trr-pay label:hover { border-color: rgba(0, 0, 255, .3); }
.trr-pay input { position: absolute; opacity: 0; pointer-events: none; }
.trr-pay__dot {
    display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%;
    border: 1.5px solid rgba(0, 0, 0, .25); transition: border-color .2s;
}
.trr-pay__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--gradient); transform: scale(0); transition: transform .2s; }
.trr-pay label:has(input:checked) { border-color: rgba(0, 0, 255, .5); background: rgba(0, 0, 255, .05); color: #3232b5; }
.trr-pay label:has(input:checked) .trr-pay__dot { border-color: #3232b5; }
.trr-pay label:has(input:checked) .trr-pay__dot::after { transform: scale(1); }
.trr-pay label:has(input:focus-visible) { outline: 2px solid #667eea; outline-offset: 2px; }
.trr-pay.is-invalid label { border-color: #e5484d; }

/* Амжилттай */
.trr-done { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 0 8px; text-align: center; }
.trr-done__icon {
    display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%;
    background: rgba(0, 255, 0, .05); border: 1px solid rgba(0, 255, 0, .3); color: #1a7f37;
}
.trr-done__icon svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trr-done h2 { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.2; color: var(--blue, #035ba5); }
.trr-done p { margin: 0; max-width: 460px; font-size: 16px; line-height: 1.6; color: rgba(0, 0, 0, .6); }
.trr-done .auth__buttons { width: 100%; max-width: 420px; margin-top: 8px; }

[hidden] { display: none !important; }

@media (max-width: 600px) {
    .auth-page { padding: 24px 12px 64px; }
    .trr-grid { grid-template-columns: 1fr; }
    .trr-login { border-radius: 16px; padding: 12px 16px; }
    .auth-field textarea, .trr-pay label { font-size: 16px; }
}