* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(160deg, #1e3a8a 0%, #2563eb 55%, #38bdf8 100%);
  color: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

.card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 22px;
  padding: 34px 24px 28px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.3);
}

/* ---------- Logotipo ---------- */
.logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; text-align: center; }
.logo svg { width: 92px; height: 92px; margin-bottom: 12px; }
.logo h1 { font-size: 1.5rem; font-weight: 700; color: #1e3a8a; }
.logo p { font-size: 0.95rem; color: #6b7280; margin-top: 4px; }

/* ---------- Formulario ---------- */
.field { margin-bottom: 18px; }
label { display: block; font-size: 0.9rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-wrap .icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; color: #9ca3af; pointer-events: none;
}
input {
  width: 100%; height: 52px;
  font-size: 16px; /* evita el zoom automático en iPhone */
  padding: 0 48px 0 44px;
  border: 1.5px solid #d1d5db; border-radius: 12px;
  background: #f9fafb; color: #111827; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus { border-color: #2563eb; background: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,.15); }
input.invalid { border-color: #dc2626; }

.toggle-pass {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border: none; background: transparent; color: #6b7280;
  border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.toggle-pass svg { width: 22px; height: 22px; }
.error { color: #dc2626; font-size: 0.82rem; margin-top: 5px; min-height: 1em; }

/* ---------- Botones ---------- */
.btn {
  width: 100%; height: 54px; margin-top: 6px;
  border: none; border-radius: 12px;
  background: linear-gradient(90deg, #1e40af, #2563eb);
  color: #fff; font-size: 1.05rem; font-weight: 700; letter-spacing: .5px;
  cursor: pointer; box-shadow: 0 8px 18px rgba(37,99,235,.35);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .7; }
.btn[hidden] { display: none; }
.btn-secondary { background: #f3f4f6; color: #1e3a8a; box-shadow: none; margin-top: 12px; }

.spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite; display: none;
}
.spinner.dark { border-color: rgba(37,99,235,.25); border-top-color: #2563eb; }
.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.message { margin-top: 16px; text-align: center; font-size: .95rem; font-weight: 600; min-height: 1.2em; }
.message.ok, .status.ok { color: #16a34a; }
.message.fail, .status.fail { color: #dc2626; }
.footer { text-align: center; font-size: .8rem; color: #9ca3af; margin-top: 22px; }

/* ---------- Página de ubicación ---------- */
.status {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  text-align: center; font-weight: 600; color: #374151;
  background: #f3f4f6; border-radius: 12px; padding: 14px; margin-bottom: 16px;
}
.status.ok { background: #f0fdf4; }
.status.fail { background: #fef2f2; }

.coords { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.coords[hidden] { display: none; }
.coords div { background: #eff6ff; border-radius: 10px; padding: 10px 6px; text-align: center; }
.coords span { display: block; font-size: .72rem; color: #6b7280; text-transform: uppercase; }
.coords strong { font-size: .9rem; color: #1e3a8a; word-break: break-all; }

.map { border-radius: 14px; overflow: hidden; height: 220px; margin-bottom: 10px; border: 1px solid #e5e7eb; }
.map[hidden] { display: none; }
.map iframe { width: 100%; height: 100%; border: 0; }
.maplink { display: block; text-align: center; color: #2563eb; font-weight: 600; text-decoration: none; margin-bottom: 14px; }
.maplink[hidden] { display: none; }
