/* ============================================================
   AYUDA VENEZUELA — estilos
   Diseno sobrio y claro, pensado para una emergencia: legible,
   rapido y usable desde el movil.
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #1b2430;
  --ink-soft: #55606e;
  --line: #e3e7ec;
  --slate: #16202c;
  --slate-2: #243140;

  --amber: #d97706;   /* desaparecido */
  --green: #16a34a;   /* encontrado */
  --blue: #2563eb;    /* ayuda / rescate */
  --gray: #6b7280;    /* objeto / otro */
  --red: #dc2626;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,32,44,.06), 0 8px 24px rgba(16,32,44,.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 18px; }

/* ---------- Cabecera ---------- */
.site-header {
  background: var(--slate);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 60px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; letter-spacing: -.02em; color: #fff; font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(217,119,6,.25); }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.linklike {
  color: #cdd6e0; padding: 8px 12px; border-radius: 8px; font-size: .95rem; font-weight: 500;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav button.linklike:hover { background: var(--slate-2); color: #fff; text-decoration: none; }
.nav a.active { color: #fff; background: var(--slate-2); }
.nav .me { color: #9fb0c0; font-size: .9rem; padding: 8px 4px; }

.menu-toggle { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.6rem; cursor: pointer; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--amber); color: #fff; border: 0; border-radius: 10px;
  padding: 11px 18px; font-weight: 600; font-size: .98rem; cursor: pointer;
  font-family: inherit; transition: filter .15s ease;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.secondary { background: var(--slate); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(160deg, var(--slate) 0%, #0f1820 100%);
  color: #fff; padding: 54px 0 64px;
}
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); margin: 0 0 12px; letter-spacing: -.02em; line-height: 1.15; }
.hero p.lead { color: #c4cdd7; font-size: 1.08rem; max-width: 640px; margin: 0 0 26px; }
.hero .stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 30px; }
.hero .stat .num { font-size: 1.9rem; font-weight: 800; }
.hero .stat .lbl { color: #9fb0c0; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }

.searchbar {
  display: flex; gap: 8px; background: #fff; padding: 8px; border-radius: 14px;
  box-shadow: var(--shadow); max-width: 620px;
}
.searchbar input {
  flex: 1; border: 0; outline: none; font-size: 1rem; padding: 10px 12px; color: var(--ink);
  font-family: inherit; background: transparent;
}

/* ---------- Tarjetas y secciones ---------- */
.section { padding: 40px 0; }
.section h2 { font-size: 1.5rem; margin: 0 0 6px; letter-spacing: -.01em; }
.section .sub { color: var(--ink-soft); margin: 0 0 22px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card .meta { color: var(--ink-soft); font-size: .85rem; margin-bottom: 8px; }
.card p { margin: 8px 0 0; color: var(--ink-soft); font-size: .92rem; }

/* Etiquetas de tipo */
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; color: #fff;
}
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.85); }
.tag.desaparecido { background: var(--amber); }
.tag.encontrado { background: var(--green); }
.tag.ayuda { background: var(--blue); }
.tag.objeto, .tag.otro { background: var(--gray); }
.tag.resuelto { background: #334155; }
.tag.ia { background: #7c3aed; }

/* Aviso */
.notice {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  border-radius: 10px; padding: 12px 14px; font-size: .9rem; margin: 16px 0;
}
.notice.info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.error-box { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: .9rem; }
.ok-box { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: .9rem; }

/* ---------- Formularios ---------- */
.form { max-width: 480px; margin: 0 auto; }
.form.wide { max-width: 720px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: .82rem; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 1rem; font-family: inherit; color: var(--ink); background: #fff;
}
textarea { resize: vertical; min-height: 90px; }
.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radios label {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; font-weight: 500; flex: 1; min-width: 130px;
}
.radios input { width: auto; }
.radios label.sel { border-color: var(--amber); background: #fff7ed; }

/* ---------- Mapa ---------- */
.map-layout { display: grid; grid-template-columns: 320px 1fr; gap: 0; height: calc(100vh - 60px); }
.map-sidebar { background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; padding: 16px; }
#map { height: 100%; width: 100%; z-index: 1; }
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; margin-top: 12px; }
.legend .row { display: flex; align-items: center; gap: 8px; }
.legend .swatch { width: 12px; height: 12px; border-radius: 50%; }

.result-item { padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.result-item:hover { background: #fafbfc; }
.result-item h4 { margin: 0 0 3px; font-size: .95rem; }
.result-item .meta { font-size: .8rem; color: var(--ink-soft); }

/* Selector de ubicacion en el formulario */
#picker-map { height: 320px; border-radius: 10px; border: 1px solid var(--line); }

/* ---------- Asistente flotante ---------- */
.assistant-btn {
  position: fixed; right: 20px; bottom: 20px; z-index: 2000;
  background: var(--blue); color: #fff; border: 0; border-radius: 999px;
  padding: 14px 18px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow);
  font-family: inherit; display: flex; align-items: center; gap: 8px;
}
.assistant-panel {
  position: fixed; right: 20px; bottom: 84px; z-index: 2000; width: min(380px, calc(100vw - 40px));
  height: min(540px, calc(100vh - 130px)); background: #fff; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 20px 50px rgba(16,32,44,.25); display: none; flex-direction: column; overflow: hidden;
}
.assistant-panel.open { display: flex; }
.assistant-head { background: var(--slate); color: #fff; padding: 14px 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.assistant-head .x { background: none; border: 0; color: #cdd6e0; font-size: 1.3rem; cursor: pointer; }
.assistant-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; }
.msg { padding: 10px 12px; border-radius: 12px; font-size: .92rem; max-width: 85%; white-space: pre-wrap; }
.msg.user { background: var(--blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 3px; }
.msg.bot { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 3px; }
.msg.bot a { word-break: break-all; }
.assistant-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.assistant-input input { flex: 1; }
.assistant-input button { background: var(--blue); }

/* ---------- Pie ---------- */
.footer { background: var(--slate); color: #9fb0c0; padding: 28px 0; margin-top: 40px; font-size: .88rem; }
.footer a { color: #c4cdd7; }

.muted { color: var(--ink-soft); }
.center { text-align: center; }
.spacer { height: 18px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #cbd5e1; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--slate-2); flex-direction: column; padding: 8px; }
  .nav.show { display: flex; }
  .nav a, .nav button.linklike { width: 100%; text-align: left; }
  .map-layout { grid-template-columns: 1fr; height: auto; }
  .map-sidebar { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  #map { height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============================================================
   Pagina de detalle, coincidencias y respuestas
   ============================================================ */
.container.narrow { max-width: 760px; }
.hidden { display: none !important; }
.back-link { color: var(--ink-soft); font-size: .92rem; }
.spacer { height: 14px; }

.detail-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 28px;
}
.detail-card h1 { font-size: 1.5rem; margin: 10px 0 6px; line-height: 1.25; }
.detail-card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-desc { white-space: pre-wrap; margin: 14px 0; }
.owner-controls { margin-top: 14px; }

/* Coincidencias */
.match-card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--gray); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; color: var(--ink);
}
.match-card:hover { text-decoration: none; box-shadow: var(--shadow); }
.match-card.alta  { border-left-color: var(--green); }
.match-card.media { border-left-color: var(--amber); }
.match-card.baja  { border-left-color: var(--gray); }
.match-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .82rem; }
.match-rel { font-weight: 600; color: var(--ink); }
.match-band { color: var(--ink-soft); }
.match-title { margin: 6px 0 2px; }
.match-reasons { font-size: .82rem; color: var(--ink-soft); margin-top: 4px; }

.ai-matches { margin-top: 12px; }
.ai-match { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.ai-match.yes { background: #f0fdf4; border-color: #bbf7d0; }
.ai-match.no  { background: #f8fafc; }

/* Respuestas */
#responses-block { margin-top: 30px; }
#responses-block .count { color: var(--ink-soft); font-weight: 500; font-size: 1rem; }
.response {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
}
.response-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.resp-author { font-weight: 600; }
.response-body { white-space: pre-wrap; }
.resp-kind {
  font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px; color: #fff; background: var(--gray);
}
.resp-kind.visto   { background: var(--amber); }
.resp-kind.asalvo  { background: var(--green); }
.resp-kind.contacto{ background: var(--blue); }

.response-form {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-top: 12px;
}
.response-form label { display: block; font-weight: 600; font-size: .9rem; margin: 8px 0 4px; }
.response-form select, .response-form textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font-family: var(--font); font-size: 1rem; color: var(--ink);
}
.response-form textarea { resize: vertical; }
.response-form .btn { margin-top: 12px; }
.mini-note { font-size: .8rem; color: var(--ink-soft); margin: 10px 0 0; }
.result-link { display: inline-block; margin-top: 6px; font-size: .85rem; }

/* Botones de eliminar */
.btn.danger { background: var(--red); }
.admin-controls { margin-top: 10px; }
.danger-link { color: var(--red); font-size: .85rem; background: none; border: 0; cursor: pointer; padding: 0; text-decoration: underline; }
.danger-link:hover { filter: brightness(.9); }
