/* =========================================================
   Inmobiliaria Salvatierra — Tema de la web pública (v11)
   Se carga en index.html y links.html. El panel /admin no lo usa.

   Qué define:
   1. Tipografías: Archivo (títulos y logo) + Inter (textos).
   2. Bordes un paso menos redondos.
   3. Logo del menú y menú a todo el ancho.
   4. Portada alta con el buscador sobre el borde inferior (desde tablet).
   5. Tema oscuro (solo con <html class="tema-oscuro">): fondo #0f172a,
      tarjetas tipo vidrio, textos con más contraste y mapa oscuro.
   6. Botones flotantes de redes (en celular se abren con el "+").

   Los prefijos html:root / html.tema-oscuro le ganan a las clases de
   Tailwind sin usar !important.
   ========================================================= */

/* ---------- 1. Tipografías ---------- */
html:root body, html:root .font-sans, html:root button, html:root input, html:root select, html:root textarea {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
html:root h1, html:root h2, html:root h3 {
  font-family: 'Archivo', Arial, Helvetica, sans-serif;
  font-weight: 800; font-stretch: 87%; letter-spacing: -0.012em;
}
html:root h3 { font-weight: 700; }
/* Los subtítulos chicos (ej: "Dirección y horario") quedan en Inter */
html:root h3.text-sm { font-family: 'Inter', system-ui, sans-serif; font-stretch: 100%; letter-spacing: 0; }

/* ---------- 2. Bordes (los redondos completos no cambian) ---------- */
html:root .rounded-3xl { border-radius: 1rem; }
html:root .rounded-2xl { border-radius: .75rem; }
html:root .rounded-xl  { border-radius: .5rem; }
html:root .rounded-lg  { border-radius: .375rem; }
html:root .rounded-l-lg { border-radius: .375rem 0 0 .375rem; }
html:root .rounded-r-lg { border-radius: 0 .375rem .375rem 0; }
html:root .leaflet-popup-content-wrapper { border-radius: .5rem; }
html:root .leaflet-bar, html:root .popup-cta { border-radius: .375rem; }

/* ---------- 3. Logo y menú ---------- */
.logo-marca { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.logo-marca svg { width: 3rem; height: 2.18rem; fill: #fff; flex: none; }
.logo-marca span {
  font-family: 'Archivo', Arial, Helvetica, sans-serif; font-weight: 800; font-stretch: 90%;
  text-transform: uppercase; color: #FE5F2F; font-size: 1.05rem; line-height: 1.05; letter-spacing: .01em;
}
@media (min-width: 768px) {
  /* Logo al borde izquierdo y "Contactar" al borde derecho */
  html:root header.header-fijo > div { max-width: none; padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  html:root header nav[aria-label="Principal"] { gap: 1.1rem; }
}

/* ---------- 4. Portada ---------- */
@media (min-width: 768px) {
  html:root .hero {
    min-height: 80vh; display: flex; flex-direction: column;
    padding-top: 7rem; padding-bottom: 0; margin-bottom: 5rem; overflow: visible;
  }
  html:root .hero > div.relative { flex: 1; display: flex; flex-direction: column; justify-content: space-between; width: 100%; }
  html:root .hero .max-w-3xl { margin-bottom: 2rem; }
  /* El buscador queda mitad sobre la foto y mitad sobre la sección siguiente */
  html:root #form-buscar { position: relative; z-index: 5; width: 100%; transform: translateY(50%); }
}

/* Foto de las sierras (portada y /links): en pantallas angostas se corre a la
   izquierda para que el cerro grande quede detrás del título */
.foto-sierras { object-position: 26% 45%; }
@media (min-width: 1024px) { .foto-sierras { object-position: center 45%; } }

/* Capa sobre la foto de portada: oscura arriba (título) y abajo (buscador), clara en la franja de las sierras */
.hero-capa {
  background-image: linear-gradient(to bottom,
    rgba(15, 23, 42, .75) 0%, rgba(15, 23, 42, .68) 45%, rgba(15, 23, 42, .32) 75%, rgba(15, 23, 42, .75) 100%);
}

/* ---------- 5. Tema oscuro ---------- */
html.tema-oscuro, html.tema-oscuro body { background-color: #0f172a; }
html.tema-oscuro body { color: #e2e8f0; }
html.tema-oscuro section.bg-white, html.tema-oscuro #contacto, html.tema-oscuro #destacadas, html.tema-oscuro #nosotros { background-color: #0f172a; }
html.tema-oscuro section.bg-slate-50, html.tema-oscuro #propiedades, html.tema-oscuro #seguros { background-color: #0b1220; }
html.tema-oscuro section { border-color: rgba(255, 255, 255, .08); }
html.tema-oscuro header.header-fijo { background-color: rgba(15, 23, 42, .88); border-color: rgba(255, 255, 255, .10); }
html.tema-oscuro #menu-mobile { background-color: #0f172a; border-color: rgba(255, 255, 255, .10); }

/* Tarjetas tipo vidrio */
html.tema-oscuro :not(section):not(header):not(nav):not(body).bg-white {
  background-color: rgba(255, 255, 255, .07);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border-color: rgba(255, 255, 255, .14);
}
html.tema-oscuro #form-buscar { background-color: rgba(15, 23, 42, .55); border: 1px solid rgba(255, 255, 255, .22); }
html.tema-oscuro .tarjeta:hover { background-color: rgba(255, 255, 255, .10); }
html.tema-oscuro .bg-slate-50:not(section):not(body), html.tema-oscuro .bg-slate-100 { background-color: rgba(255, 255, 255, .06); }
html.tema-oscuro .bg-slate-200 { background-color: #1e293b; }
html.tema-oscuro .foto-placeholder { background-image: linear-gradient(135deg, #1e293b, #2a3a55); }
html.tema-oscuro .bg-brand-50 { background-color: rgba(254, 95, 47, .14); }
html.tema-oscuro .border-brand-100 { border-color: rgba(254, 95, 47, .30); }
html.tema-oscuro .hover\:bg-slate-100:hover { background-color: rgba(255, 255, 255, .10); }
html.tema-oscuro .tarjeta .bg-slate-900, html.tema-oscuro #vista-detalle .bg-slate-900 { background-color: #334155; }

/* Bordes y líneas */
html.tema-oscuro .border-slate-100, html.tema-oscuro .border-slate-200, html.tema-oscuro .border-slate-200\/80,
html.tema-oscuro .border-slate-300 { border-color: rgba(255, 255, 255, .14); }

/* Textos con más contraste */
html.tema-oscuro .text-slate-900 { color: #f8fafc; }
html.tema-oscuro .text-slate-800 { color: #f1f5f9; }
html.tema-oscuro .text-slate-700 { color: #e5eaf1; }
html.tema-oscuro .text-slate-600 { color: #cdd6e3; }
html.tema-oscuro .text-slate-500 { color: #aab6c8; }
html.tema-oscuro .text-slate-400 { color: #94a3b8; }
html.tema-oscuro .text-brand-700, html.tema-oscuro .hover\:text-brand-700:hover,
html.tema-oscuro .group:hover .group-hover\:text-brand-700 { color: #ff7347; }
html.tema-oscuro input::placeholder { color: #8493a8; }
html.tema-oscuro select option { background: #0f172a; color: #f1f5f9; }
html.tema-oscuro .hero h1 { text-shadow: 0 2px 18px rgba(2, 6, 23, .55); filter: none; }

/* Etiquetas blancas sobre las fotos y aviso del mapa: siguen claras con texto oscuro */
html.tema-oscuro .bg-white\/95:not(header) { background-color: rgba(255, 255, 255, .95); }
html.tema-oscuro .bg-white\/95.text-slate-900:not(header), html.tema-oscuro .bg-white\/95.text-slate-700:not(header) { color: #0f172a; }

/* Mapa oscuro: se invierten solo las calles (los pines no cambian) */
html.tema-oscuro .leaflet-container { background: #0b1220; }
html.tema-oscuro .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9) saturate(.75); }
html.tema-oscuro .leaflet-bar a { background: #172033; color: #f1f5f9; border-bottom-color: rgba(255, 255, 255, .14); }
html.tema-oscuro .leaflet-bar a:hover { background: #22304a; }
html.tema-oscuro .leaflet-bar a.leaflet-disabled { background: #111a2c; color: #64748b; }
html.tema-oscuro .leaflet-control-attribution { background: rgba(15, 23, 42, .8); color: #cbd5e1; }
html.tema-oscuro .leaflet-control-attribution a { color: #93c5fd; }
html.tema-oscuro .leaflet-popup-content-wrapper, html.tema-oscuro .leaflet-popup-tip { background: #172033; color: #e2e8f0; }
html.tema-oscuro .leaflet-container a.leaflet-popup-close-button { color: #cbd5e1; }
html.tema-oscuro #propiedades span.w-3.bg-slate-900 { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55); }

/* Alineación: todo a la izquierda salvo la portada */
html.tema-oscuro #lista .text-center, html.tema-oscuro #nosotros dl.text-center { text-align: left; }

/* ---------- Aviso "Estamos cargando nuevas propiedades" (menos de 8 publicadas) ---------- */
.aviso-cargando { display: flex; flex-direction: column; gap: 1.25rem; }
.aviso-cargando-img { width: 8.5rem; height: auto; flex: none; align-self: flex-start; }
@media (min-width: 640px) {
  .aviso-cargando { flex-direction: row; align-items: center; }
  .aviso-cargando-img { width: 10rem; align-self: center; }
}

/* ---------- Compartir una propiedad (detalle) ---------- */
.compartir-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.compartir-panel[hidden] { display: none; }
.compartir-panel a, .compartir-panel button {
  display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .6rem .25rem;
  border-radius: .5rem; font-size: .75rem; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
  color: #e5eaf1; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14);
  transition: border-color .15s ease, color .15s ease;
}
.compartir-panel a:hover, .compartir-panel button:hover { border-color: #FE5F2F; color: #fff; }
.compartir-panel svg { width: 1.25rem; height: 1.25rem; }
.compartir-panel .compartir-wa svg { color: #25D366; }
.compartir-panel .compartir-fb svg { color: #1877F2; }

/* ---------- 6. Botones flotantes de redes ---------- */
.redes-flotantes {
  position: fixed; right: 1.25rem; bottom: 5rem; z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: .625rem;
  margin-bottom: env(safe-area-inset-bottom, 0px);
}
.redes-flotantes a {
  display: flex; align-items: center; justify-content: center; border-radius: 9999px; color: #fff;
  box-shadow: 0 10px 25px rgba(2, 6, 23, .45); transition: transform .15s ease, background-color .15s ease;
}
.redes-flotantes a:hover { transform: scale(1.08); }
.redes-flotantes .red-chica { width: 2.75rem; height: 2.75rem; border: 0; padding: 0; color: #fff; }
.redes-flotantes .red-instagram { background: #E1306C; }
.redes-flotantes .red-instagram:hover { background: #C91F5B; }
.redes-flotantes .red-facebook { background: #1877F2; }
.redes-flotantes .red-facebook:hover { background: #0F63D1; }
.redes-flotantes .red-whatsapp { width: 3.5rem; height: 3.5rem; background: #059669; }
.redes-flotantes .red-whatsapp:hover { background: #047857; }
.redes-flotantes svg { width: 1.25rem; height: 1.25rem; }
.redes-flotantes .red-whatsapp svg { width: 1.75rem; height: 1.75rem; }
/* Botón "+" (solo en celular): negro, con borde claro para que se distinga del fondo oscuro */
.redes-flotantes .red-toggle {
  display: none; align-items: center; justify-content: center; cursor: pointer;
  background: #000; border: 1px solid rgba(255, 255, 255, .35); border-radius: 9999px;
  box-shadow: 0 10px 25px rgba(2, 6, 23, .45);
}
.redes-flotantes .red-toggle svg { transition: transform .2s ease; }
.redes-flotantes.abierto .red-toggle svg { transform: rotate(45deg); }
/* En celular Instagram y Facebook quedan plegados hasta tocar el "+" */
@media (max-width: 767px) {
  .redes-flotantes .red-toggle { display: flex; }
  .redes-flotantes a.red-chica { display: none; }
  .redes-flotantes.abierto a.red-chica { display: flex; }
}
@media (prefers-reduced-motion: reduce) { .redes-flotantes a, .redes-flotantes .red-toggle svg { transition: none; } }
