/* ========================================================================
   YaMarca — CSS compartido del flujo de registro público (Prompt #25b-bis).

   Cubre /app/registro, /app/registro-pendiente y /verificar-email/{token}.
   Carga independiente de pwa.css para mantener la app autenticada y el
   flujo público desacoplados visualmente.

   Diseño basado en las maquetas de Claude Design (Variante Expresiva):
   decoraciones de fondo con gradientes + dots + rings, card central con
   sombra suave, tipografía YaMarca.
   ======================================================================== */

/* ---------- design tokens ---------- */
:root {
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --blue-soft: #eff6ff;
    --green: #16a34a;
    --green-soft: #dcfce7;
    --warning: #f59e0b;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --bg: #fbfcfe;
    --bg-soft: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --white: #ffffff;
    --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.04),
                   0 12px 32px rgba(37, 99, 235, 0.08);
    --shadow-btn: 0 1px 2px rgba(37, 99, 235, 0.25);
    --radius-card: 16px;
    --radius-input: 8px;
    --radius-btn: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@keyframes ym-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Util: Alpine flicker prevention. Se usa con x-cloak. */
[x-cloak] { display: none !important; }

/* ---------- expressive background decor ---------- */
.decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.decor::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 50% at 0% 0%, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0) 70%),
        radial-gradient(50% 50% at 100% 100%, rgba(22, 163, 74, 0.06), rgba(22, 163, 74, 0) 70%);
}
.decor::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(15, 23, 42, 0.06) 1px, transparent 0);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 70%);
            mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 70%);
    opacity: 0.7;
}
.decor-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.2px dashed rgba(37, 99, 235, 0.35);
}
.decor-ring.tr { width: 320px; height: 320px; right: -120px; top: -120px; }
.decor-ring.bl {
    width: 280px; height: 280px;
    left: -100px; bottom: -100px;
    border-color: rgba(22, 163, 74, 0.4);
}

/* Variantes por estado de la pantalla de verificación. */
body[data-state="exito"] .decor-ring.bl { border-color: rgba(22, 163, 74, 0.55); }
body[data-state="exito"] .decor::before {
    background:
        radial-gradient(60% 50% at 0% 0%, rgba(37, 99, 235, 0.06), rgba(37, 99, 235, 0) 70%),
        radial-gradient(55% 55% at 100% 100%, rgba(22, 163, 74, 0.10), rgba(22, 163, 74, 0) 70%);
}
body[data-state^="token_"] .decor-ring.bl { border-color: rgba(245, 158, 11, 0.4); }
body[data-state^="token_"] .decor::before {
    background:
        radial-gradient(60% 50% at 0% 0%, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0) 70%),
        radial-gradient(50% 50% at 100% 100%, rgba(37, 99, 235, 0.05), rgba(37, 99, 235, 0) 70%);
}

/* ---------- header & footer ---------- */
.site-header {
    position: relative;
    z-index: 1;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 32px;
    height: 32px;
    background: var(--blue);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.header-aux { font-size: 14px; color: var(--text-muted); }
.header-aux a { font-weight: 500; }

.site-footer {
    position: relative;
    z-index: 1;
    margin-top: auto;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: var(--text-muted); }

/* ---------- main layout ---------- */
main {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
}
main.center { justify-content: center; }
.stack {
    width: 100%;
    max-width: 480px;
}
.stack-title {
    margin-bottom: 28px;
    text-align: left;
}
.stack-title h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.stack-title p {
    margin: 8px 0 0;
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---------- card ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 36px;
}
.card.center { padding: 40px 36px; text-align: center; }

@media (max-width: 480px) {
    main { padding: 24px 16px; }
    .card { padding: 24px; border-radius: 14px; }
    .card.center { padding: 32px 24px; }
    .stack-title h1 { font-size: 26px; }
}

/* ---------- icon-wrap ---------- */
.icon-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

/* ---------- card content ---------- */
.card h1 {
    margin: 0 0 12px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
}
.card .lede {
    margin: 0 auto 12px;
    max-width: 400px;
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.6;
}
.card .lede strong { color: var(--text); font-weight: 600; word-break: break-word; }
.card .sublede {
    margin: 0 auto 28px;
    max-width: 380px;
    font-size: 14px;
    color: var(--text-subtle);
    line-height: 1.5;
}
.card.center .lede { margin-bottom: 28px; }

/* ---------- form ---------- */
form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-wrap:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-soft);
}
.input-wrap.has-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-soft);
}
.input-wrap input {
    flex: 1;
    height: 46px;
    padding: 0 14px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    color: var(--text);
    font-family: inherit;
    border-radius: var(--radius-input);
    min-width: 0;
}
.input-wrap.has-toggle input { padding-right: 44px; }
.toggle-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-muted);
}
.toggle-eye:hover { background: var(--bg-soft); }
.field .helper {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}
.field .error {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--danger);
    line-height: 1.4;
}
.field.has-error .helper { display: none; }
.field:not(.has-error) .error { display: none; }

/* ---------- checkbox ---------- */
.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    user-select: none;
}
.check-box {
    position: relative;
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}
.check input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.check-visual {
    position: absolute;
    inset: 0;
    border: 1.5px solid var(--border-strong);
    background: var(--white);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.check-visual svg { opacity: 0; }
.check input:checked + .check-visual {
    background: var(--blue);
    border-color: var(--blue);
}
.check input:checked + .check-visual svg { opacity: 1; }
.check input:focus-visible + .check-visual {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* ---------- buttons ---------- */
.btn {
    width: 100%;
    min-height: 48px;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.15s ease, color 0.15s ease,
                border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
    padding: 0 16px;
    line-height: 1.2;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
    background: var(--blue);
    color: var(--white);
    box-shadow: var(--shadow-btn);
}
.btn-primary:hover:not(:disabled) {
    background: var(--blue-dark);
    color: var(--white);
}
.btn-primary:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
}
.btn-primary.is-loading { cursor: progress; }

.btn-secondary {
    background: var(--white);
    color: var(--text);
    border: 1px solid var(--border);
    min-height: 44px;
    font-size: 15px;
    font-weight: 500;
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-soft); }
.btn-secondary:disabled {
    background: var(--bg-soft);
    color: var(--text-subtle);
    cursor: not-allowed;
}
.btn-secondary.is-loading { cursor: progress; }

/* ---------- alert banner ---------- */
.alert {
    display: none;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    border-left: 4px solid var(--danger);
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #7f1d1d;
    line-height: 1.5;
}
.alert.is-visible { display: flex; }
.alert svg { flex: none; margin-top: 1px; }
.alert a { color: #7f1d1d; font-weight: 600; }

/* Feedback inline (positivo o negativo) — usado en /registro-pendiente. */
.feedback {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}
.feedback.is-exito {
    background: var(--green-soft);
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.feedback.is-error {
    background: var(--danger-soft);
    color: #7f1d1d;
    border: 1px solid var(--danger-border);
}

/* ---------- after-link ---------- */
.after-link {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin: 24px 0 0;
}
.after-link a { font-weight: 500; }
.card .after-link { margin: 20px 0 0; }

/* ---------- spinner ---------- */
.spinner {
    display: inline-block;
    animation: ym-spin 0.9s linear infinite;
}
