/* /auth/public/auth.css
 * Estilo MUY contenido: el módulo se ve igual en cualquier proyecto host.
 * Usa variables CSS con fallback para integrarse si el host tiene tokens
 * (--jj-ink, --jj-accent…) sin depender de ellos.
 */

:root {
    --auth-bg:        #ffffff;
    --auth-ink:       #0b1f3a;
    --auth-ink-soft:  #6b6b6b;
    --auth-line:      #e8e8e8;
    --auth-line-soft: #f0f0f0;
    --auth-accent:    #0b1f3a;
    --auth-error:     #b91c1c;
    --auth-success:   #15803d;
}

* { box-sizing: border-box; }

.auth-body {
    margin: 0;
    min-height: 100vh;
    background: var(--auth-bg);
    color: var(--auth-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Brand ─────────────────────────────────────────────────── */
.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--auth-ink);
    text-decoration: none;
    margin-bottom: 8px;
}
.auth-brand__name {
    font: 700 13px ui-monospace, "SF Mono", Menlo, monospace;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* ── Títulos ───────────────────────────────────────────────── */
.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}
.auth-subtitle {
    font-size: 14px;
    color: var(--auth-ink-soft);
    margin: 0 0 6px;
    line-height: 1.5;
}

/* ── Icon (verify_sent / verify_result) ────────────────────── */
.auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--auth-line-soft);
    color: var(--auth-ink-soft);
    margin-bottom: 4px;
}
.auth-icon--success { color: var(--auth-success); background: #d1fae5; }
.auth-icon--error   { color: var(--auth-error);   background: #fee2e2; }

/* ── Forms ─────────────────────────────────────────────────── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 480px) {
    .auth-row { grid-template-columns: 1fr; }
}
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.auth-label {
    font: 700 10.5px ui-monospace, "SF Mono", Menlo, monospace;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--auth-ink-soft);
}
.auth-field input {
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--auth-ink);
    padding: 10px 0;
    font: 500 16px -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--auth-ink);
    outline: none;
    transition: border-color 0.15s;
}
.auth-field input:focus {
    border-bottom-color: var(--auth-accent);
}
.auth-field input::placeholder {
    color: #b8b8b8;
}
.auth-help {
    font-size: 11.5px;
    color: var(--auth-ink-soft);
    line-height: 1.4;
}

/* ── Botones ───────────────────────────────────────────────── */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 22px;
    border-radius: 10px;
    border: 0;
    font: 700 13px ui-monospace, "SF Mono", Menlo, monospace;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, opacity 0.15s;
    margin-top: 8px;
}
.auth-btn--primary {
    background: var(--auth-ink);
    color: #fff;
}
.auth-btn--primary:hover {
    transform: translateY(-1px);
}
.auth-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Footer link ───────────────────────────────────────────── */
.auth-foot {
    font-size: 13px;
    color: var(--auth-ink-soft);
    text-align: center;
    margin: 8px 0 0;
}
.auth-foot a {
    color: var(--auth-ink);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Error inline ──────────────────────────────────────────── */
.auth-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #7f1d1d;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

/* ── Password strength meter (rellenado por auth.js) ───────── */
.auth-help[data-auth-password-strength] {
    min-height: 16px;
    font-weight: 600;
    transition: color 0.15s;
}
.auth-help[data-auth-password-strength].is-weak     { color: #b91c1c; }
.auth-help[data-auth-password-strength].is-medium   { color: #b45309; }
.auth-help[data-auth-password-strength].is-strong   { color: #15803d; }

/* ── Language selector ─────────────────────────────────────────
   Minimalista. Anclado arriba a la derecha. <details>/<summary>
   nativo: sin librerías, sin estado en JS, accesible por teclado.
   En RTL ([dir="rtl"]) se invierte a la izquierda.
*/
.auth-lang {
    position: fixed;
    top: 18px;
    right: 20px;
    z-index: 30;
    font: 500 12px ui-monospace, "SF Mono", Menlo, monospace;
}
[dir="rtl"] .auth-lang { right: auto; left: 20px; }

.auth-lang > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.auth-lang > summary::-webkit-details-marker { display: none; }

.auth-lang__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border-radius: 8px;
    color: var(--auth-ink);
    background: transparent;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.auth-lang__btn:hover,
.auth-lang[open] .auth-lang__btn {
    background: var(--auth-line-soft);
    border-color: var(--auth-line);
}
.auth-lang__code {
    letter-spacing: 0.08em;
    font-weight: 700;
}
.auth-lang__chev {
    opacity: 0.55;
    transition: transform 0.18s;
}
.auth-lang[open] .auth-lang__chev { transform: rotate(180deg); }

.auth-lang__menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 168px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--auth-line);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(11, 31, 58, 0.10),
                0 2px 6px  rgba(11, 31, 58, 0.05);
    max-height: 70vh;
    overflow: auto;
}
[dir="rtl"] .auth-lang__menu { right: auto; left: 0; }

.auth-lang__item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--auth-ink);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.2;
    transition: background 0.12s;
}
.auth-lang__item:hover { background: var(--auth-line-soft); }
.auth-lang__item.is-active {
    background: var(--auth-ink);
    color: #fff;
}
.auth-lang__item-code {
    font: 700 10.5px ui-monospace, "SF Mono", Menlo, monospace;
    letter-spacing: 0.10em;
    opacity: 0.75;
    min-width: 22px;
}
.auth-lang__item.is-active .auth-lang__item-code { opacity: 1; }
.auth-lang__item-name {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 500;
}

/* En pantallas muy estrechas reducimos un pelín para no chocar con la marca. */
@media (max-width: 380px) {
    .auth-lang { top: 12px; right: 12px; }
    [dir="rtl"] .auth-lang { left: 12px; }
    .auth-lang__btn { padding: 5px 7px; gap: 4px; }
}

/* ── RTL: pequeñas correcciones del cuerpo de la tarjeta ───── */
[dir="rtl"] .auth-body { text-align: right; }
[dir="rtl"] .auth-brand { flex-direction: row-reverse; }
