/* SAFIR · vistas de autenticación (login y registro): ventana flotante sobre fondo decorativo. */
:root {
  --indigo: #252866; --lav: #7775D6; --lav-soft: #E9E7FF; --warm: #FFFCF7; --carbon: #292936;
  --bg: var(--warm); --soft: var(--lav-soft); --text: var(--carbon); --title: var(--indigo);
  --muted: #5b5b72; --line: #E3E0F7; --btn: var(--indigo); --btn-text: #fff; --link: var(--indigo); --outline: var(--lav);
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #12142E; --soft: #181B3A; --text: #D9D9E8; --title: #F1F0FF; --muted: #A5A6C4;
  --line: #2C3060; --btn: #7775D6; --btn-text: #12142E; --link: #B9B7F5;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 1.0625rem; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow: hidden; }
h2 { font-weight: 300; color: var(--title); margin: 0; line-height: 1.1; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--lav); outline-offset: 3px; border-radius: 6px; }

/* Fondo decorativo que queda detrás de la ventana */
.backdrop { position: fixed; inset: 0; overflow: hidden; }
.backdrop::before {
  content: ""; position: absolute; width: 820px; height: 820px; border-radius: 50%; top: 50%; right: -230px; transform: translateY(-50%);
  background: radial-gradient(circle, var(--soft) 0%, var(--soft) 34%, transparent 68%);
}
.backdrop::after {
  content: ""; position: absolute; width: 540px; height: 540px; border-radius: 50%; left: -210px; bottom: -280px;
  background: repeating-radial-gradient(circle, transparent 0 34px, var(--line) 34px 35.5px);
  -webkit-mask-image: radial-gradient(circle, #000 22%, transparent 70%); mask-image: radial-gradient(circle, #000 22%, transparent 70%);
}
.bg-plane { position: absolute; left: 8%; top: 14%; width: min(360px, 42vw); }
.bg-plane svg { width: 100%; height: auto; overflow: visible; animation: drift 7s ease-in-out infinite; }
.bg-moon { position: absolute; right: 9%; bottom: 12%; width: min(190px, 26vw); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, #F6F5FF, #DAD8F8 60%, #B9B6EE); box-shadow: 0 0 70px 14px rgba(203,201,244,.5); }
:root[data-theme="dark"] .bg-moon { opacity: .75; }
@keyframes drift { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(-1.5deg); } }

/* Ventana flotante */
.overlay {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center;
  padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem max(1rem, env(safe-area-inset-bottom, 0px));
  background: rgba(18,20,46,.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fadeIn .25s ease;
}
.modal {
  position: relative; width: min(430px, 100%); max-height: 100%; overflow-y: auto;
  padding: 2.2rem 1.9rem 1.8rem; border-radius: 26px; color: var(--text);
  background: rgba(255,252,247,.82); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.65); box-shadow: 0 30px 80px -20px rgba(18,20,46,.6);
  animation: rise .3s cubic-bezier(.2,.8,.2,1);
}
:root[data-theme="dark"] .modal { background: rgba(29,32,66,.82); border-color: rgba(119,117,214,.4); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.close {
  position: absolute; top: .9rem; right: .9rem; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(119,117,214,.15); color: var(--title); font: 400 1.5rem/1 var(--sans); text-decoration: none;
}
.close:hover { background: rgba(119,117,214,.3); }
.m-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1.1rem; }
.m-brand svg { width: 48px; height: 36px; }
.m-brand .dk { display: none; }
:root[data-theme="dark"] .m-brand .lt { display: none; }
:root[data-theme="dark"] .m-brand .dk { display: block; }
.m-brand span { font: 500 1.3rem/1 var(--sans); letter-spacing: .28em; color: var(--title); }
.modal h2 { font-size: 1.9rem; text-align: center; }
.m-sub { text-align: center; color: var(--muted); margin-top: .4rem; font-size: .98rem; }
form { margin-top: 1.2rem; }
label { display: block; margin: 1rem 0 .35rem; font-size: .92rem; font-weight: 500; color: var(--title); }
input {
  width: 100%; font: inherit; font-size: 1rem; padding: .85rem 1rem; border-radius: 12px;
  border: 1.5px solid var(--line); background: rgba(255,255,255,.75); color: var(--text);
}
:root[data-theme="dark"] input { background: rgba(18,20,46,.6); }
input::placeholder { color: #8b8ba3; }
input:focus { outline: none; border-color: var(--lav); box-shadow: 0 0 0 3px rgba(119,117,214,.28); }
.pw { position: relative; }
.pw input { padding-right: 5.2rem; }
.pw-toggle { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--link); font: 500 .88rem var(--sans); cursor: pointer; padding: .4rem .6rem; border-radius: 8px; }
.form-msg { min-height: 1.4em; margin-top: .8rem; font-size: .92rem; color: var(--muted); }
.form-msg.err { color: #B3261E; }
:root[data-theme="dark"] .form-msg.err { color: #FF9C94; }
.form-msg.ok { color: var(--title); font-weight: 500; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; margin-top: .6rem; padding: 1rem;
  font: 500 1rem/1 var(--sans); border-radius: 999px; border: 1.5px solid transparent;
  background: var(--btn); color: var(--btn-text); cursor: pointer; transition: transform .15s;
}
.btn:hover { transform: translateY(-1px); }
.m-switch { margin-top: 1.3rem; text-align: center; font-size: .95rem; color: var(--muted); }
.m-switch a { font-weight: 600; color: var(--link); text-underline-offset: 3px; }

.bonus { display: flex; align-items: center; gap: .9rem; margin-top: 1.2rem; padding: .9rem 1rem; border-radius: 16px;
  background: rgba(242,184,75,.18); border: 1px solid rgba(242,184,75,.55); color: var(--title); font-size: .95rem; line-height: 1.45; }
.bonus .coin { width: 44px; height: 44px; border-radius: 50%; background: #F2B84B; color: #B8832A; display: grid; place-items: center;
  font: 500 1.2rem var(--sans); box-shadow: inset 0 0 0 4px rgba(184,131,42,.25); flex: none; }
.bonus b { font-weight: 600; }
.bonus + form { margin-top: .4rem; }
@media (prefers-reduced-motion: reduce) { .overlay, .modal, .bg-plane svg { animation: none; } }

/* ---- Extras para registro.jsp ---- */
.m-legal { margin-top: 1rem; font-size: .82rem; color: var(--muted); text-align: center; }
.hint { display: block; margin-top: .3rem; font-size: .82rem; color: var(--muted); }
input[type="file"] { padding: .6rem .8rem; font-size: .92rem; cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: .8rem; padding: .4rem .9rem; border: 0; border-radius: 999px;
  background: var(--soft); color: var(--title); font: 500 .88rem var(--sans); cursor: pointer;
}
.modal .m-switch + .m-legal { margin-top: .8rem; }

/* ---- Registro con verificación: seguridad de contraseña y código ---- */
.strength { display: flex; align-items: center; gap: .7rem; margin-top: .55rem; }
.strength-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .2s, background .2s; }
.strength-bar span.n0 { width: 33%; background: #B3261E; }
.strength-bar span.n1 { width: 66%; background: #D18A00; }
.strength-bar span.n2 { width: 100%; background: #1E7A46; }
.strength-label { font-size: .82rem; color: var(--muted); min-width: 8.5rem; text-align: right; }
.reglas { list-style: none; margin: .5rem 0 0; padding: 0; font-size: .82rem; color: var(--muted); }
.reglas li::before { content: "○ "; }
.reglas li.ok { color: #1E7A46; }
.reglas li.ok::before { content: "✓ "; }
.reglas li.no { color: #B3261E; }
.reglas li.no::before { content: "✗ "; }
.codigo { text-align: center; font-size: 1.8rem; letter-spacing: .5em; padding-left: 1.2em; font-variant-numeric: tabular-nums; }
.form-msg.ok-info { color: #1E7A46; }
.btn.ghost { background: transparent; color: var(--link); border-color: var(--line); margin-top: .5rem; }

/* ---- Ventana de fotos tras el registro ---- */
.prev { position: relative; margin-top: 1.2rem; margin-bottom: 2.6rem; }
.prev-portada, .prev-avatar { background: var(--soft) center / cover no-repeat; color: var(--muted); display: grid; place-items: center; font-size: .85rem; }
.prev-portada { height: 120px; border-radius: 16px; border: 1.5px dashed var(--line); }
.prev-avatar { position: absolute; left: 1.1rem; bottom: -2rem; width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--bg); box-shadow: 0 4px 14px rgba(18,20,46,.25); }

/* Inicio de sesión con redes sociales */
.social { margin-top: 1.2rem; display: grid; gap: .6rem; }
.social-sep { display: flex; align-items: center; gap: .8rem; font-size: .85rem; color: var(--muted); }
.social-sep::before, .social-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-social { display: flex; align-items: center; justify-content: center; padding: .85rem 1rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: rgba(255,255,255,.75); color: var(--title); font: 500 .98rem var(--sans); text-decoration: none; }
:root[data-theme="dark"] .btn-social { background: rgba(18,20,46,.6); }
.btn-social:hover { border-color: var(--lav); }
.social-legal { font-size: .8rem; color: var(--muted); text-align: center; }