/* ===== Gatitos Las Victorias — Rediseño "Refugio" =====
   Cálido y amable, pero más pulido. Coral + crema, iconos SVG, formas redondeadas.
   Para cambiar de paleta más adelante, tocá solo el bloque :root de abajo. */

:root {
  /* Superficies y tinta */
  --bg: #FBF4EA;
  --surface: #FFFFFF;
  --surface-2: #FFF8EF;
  --ink: #241D16;
  --ink-soft: #6C6258;
  --muted: #9D9389;
  --line: rgba(36, 29, 22, 0.08);

  /* Marca (acción principal) */
  --brand: #EE6C4D;
  --brand-press: #DC5A3C;
  --brand-ink: #FFFFFF;
  --brand-soft: #FCE7DF;

  /* Estados */
  --perdido: #E5484D;     --perdido-soft: #FBE4E4;
  --hallado: #2F6FB5;     --hallado-soft: #E3EDF8;
  --encontrado: #3AA76D;  --encontrado-soft: #E1F2E9;
  --sin_vida: #6B6660;    --sin_vida-soft: #ECEAE7;

  /* Forma y sombra */
  --radio: 22px;
  --radio-sm: 14px;
  --radio-xs: 11px;
  --sombra: 0 8px 24px rgba(36, 29, 22, 0.10);
  --sombra-sm: 0 3px 10px rgba(36, 29, 22, 0.07);
  --sombra-brand: 0 10px 22px rgba(238, 108, 77, 0.36);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 900; letter-spacing: -0.02em; }

/* Iconos SVG inline: heredan color y tamaño del contexto */
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
.ico svg { width: 100%; height: 100%; display: block; }

/* ===== Topbar ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: env(safe-area-inset-top) 12px 0;
  pointer-events: none;
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  margin-top: 10px;
  background: var(--surface);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  pointer-events: auto;
}
.topbar-title .logo {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: var(--radio-sm);
  background: var(--brand);
  color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.topbar-title > div { flex: 1; min-width: 0; }
.topbar h1 {
  font-size: 16.5px; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar p { margin: 2px 0 0; font-size: 11.5px; font-weight: 700; color: var(--muted); }

/* ===== Chips de filtro ===== */
.chips {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 78px);
  left: 0; right: 0;
  z-index: 1000;
  display: flex;
  gap: 8px;
  padding: 4px 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: none;
  padding: 9px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--sombra-sm);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.chip:active { transform: scale(0.94); }
.chip-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.chip-perdido    .chip-dot { background: var(--perdido); }
.chip-hallado    .chip-dot { background: var(--hallado); }
.chip-encontrado .chip-dot { background: var(--encontrado); }
.chip-sin_vida   .chip-dot { background: var(--sin_vida); }

.chip.is-active { color: #fff; box-shadow: none; }
.chip.is-active .chip-dot { background: #fff; }
.chip.is-active.chip-todos      { background: var(--brand); }
.chip.is-active.chip-perdido    { background: var(--perdido); }
.chip.is-active.chip-hallado    { background: var(--hallado); }
.chip.is-active.chip-encontrado { background: var(--encontrado); }
.chip.is-active.chip-sin_vida   { background: var(--sin_vida); }

/* ===== Mapa ===== */
#map { position: fixed; inset: 0; z-index: 1; background: var(--surface-2); }
.leaflet-container { background: var(--surface-2); font-family: inherit; }
.cat-pin svg { filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.28)); }

/* ===== Vista lista ===== */
.lista {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 132px) 14px 110px;
}
.lista-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; padding: 0 2px; }
.lista-titulo { font-size: 22px; }
.lista-count { font-size: 13px; font-weight: 800; color: var(--muted); }
.lista-cards { display: grid; gap: 12px; }
.lista-vacio { text-align: center; padding: 50px 20px; color: var(--muted); }
.lista-vacio .ico { font-size: 46px; }
.lista-vacio p { font-weight: 700; font-size: 14px; margin-top: 10px; }

.card {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--surface);
  border: none;
  text-align: left;
  width: 100%;
  border-radius: var(--radio);
  box-shadow: var(--sombra-sm);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.card:active { transform: scale(0.98); }
.card-foto {
  width: 86px; height: 86px;
  border-radius: var(--radio-sm);
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--surface-2);
}
.card-foto.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.card-foto.placeholder svg { width: 1em; height: 1em; display: block; }
.card-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
.card-body > .badge { align-self: flex-start; }
.card-nombre { font-weight: 800; font-size: 16px; line-height: 1.15; }
.card-desc {
  font-size: 13px; font-weight: 600; color: var(--ink-soft); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-fecha {
  margin-top: auto; padding-top: 4px;
  display: flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 11.5px; font-weight: 700;
}
.card-fecha .ico { font-size: 13px; }

/* ===== Badge / píldora de estado ===== */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 800; line-height: 1;
  letter-spacing: -0.01em;
}
.badge .badge-dot { width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; }
.badge.sm { padding: 3px 9px 3px 8px; font-size: 11.5px; }
.badge-perdido    { background: var(--perdido-soft);    color: var(--perdido); }
.badge-hallado    { background: var(--hallado-soft);    color: var(--hallado); }
.badge-encontrado { background: var(--encontrado-soft); color: var(--encontrado); }
.badge-sin_vida   { background: var(--sin_vida-soft);   color: var(--sin_vida); }
.badge-perdido    .badge-dot { background: var(--perdido); }
.badge-hallado    .badge-dot { background: var(--hallado); }
.badge-encontrado .badge-dot { background: var(--encontrado); }
.badge-sin_vida   .badge-dot { background: var(--sin_vida); }

/* ===== FAB ===== */
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 86px);
  z-index: 900;
  width: 58px; height: 58px;
  border: none;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
  line-height: 1;
  box-shadow: var(--sombra-brand);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease;
}
.fab:active { transform: scale(0.9); }
.fab .ico { font-size: 28px; }

/* ===== Bottom nav ===== */
.bottomnav {
  position: fixed;
  left: 14px; right: 14px;
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  z-index: 900;
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  border-radius: 24px;
  padding: 7px 6px;
  box-shadow: var(--sombra);
}
.nav-item {
  border: none;
  background: transparent;
  font-family: inherit;
  font-weight: 800;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 18px;
  border-radius: 16px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-item .nav-ico { font-size: 21px; }
.nav-item.is-active { color: var(--brand); background: var(--brand-soft); }

/* ===== Overlays / sheets ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 16, 12, 0.42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  padding: 20px 18px calc(env(safe-area-inset-bottom) + 26px);
  position: relative;
  animation: slideup 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet::before {
  content: "";
  display: block;
  width: 38px; height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 0 auto 14px;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-title { font-size: 22px; margin-bottom: 14px; padding-right: 30px; }
.sheet-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 34px; height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  box-shadow: var(--sombra-sm);
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.sheet-close .ico { font-size: 17px; }

/* ===== Formularios ===== */
.campo { display: block; margin-bottom: 16px; }
.campo > span {
  display: block;
  font-weight: 800;
  font-size: 13.5px;
  margin-bottom: 8px;
}
.campo > span small { font-weight: 600; color: var(--muted); }
.campo input,
.campo textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: var(--radio-sm);
  padding: 13px 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
}
.campo input::placeholder, .campo textarea::placeholder { color: var(--muted); }
.campo input:focus,
.campo textarea:focus { border-color: var(--brand); }
.campo textarea { resize: vertical; }

.estado-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.estado-opts.grid2 { display: grid; grid-template-columns: 1fr 1fr; }
.estado-btn {
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: var(--radio-sm);
  padding: 10px 13px;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.1s ease, background 0.15s ease;
}
.estado-btn:active { transform: scale(0.94); }
.estado-btn .est-dot { width: 9px; height: 9px; border-radius: 999px; }
.estado-btn[data-status="perdido"]    .est-dot { background: var(--perdido); }
.estado-btn[data-status="hallado"]    .est-dot { background: var(--hallado); }
.estado-btn[data-status="encontrado"] .est-dot { background: var(--encontrado); }
.estado-btn[data-status="sin_vida"]   .est-dot { background: var(--sin_vida); }
.estado-btn.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.estado-btn.is-active .est-dot { background: #fff; }
/* selección coloreada por estado en el formulario nuevo */
#estado-opts .estado-btn.is-active[data-status="perdido"]    { background: var(--perdido);    border-color: var(--perdido); }
#estado-opts .estado-btn.is-active[data-status="hallado"]    { background: var(--hallado);    border-color: var(--hallado); }
#estado-opts .estado-btn.is-active[data-status="encontrado"] { background: var(--encontrado); border-color: var(--encontrado); }
#estado-opts .estado-btn.is-active[data-status="sin_vida"]   { background: var(--sin_vida);   border-color: var(--sin_vida); }

.mini-map {
  height: 188px;
  border-radius: var(--radio-sm);
  overflow: hidden;
  box-shadow: var(--sombra-sm);
  border: 1.5px solid var(--line);
  margin-bottom: 9px;
}
.ubic-row { display: flex; align-items: center; gap: 10px; }
.ubic-info { font-size: 12px; font-weight: 700; color: var(--muted); margin: 0; display: inline-flex; align-items: center; gap: 5px; }
.ubic-info.ok { color: var(--encontrado); }

.foto-drop {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border-radius: var(--radio-sm);
  border: 1.5px dashed var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  cursor: pointer;
}
.foto-drop .foto-ico {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: var(--radio-xs);
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.foto-drop strong { display: block; font-size: 14px; color: var(--ink); }
.foto-drop span { font-size: 12.5px; font-weight: 600; }
.foto-drop input[type="file"] { display: none; }

.preview-foto {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radio-sm);
  margin-top: 10px;
  box-shadow: var(--sombra-sm);
}

/* ===== Botones ===== */
.btn-primario {
  width: 100%;
  border: none;
  background: var(--brand);
  color: var(--brand-ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
  padding: 15px;
  border-radius: var(--radio-sm);
  cursor: pointer;
  box-shadow: var(--sombra-brand);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  transition: transform 0.1s ease, background 0.15s ease;
}
.btn-primario .ico { font-size: 20px; }
.btn-primario:active { transform: scale(0.97); }
.btn-primario:disabled { opacity: 0.6; }

.btn-secundario {
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 14.5px;
  padding: 13px 14px;
  border-radius: var(--radio-sm);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-secundario .ico { font-size: 17px; }

.btn-link {
  width: 100%;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-family: inherit;
  font-weight: 800;
  font-size: 13.5px;
  padding: 8px;
  margin-top: 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-link .ico { font-size: 16px; }
.btn-borrar {
  width: 100%;
  margin-top: 10px;
  border: none;
  background: transparent;
  color: var(--perdido);
  font-family: inherit;
  font-weight: 800;
  font-size: 13.5px;
  padding: 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}

/* ===== Detalle ===== */
.detalle-foto {
  width: 100%;
  max-height: 228px;
  object-fit: cover;
  border-radius: var(--radio);
  background: var(--surface-2);
}
.detalle-foto.placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 150px; font-size: 60px;
}
.detalle-foto.placeholder svg { width: 1em; height: 1em; display: block; }
.detalle-nombre { font-size: 25px; margin: 10px 0 4px; }
.detalle-meta {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 12.5px; font-weight: 700; margin-bottom: 14px;
}
.detalle-meta .ico { font-size: 14px; }
.detalle-desc {
  font-weight: 600; font-size: 14.5px; line-height: 1.5; color: var(--ink);
  background: var(--surface); border-radius: var(--radio-sm); padding: 14px;
  box-shadow: var(--sombra-sm);
}
.detalle-datos { display: flex; gap: 10px; margin-top: 12px; }
.dato {
  flex: 1;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radio-sm);
  padding: 11px 12px;
}
.dato-et {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 11.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.dato-et .ico { font-size: 14px; }
.dato-val { font-weight: 800; font-size: 15px; margin-top: 3px; }

.contacto { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.btn-wsp {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  background: var(--encontrado);
  color: #fff;
  font-weight: 800; font-size: 16px;
  padding: 15px;
  border-radius: var(--radio-sm);
}
.btn-wsp .ico { font-size: 19px; }
.sin-tel {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: var(--radio-sm);
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  color: var(--ink-soft);
  font-size: 13.5px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}

/* ===== Código ===== */
.codigo-exito { text-align: center; margin-bottom: 6px; }
.codigo-check {
  width: 60px; height: 60px; border-radius: 999px;
  background: var(--encontrado-soft); color: var(--encontrado);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 34px; margin-bottom: 10px;
}
.codigo-texto { color: var(--ink-soft); font-size: 14px; font-weight: 600; line-height: 1.5; text-align: center; margin: 4px 0 14px; }
.codigo-box {
  display: flex; gap: 8px; align-items: center;
  background: var(--surface); border-radius: var(--radio-sm); padding: 12px 14px;
  box-shadow: var(--sombra-sm); margin: 0 0 12px;
}
.codigo-box code {
  flex: 1;
  font-size: 20px; font-weight: 800;
  letter-spacing: 0.12em;
  font-family: ui-monospace, "Courier New", monospace;
}
.codigo-box .btn-copiar {
  border: none; cursor: pointer;
  background: var(--brand); color: #fff;
  font-family: inherit; font-weight: 800; font-size: 13px;
  padding: 9px 13px; border-radius: var(--radio-xs);
  display: inline-flex; align-items: center; gap: 6px;
}
.aviso {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 12.5px; font-weight: 700; line-height: 1.4;
  background: var(--brand-soft); color: var(--brand-press);
  border-radius: var(--radio-sm); padding: 12px 14px;
  margin: 0 0 16px;
}
.aviso .ico { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.codigo-acciones { display: grid; gap: 9px; margin: 0 0 16px; }
.codigo-acciones .btn-secundario { width: 100%; text-decoration: none; }

/* ===== Autor e historial en el detalle ===== */
.detalle-autor {
  display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 700; color: var(--ink-soft);
  margin: 8px 0 0;
}
.detalle-autor .ico { font-size: 16px; color: var(--brand); }
.historial { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.historial-tit {
  display: flex; align-items: center; gap: 7px;
  font-weight: 800; font-size: 15px; margin-bottom: 10px;
}
.historial-tit .ico { font-size: 17px; color: var(--ink-soft); }
.hist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hist-item { display: flex; gap: 10px; align-items: flex-start; }
.hist-dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--brand); margin-top: 4px; flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.hist-txt { font-size: 14px; font-weight: 600; line-height: 1.4; }
.hist-txt em { font-style: normal; font-weight: 800; }
.hist-fecha { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 1px; }

/* ===== Info ===== */
.info-list { display: grid; gap: 8px; margin: 14px 0; padding: 0; list-style: none; }
.info-list li {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border-radius: var(--radio-sm);
  padding: 11px 13px; box-shadow: var(--sombra-sm);
}
.info-ico {
  width: 34px; height: 34px; border-radius: 999px; flex-shrink: 0;
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.info-ico.perdido    { background: var(--perdido); }
.info-ico.hallado    { background: var(--hallado); }
.info-ico.encontrado { background: var(--encontrado); }
.info-ico.sin_vida   { background: var(--sin_vida); }
.info-list strong { display: block; font-size: 14px; }
.info-list small { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.info-texto { color: var(--ink-soft); font-size: 14px; font-weight: 600; line-height: 1.55; }
.info-texto strong { color: var(--ink); }
.info-aviso {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--radio-sm); padding: 12px 14px; margin-top: 8px;
  color: var(--ink-soft); font-size: 12.5px; font-weight: 700; line-height: 1.45;
}
.info-aviso .ico { font-size: 18px; flex-shrink: 0; margin-top: 1px; color: var(--perdido); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 150px);
  transform: translateX(-50%);
  z-index: 3000;
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
  font-size: 13.5px;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: inline-flex; align-items: center; gap: 8px;
  max-width: 86%;
}
.toast .ico { font-size: 17px; }

.hidden { display: none !important; }
