/* ============================================================
   MiMundoMascota PWA — Estilos principales
   css/app.css
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --purple:    #7F77DD;
  --purple-dk: #26215C;
  --purple-lt: #EEEDFE;
  --purple-md: #534AB7;
  --pink:      #D4537E;
  --pink-lt:   #FBEAF0;
  --amber:     #EF9F27;
  --teal:      #1D9E75;
  --teal-lt:   #E1F5EE;
  --red:       #E24B4A;
  --red-lt:    #FCEBEB;
  --blue-lt:   #E6F1FB;
  --blue:      #185FA5;
  --gray-lt:   #F1EFE8;
  --gray:      #888780;
  --white:     #ffffff;
  --off:       #F8F6FF;
  --text:      #26215C;
  --text-mid:  #534AB7;
  --border:    #CECBF6;
  --nav-h:     56px;
  --bnav-h:    64px;
  --radius:    12px;
  --shadow:    0 2px 12px rgba(127,119,221,0.12);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--off);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
.oculto { display: none !important; }

/* ── Navbar ─────────────────────────────────────────────────── */
#navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h); z-index: 100;
  background: var(--purple-dk);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 16px; font-weight: 700; color: white;
}
.nav-logo span { color: var(--amber); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-icon-btn {
  background: none; border: none; color: #CECBF6;
  font-size: 20px; padding: 4px; line-height: 1;
  position: relative;
}
.nav-badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--red); color: white;
  font-size: 9px; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
#btn-instalar {
  background: var(--amber); color: var(--purple-dk);
  font-size: 12px; font-weight: 700;
  padding: 5px 12px; border-radius: 20px; border: none;
}

/* ── Bottom Nav ─────────────────────────────────────────────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bnav-h); z-index: 100;
  background: white;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 6px 12px;
  font-size: 10px; color: var(--gray);
  background: none; border: none;
  transition: color 0.2s;
  flex: 1;
}
.bn-item.active { color: var(--purple); }
.bn-icon { font-size: 22px; line-height: 1; }
.bn-sos {
  background: var(--red); color: white !important;
  border-radius: 50%; width: 48px; height: 48px;
  padding: 0; justify-content: center;
  box-shadow: 0 4px 12px rgba(226,75,74,0.4);
  margin-bottom: 8px;
}
.bn-sos .bn-icon { font-size: 20px; }

/* ── Contenido principal ────────────────────────────────────── */
#main-content {
  padding-top: calc(var(--nav-h) + 8px);
  padding-bottom: calc(var(--bnav-h) + 8px);
  min-height: 100vh;
}
.pantalla { min-height: calc(100vh - var(--nav-h) - var(--bnav-h)); }

/* ── Pantalla de bienvenida ─────────────────────────────────── */
#pantalla-bienvenida {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 24px; text-align: center;
  background: var(--purple);
}
.bienvenida-logo { font-size: 72px; margin-bottom: 16px; }
.bienvenida-marca {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 28px; font-weight: 700; color: white;
  margin-bottom: 8px;
}
.bienvenida-marca span { color: var(--amber); }
.bienvenida-sub { font-size: 14px; color: #CECBF6; margin-bottom: 32px; line-height: 1.6; }
.bienvenida-btns { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }

/* ── Formularios auth ───────────────────────────────────────── */
#pantalla-login, #pantalla-registro {
  min-height: 100vh;
  display: flex; flex-direction: column;
  justify-content: center; padding: 32px 24px;
  background: var(--off);
}
.auth-back {
  background: none; border: none; color: var(--purple);
  font-size: 14px; margin-bottom: 24px; padding: 0;
  display: flex; align-items: center; gap: 6px;
}
.auth-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 26px; font-weight: 700; color: var(--text);
  margin-bottom: 6px;
}
.auth-sub { font-size: 13px; color: var(--gray); margin-bottom: 28px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--purple-md); margin-bottom: 5px; }
.input-field {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; color: var(--text); background: white;
  outline: none; transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--purple); }
select.input-field { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237F77DD' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea.input-field { resize: vertical; min-height: 80px; }

/* ── Botones ─────────────────────────────────────────────────── */
.btn-primary {
  display: block; width: 100%;
  background: var(--purple); color: white;
  font-size: 14px; font-weight: 700;
  padding: 13px; border-radius: 10px; border: none;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline {
  display: block; width: 100%;
  background: transparent; color: var(--purple);
  font-size: 14px; font-weight: 700;
  padding: 12px; border-radius: 10px;
  border: 1.5px solid var(--purple);
}
.btn-sm { width: auto; padding: 7px 14px; font-size: 12px; border-radius: 8px; }

/* ── Chips / filtros ─────────────────────────────────────────── */
#filtros-feed {
  display: flex; gap: 8px; padding: 10px 16px;
  overflow-x: auto; scrollbar-width: none;
  background: white; border-bottom: 1px solid var(--border);
  position: sticky; top: var(--nav-h); z-index: 10;
}
#filtros-feed::-webkit-scrollbar { display: none; }
.chip {
  white-space: nowrap; padding: 6px 14px;
  border-radius: 20px; border: 1px solid var(--border);
  background: white; font-size: 12px; font-weight: 500;
  color: var(--gray); cursor: pointer; transition: all 0.15s;
}
.chip.active { background: var(--purple); color: white; border-color: var(--purple); }

/* ── Feed cards ─────────────────────────────────────────────── */
#contenido-feed { padding: 8px 0; }
.feed-card {
  background: white; border-bottom: 1px solid #F0EEF8;
  padding: 14px 16px; margin-bottom: 4px;
}
.fc-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fc-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.fc-info { flex: 1; min-width: 0; }
.fc-name { font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fc-meta { font-size: 11px; color: var(--gray); margin-top: 2px; }
.fc-body { font-size: 13px; color: var(--text-mid); line-height: 1.6; margin-bottom: 10px; }
.fc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fc-btn {
  font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: white;
  color: var(--text-mid); transition: all 0.15s;
}
.fc-btn:hover { border-color: var(--purple); color: var(--purple); }
.btn-sos { background: var(--red-lt) !important; color: var(--red) !important; border-color: transparent !important; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 10px;
}
.badge-red   { background: var(--red-lt);  color: #A32D2D; }
.badge-teal  { background: var(--teal-lt); color: #0F6E56; }
.badge-pink  { background: var(--pink-lt); color: #993556; }
.badge-blue  { background: var(--blue-lt); color: var(--blue); }
.badge-amber { background: #FAEEDA;        color: #854F0B; }
.badge-gray  { background: var(--gray-lt); color: var(--gray); }
.badge-purple { background: var(--purple-lt); color: var(--purple-md); }

/* ── Mapa ────────────────────────────────────────────────────── */
#pantalla-mapa { padding: 0; }
#mapa-container {
  width: 100%;
  height: calc(100vh - var(--nav-h) - var(--bnav-h));
}

/* ── SOS ─────────────────────────────────────────────────────── */
#pantalla-sos { padding: 16px; }
.sos-header {
  text-align: center; padding: 20px 0;
  background: var(--red-lt); border-radius: var(--radius);
  margin-bottom: 20px;
}
.sos-header h2 { color: #A32D2D; font-size: 20px; margin: 8px 0 4px; }
.sos-header p  { color: #791F1F; font-size: 13px; }
.btn-sos-activar {
  width: 100%; background: var(--red); color: white;
  font-size: 16px; font-weight: 700; padding: 16px;
  border-radius: var(--radius); border: none; margin: 16px 0;
  box-shadow: 0 4px 16px rgba(226,75,74,0.4);
}
.sos-exito {
  text-align: center; background: var(--teal-lt);
  border-radius: var(--radius); padding: 24px;
  margin-top: 16px;
}
.sos-exito h3 { color: #0F6E56; margin: 8px 0 4px; }
.info-box {
  background: var(--purple-lt); border-radius: 8px;
  padding: 10px 14px; font-size: 13px; color: var(--purple-md);
  margin-bottom: 16px;
}

/* ── Match ───────────────────────────────────────────────────── */
#contenido-match { padding: 24px 16px; }
.match-card {
  background: white; border: 1px solid var(--border);
  border-radius: 20px; padding: 24px;
  text-align: center; max-width: 340px; margin: 0 auto;
  box-shadow: var(--shadow);
}
.match-avatar {
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--purple-lt); margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 52px; border: 3px solid var(--border);
}
.match-nombre { font-size: 22px; font-weight: 700; color: var(--text); }
.match-sub    { font-size: 13px; color: var(--purple); margin: 4px 0 12px; }
.match-tags   { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.match-desc   { font-size: 13px; color: var(--text-mid); margin-bottom: 16px; line-height: 1.5; }
.match-actions { display: flex; justify-content: center; gap: 20px; margin-top: 16px; }
.match-btn {
  width: 56px; height: 56px; border-radius: 50%; border: none;
  font-size: 24px; box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  transition: transform 0.15s;
}
.match-btn:active { transform: scale(0.92); }
.match-pass { background: var(--red-lt); }
.match-like { background: var(--pink-lt); font-size: 28px; }
.match-exito { text-align: center; padding: 32px 16px; }

/* ── Negocios ────────────────────────────────────────────────── */
#contenido-negocios { padding: 12px 16px; }
.negocio-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start;
}
.neg-icon { font-size: 28px; flex-shrink: 0; }
.neg-info { flex: 1; min-width: 0; }
.neg-nombre { font-size: 14px; font-weight: 700; color: var(--text); }
.neg-tipo   { font-size: 11px; color: var(--purple); margin: 2px 0; }
.neg-ciudad { font-size: 11px; color: var(--gray); }
.neg-stars  { font-size: 11px; margin-top: 3px; }
.neg-actions { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }
.neg-btn {
  font-size: 11px; font-weight: 700; padding: 5px 10px;
  border-radius: 7px; text-align: center; white-space: nowrap;
}
.neg-wa  { background: #E7FAF0; color: #155724; }
.neg-tel { background: var(--purple-lt); color: var(--purple-md); }

/* ── Perfil ──────────────────────────────────────────────────── */
#contenido-perfil { padding: 16px; }
.perfil-header {
  text-align: center; background: white;
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.perfil-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--purple-lt); margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; overflow: hidden;
}
.perfil-avatar img { width: 100%; height: 100%; object-fit: cover; }
.perfil-nombre { font-size: 18px; font-weight: 700; color: var(--text); }
.perfil-email  { font-size: 12px; color: var(--gray); margin: 4px 0 10px; }
.perfil-section {
  background: white; border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header h3 { font-size: 15px; font-weight: 700; color: var(--text); }
.mascota-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #F0EEF8;
}
.mascota-item:last-child { border-bottom: none; }
.mascota-emoji { font-size: 24px; flex-shrink: 0; }
.mascota-info  { flex: 1; }
.mascota-nombre { font-size: 13px; font-weight: 700; color: var(--text); }
.estado-select {
  font-size: 11px; padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--border); color: var(--text-mid);
  background: white;
}

/* ── Modales ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(38,33,92,0.5);
  display: flex; align-items: flex-end;
  animation: fadeIn 0.2s ease;
}
.modal-sheet {
  background: white; border-radius: 20px 20px 0 0;
  width: 100%; max-height: 80vh; overflow-y: auto;
  padding: 20px 16px 32px;
}
.modal-handle {
  width: 40px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 16px;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.comentario {
  padding: 10px 0; border-bottom: 1px solid #F0EEF8;
  display: flex; flex-direction: column; gap: 3px;
}
.comentario strong { font-size: 12px; color: var(--text); }
.comentario span   { font-size: 13px; color: var(--text-mid); }
.comentario small  { font-size: 10px; color: var(--gray); }
.comentario-input {
  display: flex; gap: 8px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.comentario-input input {
  flex: 1; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 13px; outline: none;
}
.comentario-input button {
  background: var(--purple); color: white; border: none;
  padding: 10px 14px; border-radius: 10px; font-weight: 700;
}

/* ── FAB (Nuevo post) ────────────────────────────────────────── */
#fab-post {
  position: fixed; bottom: calc(var(--bnav-h) + 16px); right: 16px;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--purple); color: white;
  font-size: 24px; border: none; z-index: 90;
  box-shadow: 0 4px 16px rgba(127,119,221,0.4);
  display: flex; align-items: center; justify-content: center;
}

/* ── Empty states ────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--gray); font-size: 14px; line-height: 1.8;
}
.empty-state h3 { color: var(--text); font-size: 16px; margin-bottom: 8px; }

/* ── Loading ─────────────────────────────────────────────────── */
.loading-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px; gap: 12px; color: var(--gray); font-size: 13px;
}
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--purple);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toasts ──────────────────────────────────────────────────── */
#toasts {
  position: fixed; bottom: calc(var(--bnav-h) + 16px); left: 16px; right: 16px;
  z-index: 300; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600; text-align: center;
  animation: slideUp 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast-success { background: var(--teal-lt);  color: #0F6E56; }
.toast-error   { background: var(--red-lt);   color: #A32D2D; }
.toast-info    { background: var(--purple-lt); color: var(--purple-md); }
@keyframes slideUp  { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut  { from { opacity: 1; } to { opacity: 0; } }

/* ── Responsive ──────────────────────────────────────────────── */
@media (min-width: 480px) {
  #main-content { max-width: 480px; margin: 0 auto; }
  #navbar, #bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); right: auto; width: 100%; }
  #toasts { max-width: 480px; left: 50%; transform: translateX(-50%); right: auto; }
  #fab-post { right: calc(50% - 240px + 16px); }
  #mapa-container { max-width: 480px; margin: 0 auto; }
}
