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

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background: #f4f6f9;
  color: #222;
  line-height: 1.5;
}

/* ============ HEADER ============ */
header {
  background: #1e6091;
  color: white;
  padding: 16px 12px;
  text-align: center;
}
header h1 {
  margin: 0;
  font-size: 1.4rem;
}
header p {
  margin: 4px 0 12px;
  opacity: .9;
  font-size: 0.85rem;
}
header nav {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}
header nav a, header nav span {
  color: white;
  text-decoration: none;
  padding: 8px 14px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  font-size: 0.9rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
header nav a:hover, header nav a:active {
  background: rgba(255,255,255,.3);
}

/* ============ MAIN ============ */
main {
  max-width: 1100px;
  margin: 16px auto;
  padding: 0 12px;
}

/* ============ FILTROS ============ */
#filtros {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
#filtros select {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  background: white;
  font-size: 1rem;
  width: 100%;
  min-height: 44px;
}

/* ============ LISTA DE TARJETAS ============ */
#lista {
  display: grid;
  grid-template-columns: 1fr;      /* 1 columna en celular */
  gap: 12px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  letter-spacing: .5px;
}
.badge.busco { background: #e76f51; }
.badge.ofrezco { background: #2a9d8f; }

.card .monto {
  font-size: 1.4rem;
  font-weight: bold;
  color: #1e6091;
}
.card .servicios span {
  font-size: 0.75rem;
  background: #eef;
  padding: 4px 8px;
  border-radius: 6px;
  margin: 2px;
  display: inline-block;
}
.card .fotos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.card .fotos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
}
.card .contacto {
  font-size: 0.9rem;
  color: #555;
  word-break: break-word;
}
.card form { margin: 0; }
.card button.eliminar {
  background: #dc3545;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  width: auto;
  min-height: 40px;
}

/* ============ FORMULARIOS ============ */
.form-container {
  max-width: 600px;
  margin: 16px auto;
  background: white;
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.form-container h2 {
  margin-top: 0;
  font-size: 1.3rem;
}
.form-container label {
  display: block;
  margin-top: 14px;
  font-weight: 600;
  font-size: 0.95rem;
}
.form-container input,
.form-container select,
.form-container textarea {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;   /* importante: >=16px evita zoom en iOS */
  min-height: 44px;
}
.form-container textarea { min-height: 80px; resize: vertical; }

.form-container fieldset {
  border: 1px solid #ddd;
  border-radius: 10px;
  margin-top: 14px;
  padding: 10px;
}
.form-container fieldset legend {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0 6px;
}
.form-container fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-weight: normal;
  font-size: 0.95rem;
}
.form-container fieldset input[type=checkbox] {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
}
.form-container button {
  margin-top: 18px;
  width: 100%;
  padding: 14px;
  background: #1e6091;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}
.form-container button:hover { background: #164a72; }

.error {
  color: #dc3545;
  font-size: 0.9rem;
  margin-top: 10px;
}

/* ============ TABLET (≥ 600px) ============ */
@media (min-width: 600px) {
  header { padding: 20px; }
  header h1 { font-size: 1.7rem; }
  main { padding: 0 16px; }
  #filtros { grid-template-columns: repeat(3, 1fr); }
  .form-container { padding: 24px; }
}

/* ============ DESKTOP (≥ 900px) ============ */
@media (min-width: 900px) {
  #lista {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
  }
  header h1 { font-size: 2rem; }
  header p { font-size: 0.95rem; }
}
/* ============ GALERÍA DE FOTOS GRANDES ============ */
.card .fotos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 8px 0;
}
.card .fotos .foto-link {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #eee;
}
.card .fotos img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}
.card .fotos .foto-link:active img { transform: scale(1.02); }
.card .fotos .foto-link::after {
  content: "🔍 Ver";
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,.6);
  color: white;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  pointer-events: none;
}
@media (min-width: 600px) {
  .card .fotos { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .card .fotos { grid-template-columns: repeat(3, 1fr); }
  .card .fotos img { aspect-ratio: 4 / 3; max-height: none; }
}

/* ============ BOTÓN WHATSAPP ============ */
.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #25D366;
  color: white;
  text-decoration: none;
  padding: 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  margin-top: 8px;
  min-height: 48px;
  transition: background .15s;
}
.btn-whatsapp:hover,
.btn-whatsapp:active { background: #1ebe5b; color: white; }