/* Los colores (--fg, --bg, --accent, etc.) los define el tema activo en
   css/themes/*.css, cargado después de este archivo — ver includes/header.php
   e includes/themes.php. Este archivo es solo estructura/layout. */
:root {
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}

a { color: inherit; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; }
.brand img { display: block; width: 32px; height: auto; }
.main-nav { display: flex; gap: 16px; font-size: 14px; align-items: center; }
.main-nav a { text-decoration: none; }
.main-nav a:hover { text-decoration: underline; }
.lang-switch { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.lang-switch a { text-decoration: none; padding: 2px 4px; }
.lang-switch a.is-active { font-weight: 700; color: var(--fg); text-decoration: underline; }
.google-translate-widget { font-size: 13px; }
.google-translate-widget .goog-te-gadget { font-family: inherit !important; color: var(--muted) !important; }
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 999px;
  width: 30px; height: 30px; font-size: 15px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.theme-toggle:hover { background: var(--border); }
.nav-toggle {
  display: none;
  background: none; border: none; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--fg); padding: 4px 6px;
}
@media (max-width: 720px) {
  .site-header-inner { flex-wrap: wrap; }
  .nav-toggle { display: block; }
  .main-nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 8px 0 12px;
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { display: block; width: 100%; padding: 8px 4px; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 20px 0;
  color: var(--muted);
  font-size: 13px;
}
.site-footer-image { display: block; max-height: 56px; width: auto; margin-bottom: 10px; }
/* Imagen de pie de página a todo el ancho (Diseño, activada por defecto)
 * — mismo truco de romper .wrap que .hero-band.full-bleed, banner en vez
 * de logo chico. */
.site-footer-image.full-bleed {
  width: 100vw; max-height: none; height: 220px; object-fit: cover;
  position: relative; left: 50%; right: 50%;
  margin-left: -50vw; margin-right: -50vw; margin-bottom: 16px;
}
@media (max-width: 640px) { .site-footer-image.full-bleed { height: 140px; } }
.site-footer-text { margin: 0 0 6px; white-space: pre-line; }

/* Imagen destacada de una propiedad (negocio.php, inmobiliaria) — portada
 * a todo el ancho arriba de la ficha, mismo truco de romper .wrap que
 * .hero-band.full-bleed y la imagen de pie de página. Va de
 * background-image (no <img>) para poder reusar el mismo parallax de
 * siempre (background-attachment:fixed, ver .hero-band.parallax) cuando
 * está activado en Diseño. */
.property-hero-image {
  width: 100vw; position: relative; left: 50%; right: 50%;
  margin-left: -50vw; margin-right: -50vw; margin-bottom: 20px;
  height: 420px; background-size: cover; background-position: center;
}
@media (max-width: 640px) { .property-hero-image { height: 240px; } }

/* El contenido de la ficha de propiedad (precio, specs, galería,
 * contacto…) y de la portada de inmobiliaria (destacadas, zonas,
 * carruseles, filtro) se quedan a un ancho de lectura razonable
 * SIEMPRE, aunque el sitio tenga "Ancho completo" activado en Diseño
 * (esa opción libera a .wrap de su max-width, y sin este freno propio
 * el contenido queda pegado a los bordes de la ventana — se ve mal,
 * sobre todo con una portada de foto ya ocupando todo el ancho). La
 * portada en sí (.hero-band / .property-hero-image) no entra en este
 * contenedor — sigue teniendo su propio ancho completo opcional,
 * independiente de esto. .property-content: negocio.php (solo si hay
 * imagen destacada, ver $hasHero — sin ella .wrap ya alcanza).
 * .content-frame: theme-templates/rs-brixtapa/home.php (siempre). */
.property-content, .content-frame { max-width: 960px; margin: 0 auto; }

main.wrap { flex: 1; padding-top: 32px; padding-bottom: 48px; }

/* Flash messages */
.flash { padding: 10px 14px; border-radius: var(--radius); margin: 16px 0; font-size: 14px; }
.flash-success { background: #dcfce7; color: #14532d; }
.flash-error { background: #fee2e2; color: #7f1d1d; }
@media (prefers-color-scheme: dark) {
  .flash-success { background: #14532d; color: #dcfce7; }
  .flash-error { background: #7f1d1d; color: #fee2e2; }
}

/* Typography */
h1 { font-size: 28px; margin: 0 0 8px; }
h2 { font-size: 16px; margin: 0 0 8px; color: var(--muted); }
.lead { color: var(--muted); max-width: 560px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Forms */
form.stack { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="url"], input[type="number"], input[type="time"], input[type="file"],
select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  width: 100%;
}
textarea { resize: vertical; }
.row { display: flex; gap: 12px; }
.row > .field { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--fg); }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-amber { background: var(--amber); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
@media (max-width: 640px) {
  /* Los botones .btn-sm de las tarjetas de listado ("☆ Guardar", "Ver
   * detalles") medían 24-32px de alto en celular, por debajo del mínimo
   * de touch target recomendado — min-height en vez de más padding, para
   * no ensanchar de más los usos ya compactos del panel de admin
   * (auditoría de accesibilidad). */
  .btn-sm { min-height: 44px; }
}
.btn-link { background: none; border: none; padding: 0; text-decoration: underline; cursor: pointer; color: inherit; font: inherit; }

/* Cards / lists */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } .row { flex-direction: column; } }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .meta { color: var(--muted); font-size: 13px; margin: 2px 0; }

/* Insignia "En venta"/"En renta" (operacion_badge_html() en
 * includes/site-types.php) — pill con color + ícono, para que se note de
 * un vistazo cuál es cuál (antes era solo texto discreto en gris). */
.operacion-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.operacion-badge-venta { background: rgba(34, 197, 94, .16); color: var(--green); }
.operacion-badge-renta { background: rgba(217, 119, 6, .16); color: var(--accent2, var(--amber)); }

/* Foto de portada de una tarjeta de listado (render_business_card()) —
 * clase en vez de style="" inline para que .bento-grid pueda pisar el
 * alto sin necesitar !important. */
.card-thumb { display: block; width: 100%; height: 150px; object-fit: cover; border-radius: var(--radius); margin-bottom: 8px; }

/* Bento grid (Diseño → "Cómo se muestran los listados") — mosaico con
 * tarjetas de tamaño variable en vez de una grilla uniforme. Se repite
 * cada 6 tarjetas (1 grande 2×2 + 1 alta 1×2 + 4 normales); grid-auto-flow
 * dense rellena los huecos que deja esa variación con las tarjetas que
 * siguen, en vez de dejarlos en blanco. */
.bento-grid {
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 190px;
  grid-auto-flow: dense;
}
.bento-grid .card { display: flex; flex-direction: column; overflow: hidden; }
.bento-grid .card-thumb { flex: 1 1 auto; min-height: 0; height: auto; }
.bento-grid .card:nth-child(6n+1) { grid-column: span 2; grid-row: span 2; }
.bento-grid .card:nth-child(6n+4) { grid-row: span 2; }
@media (max-width: 900px) {
  .bento-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .bento-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .bento-grid .card:nth-child(6n+1), .bento-grid .card:nth-child(6n+4) { grid-column: span 1; grid-row: span 1; }
  .bento-grid .card-thumb { height: 150px; flex: none; }
}

/* Estilo de tarjeta (Diseño) — "flat" es el de siempre (sin clase extra);
 * dos variantes más para que dos sitios con el mismo tema no se vean
 * idénticos. Ver body_classes() en includes/theme_customizer.php. */
body.card-style-shadow .card {
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
}
body.card-style-outlined .card {
  border-width: 2px;
  border-color: var(--accent);
}

/* Animaciones — solo si la función "card_animations" está activa
 * (admin/funciones.php agrega .fx-on en <body>). Respeta
 * prefers-reduced-motion. */
body.fx-on .card {
  transition: transform .15s ease, box-shadow .15s ease;
}
body.fx-on .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}
body.fx-on .card img { transition: opacity .3s ease; }
body.fx-on .gallery img, body.fx-on [data-lightbox] {
  transition: transform .15s ease;
  cursor: zoom-in;
}
body.fx-on .gallery img:hover, body.fx-on [data-lightbox]:hover {
  transform: scale(1.05);
}
@media (prefers-reduced-motion: reduce) {
  body.fx-on .card, body.fx-on .card:hover, body.fx-on .gallery img, body.fx-on [data-lightbox] {
    transition: none; transform: none;
  }
}

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; transition: opacity .2s ease; cursor: zoom-out;
}
.lightbox-overlay.is-open { opacity: 1; }
.lightbox-overlay img {
  max-width: 90vw; max-height: 90vh; border-radius: var(--radius);
  transform: scale(.92); transition: transform .2s ease;
}
.lightbox-overlay.is-open img { transform: scale(1); }

/* Visor de fotos 360° (negocio.php + includes/footer.php) */
.gallery-thumb-360 { position: relative; cursor: pointer; }
.gallery-thumb-360 .badge-360 {
  position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,0.7); color: #fff;
  font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; letter-spacing: .02em;
}
.thumb .badge-360 { top: -6px; left: -6px; bottom: auto; right: auto; position: absolute; }
.thumb .badge-featured {
  position: absolute; bottom: -6px; left: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--amber); color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.pano-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; transition: opacity .2s ease;
}
.pano-overlay.is-open { opacity: 1; }
.pano-viewer { width: 100%; height: 100%; }
.pano-loading { position: absolute; color: #fff; font-size: 14px; }
.pano-close {
  position: absolute; top: 16px; right: 16px; z-index: 1001;
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.15); color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
}
.pano-close:hover { background: rgba(255,255,255,0.3); }

/* Search bar */
.search-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.search-bar input[type="text"] { flex: 1; min-width: 200px; }
.search-bar select { width: auto; }

/* Hero de portada — banda de color (o foto de portada, si se sube una
 * desde Diseño) con el encabezado del sitio. En inmobiliaria envuelve
 * también la barra de búsqueda (protagonista, como raudarealestate.com);
 * en directorio/blog envuelve solo el encabezado. var(--navy) con
 * respaldo a var(--accent) porque el tema Predeterminado no define --navy. */
.hero-band {
  position: relative;
  background: var(--navy, var(--accent));
  background-size: cover;
  background-position: center;
  color: #fff;
  border-radius: var(--radius);
  padding: 32px 24px;
  margin-bottom: 24px;
  overflow: hidden;
}
/* Sin imagen de portada, "cover_style" (Diseño) da variedad sin subir
 * nada — degradado usando el segundo color de acento, o un patrón sutil
 * de líneas. "plain" (por defecto) deja el color sólido de siempre. */
.hero-band.cover-style-gradient {
  background: linear-gradient(135deg, var(--navy, var(--accent)), var(--accent2, var(--accent)));
}
.hero-band.cover-style-pattern {
  background-color: var(--navy, var(--accent));
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0, rgba(255,255,255,.07) 2px, transparent 2px, transparent 14px);
}
.hero-band.has-cover::before {
  content: "";
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, var(--cover-overlay, 0.45));
  /* z-index explícito: sin esto, el ::before (pintado primero, como si
     fuera el primer "hijo") quedaba por DEBAJO de .hero-band-slide/
     .hero-band-video (también z-index:0) en vez de encima — el
     oscurecido desaparecía detrás de la foto/video y el texto blanco
     perdía contraste. Ver .hero-band-slide/.hero-band-video más abajo
     (se quedan en 0, a propósito, para perder este empate). */
  z-index: 1;
}
.hero-band > * { position: relative; z-index: 1; }
.hero-band h1, .hero-band .lead { color: #fff; }
.hero-band .lead { opacity: .85; max-width: none; }
.hero-band .search-bar { margin-bottom: 0; }
.hero-band .search-bar input, .hero-band .search-bar select { border: none; }

/* Alto de portada (Diseño) — "medium" es el padding de siempre. */
.hero-band.cover-height-small { padding: 18px 24px; }
.hero-band.cover-height-large {
  padding: 72px 24px; min-height: 320px;
  display: flex; align-items: center; justify-content: center;
}
/* Pantalla completa, estilo hero banner de una landing page. */
.hero-band.cover-height-full {
  min-height: 100vh; padding: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0;
}

/* Video de portada (Diseño) — reemplaza la imagen de fondo; la imagen
 * (si también hay una cargada) queda solo como "poster" de respaldo
 * mientras el video carga. Mismo overlay oscurecedor que ya usa la
 * imagen, por encima del video. */
.hero-band.has-video .hero-band-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* Carrusel de portada (Diseño → Imágenes de portada, hasta 5) —
 * hero_band_cover_html() arma una capa por foto, superpuestas; JS en
 * includes/footer.php va mostrando una por vez (cruce suave). Cada capa
 * tiene su propio zoom lento continuo (estilo houzez.co) — se nota más
 * en la que está visible, pero corre siempre, así no hace falta
 * reiniciar la animación al cambiar de foto. */
.hero-band .hero-band-slide {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  z-index: 0; opacity: 0;
  transition: opacity 1.4s ease;
  animation: heroKenBurns 14s ease-in-out infinite alternate;
}
.hero-band .hero-band-slide.is-active { opacity: 1; }
@keyframes heroKenBurns {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-band .hero-band-slide { animation: none; }
}

/* Parallax (Diseño) — el fondo se mueve más lento que el resto al hacer
 * scroll; sencillo, con CSS nomás (background-attachment:fixed), sin
 * JS. Solo tiene sentido en imágenes de fondo grandes (portada, bloques
 * de página) — la imagen del pie de página es un logo chico, no aplica
 * ahí. Se desactiva en celulares (soporte pobre/entrecortado, mejor
 * scroll normal) y se respeta prefers-reduced-motion. */
.hero-band.parallax, .page-block.parallax, .property-hero-image.parallax {
  background-attachment: fixed;
}
@media (max-width: 768px), (prefers-reduced-motion: reduce) {
  .hero-band.parallax, .page-block.parallax, .property-hero-image.parallax {
    background-attachment: scroll;
  }
}

/* Portada a todo el ancho (Diseño) — rompe el contenedor .wrap centrado
 * para que la imagen llegue de borde a borde de la ventana, en vez de
 * quedar recortada al ancho del contenido. Solo aplica con imagen de
 * portada cargada (ver hero_band_attrs() en includes/theme_customizer.php). */
.hero-band.full-bleed {
  width: 100vw;
  position: relative;
  left: 50%; right: 50%;
  margin-left: -50vw; margin-right: -50vw;
  border-radius: 0;
}

/* Ancho de contenido (Diseño) — de fábrica el sitio queda centrado en
 * 960px; esta clase en <body> lo deja usar el ancho completo de la
 * ventana en vez de quedar en una columna angosta. */
body.content-full .wrap { max-width: none; }

/* Encabezado centrado (Diseño) — alternativa al logo a la izquierda +
 * nav a la derecha de siempre. */
body.header-center .site-header-inner { justify-content: center; gap: 40px; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; text-decoration: none; cursor: pointer; background: transparent; color: inherit; font: inherit; }
.tab.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* Chip — insignias y etiquetas (categorías, "Nuevo", tags de blog). Estilo
 * base genérico aquí; algunos temas lo redefinen para su paleta. */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent2, var(--navy, var(--accent))); color: #fff;
  border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500;
}

/* Bloques de página (/pagina.php, ver admin/pagina-editor.php) — cada
 * bloque puede tener su propio color de fondo y una imagen, ya sea como
 * figura normal o llenando el bloque de fondo (image_as_background). */
.page-block {
  border-radius: var(--radius);
  margin: 24px 0;
  padding: 24px;
}
.page-block.has-bg-image {
  background-size: cover;
  background-position: center;
  min-height: 280px;
  display: flex;
  align-items: center;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.page-block-image {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.page-block-content { line-height: 1.6; }
.page-block-content p:first-child { margin-top: 0; }
.page-block-content p:last-child { margin-bottom: 0; }

/* Admin shell */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; flex-shrink: 0; border-right: 1px solid var(--border); padding: 20px; }
.admin-sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-nav-toggle {
  display: none; background: none; border: none; font-size: 20px; line-height: 1;
  cursor: pointer; color: var(--fg); padding: 4px 6px;
}
.admin-sidebar nav { display: flex; flex-direction: column; gap: 2px; font-size: 14px; margin-top: 20px; }
.admin-sidebar nav a { padding: 6px 8px; border-radius: 6px; text-decoration: none; }
.admin-sidebar nav a:hover { background: var(--border); }

/* Desplegable "Ajustes" (Usuarios/Permisos/Diseño/Funciones/Contenido
 * demo/Actualizaciones anidados) — ver admin/includes/admin-header.php. */
.admin-subnav-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 6px 8px; border-radius: 6px; border: none; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.admin-subnav-toggle:hover { background: var(--border); }
.admin-subnav-caret { transition: transform .15s ease; }
.admin-subnav-toggle[aria-expanded="true"] .admin-subnav-caret { transform: rotate(180deg); }
.admin-subnav { display: flex; flex-direction: column; gap: 2px; padding-left: 14px; }
.admin-subnav a { padding: 6px 8px; border-radius: 6px; text-decoration: none; font-size: 13px; }
.admin-subnav a:hover { background: var(--border); }
/* Ancho máximo (mismo problema que ya se corrigió del lado público, ver
 * .content-frame): sin esto, en un monitor ancho las listas del panel
 * (Propiedades, Usuarios…) quedaban con el nombre pegado a la izquierda
 * y los botones Editar/Suspender lejísimos a la derecha. 960px, igual que
 * .content-frame/.property-content del lado público — mismo ancho de
 * lectura en todo el sistema (antes era 1200px "porque acá hay tablas con
 * más columnas", pero ninguna tabla del panel pasa de 5 columnas cortas;
 * a 1200px las tarjetas con justify-content:space-between, como las de
 * Propiedades, se veían con el nombre y los botones demasiado separados
 * igual, solo que menos que sin tope). margin:0 auto funciona como flex
 * item (centra en el espacio que le sobra dentro de .admin-shell) sin
 * tocar el resto del layout. */
.admin-content { flex: 1; padding: 24px; min-width: 0; max-width: 960px; margin: 0 auto; }
.admin-user-box { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

/* Editor de texto enriquecido (Quill, tema "snow" — ver initWysiwyg() en
 * admin/includes/admin-header.php). El tema por defecto de Quill viene
 * pensado para escritorio: sin esto, la barra de herramientas no envuelve
 * en pantallas angostas y el contenido pegado (tablas, imágenes grandes,
 * URLs largas) puede desbordar el ancho del panel. */
.wysiwyg-wrap { max-width: 100%; }
.wysiwyg-wrap .ql-toolbar.ql-snow {
  display: flex; flex-wrap: wrap; row-gap: 6px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.wysiwyg-wrap .ql-container.ql-snow {
  border-radius: 0 0 var(--radius) var(--radius);
  max-width: 100%;
}
.wysiwyg-wrap .ql-editor { min-height: 160px; max-width: 100%; word-break: break-word; }
.wysiwyg-wrap .ql-editor img { max-width: 100%; height: auto; }
.wysiwyg-wrap .ql-editor table { display: block; max-width: 100%; overflow-x: auto; }
.wysiwyg-wrap .ql-editor pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; }

/* Lista arrastrable del orden del menú (admin/menu.php) — ver el drag-
 * and-drop en vanilla JS ahí mismo, sin ninguna librería. max-width más
 * ancho que otras listas del panel porque las filas de enlaces propios
 * llevan un formulario de edición inline (texto + URL) adentro. */
.nav-order-list { list-style: none; margin: 0 0 8px; padding: 0; max-width: 720px; }
.nav-order-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  margin-bottom: 4px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: grab; font-size: 14px; flex-wrap: wrap;
}
.nav-order-list li.is-dragging { opacity: .4; }
.nav-order-list li.nav-item-hidden { opacity: .55; border-style: dashed; }
.nav-order-handle { color: var(--muted); font-size: 16px; line-height: 1; }
/* Botones Subir/Bajar — alternativa operable por teclado al arrastrar y
 * soltar (que por sí solo no lo es), ver admin/menu.php. */
.nav-order-move { display: flex; flex-direction: column; gap: 0; }
.nav-order-move form { display: block; }
.nav-order-move button {
  font-size: 13px; line-height: 1; padding: 2px 4px; cursor: pointer;
  color: var(--fg); background: none; border: none;
}
.nav-order-move button:disabled { color: var(--border); cursor: default; }
.nav-item-edit-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1 1 260px; min-width: 0; }
.nav-item-edit-form input { font-size: 13px; padding: 4px 6px; min-width: 0; }

@media (max-width: 860px) {
  .admin-shell { flex-direction: column; min-height: 0; }
  .admin-sidebar {
    width: 100%; border-right: none; border-bottom: 1px solid var(--border);
    padding: 14px 16px;
  }
  .admin-nav-toggle { display: block; }
  .admin-sidebar nav {
    display: none;
    flex-direction: column;
    margin-top: 12px; gap: 2px;
  }
  .admin-sidebar nav.is-open { display: flex; }
  .admin-sidebar nav a { white-space: normal; }
  .admin-user-box { margin-top: 12px; padding-top: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .admin-user-box p { margin: 0 !important; }
  .admin-content { padding: 16px; }
  .wysiwyg-wrap .ql-toolbar.ql-snow { padding: 6px; }
  .wysiwyg-wrap .ql-snow .ql-formats { margin-right: 6px !important; }
  .wysiwyg-wrap .ql-editor { min-height: 140px; font-size: 16px; }
}

/* Cualquier tabla se vuelve deslizable horizontal en vez de desbordar la
 * pantalla (paneles de admin con muchas columnas, en celulares angostos). */
.admin-content table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-grid .card { text-align: center; }
.stat-grid .stat-value { font-size: 24px; font-weight: 600; }
.stat-grid .stat-label { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery img { width: 90px; height: 90px; object-fit: cover; border-radius: 6px; }
.gallery .thumb { position: relative; }
.gallery .thumb .remove {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); color: var(--accent-fg);
  border: none; cursor: pointer; font-size: 12px; line-height: 1;
}

/* Carrusel automático (home.php de inmobiliaria: venta/renta) — scroll
 * horizontal nativo (como .gallery-scroll), con el JS de includes/footer.php
 * avanzando una "pantalla" a la vez cada pocos segundos. 2 propiedades
 * visibles por vez en escritorio, 1 sola en celular — nada más con CSS,
 * el JS no necesita saber cuántas caben. */
.auto-carousel { overflow: hidden; }
.auto-carousel-track {
  display: flex; gap: 16px; overflow-x: hidden; scroll-behavior: smooth;
}
.auto-carousel-item { flex: 0 0 calc(50% - 8px); min-width: 0; }
@media (max-width: 560px) {
  .auto-carousel-item { flex: 0 0 100%; }
}

/* Galería de la ficha pública (negocio.php): tira horizontal con scroll y
 * botones ‹ › a los costados, en vez de envolver en varias filas. */
.gallery-wrap { position: relative; padding: 0 32px; }
.gallery-scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 4px;
}
.gallery-scroll img {
  width: 220px; height: 220px; flex: 0 0 auto;
  scroll-snap-align: start;
  border-radius: var(--radius);
}
@media (max-width: 640px) { .gallery-scroll img { width: 160px; height: 160px; } }
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); font-size: 18px; line-height: 1;
  cursor: pointer; z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.gallery-nav-prev { left: 0; }
.gallery-nav-next { right: 0; }
.gallery-nav:disabled { opacity: .3; cursor: default; }
.gallery-nav:hover:not(:disabled) { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
@media (max-width: 640px) {
  /* 44px, no 30px — el mínimo recomendado de touch target; la galería de
   * fotos es una de las interacciones más usadas de una ficha en celular
   * (auditoría SEO/accesibilidad, hallazgo W5). */
  .gallery-wrap { padding: 0 46px; }
  .gallery-nav { width: 44px; height: 44px; font-size: 17px; }
}

/* Galería masonry (propósito "Fotógrafos", ver negocio.php) — columnas
 * CSS en vez de JS (Masonry.js/Isotope): cada foto conserva su
 * proporción real, sin recortes ni gap entre ellas, a diferencia de
 * .gallery-scroll (que sí recorta a cuadrado en una tira horizontal).
 * Inspirado en medios360.com — ver source/medios360-portafolio/notas.md. */
.masonry-gallery {
  display: block; column-count: 3; column-gap: 0;
}
.masonry-gallery a { display: block; }
.masonry-gallery img {
  width: 100%; height: auto; display: block;
  object-fit: initial; border-radius: 0; break-inside: avoid;
}
@media (max-width: 900px) { .masonry-gallery { column-count: 2; } }
@media (max-width: 560px) { .masonry-gallery { column-count: 1; } }

/* Tarjeta de categoría a sangre completa con foto de fondo (portada del
 * propósito "Fotógrafos") — mismo patrón visual que .hero-band.has-cover
 * (degradado oscuro para legibilidad), pero en tamaño de tarjeta. */
.category-photo-tile {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--radius); height: 220px;
  background-size: cover; background-position: center;
  color: #fff; text-decoration: none;
}
.category-photo-tile::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(rgba(0,0,0,0.15), rgba(0,0,0,0.55));
}
.category-photo-tile span {
  position: absolute; z-index: 1; left: 20px; bottom: 16px;
  font-family: inherit; font-size: 16px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.category-photo-tile:hover img,
.category-photo-tile:hover { filter: brightness(1.05); }

/* Zonas de inmobiliaria ("Busca por zona", rs-brixtapa) — mismo tile de
 * foto de arriba, pero con zoom + un leve giro al pasar el mouse en vez
 * del solo brillo que usa fotógrafos (pedido explícito, estilo "Find
 * Properties in These Cities" de portales inmobiliarios modernos). */
.zone-photo-tile { transition: transform .35s ease, box-shadow .35s ease; }
.zone-photo-tile:hover {
  transform: scale(1.06) rotate(-1deg);
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  z-index: 2;
}
@media (prefers-reduced-motion: reduce) {
  .zone-photo-tile { transition: none; }
  .zone-photo-tile:hover { transform: none; }
}

/* Botón flotante de WhatsApp (includes/footer.php) — fijo en la esquina,
 * visible en todo el sitio si hay un número configurado en Ajustes. */
.whatsapp-float {
  position: fixed; right: 18px; bottom: 18px; z-index: 900;
  width: 52px; height: 52px; border-radius: 50%;
  background: #25D366; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(0,0,0,0.25);
  transition: transform .15s ease;
}
.whatsapp-float:hover { transform: scale(1.06); }
@media (max-width: 640px) {
  .whatsapp-float { right: 14px; bottom: 14px; width: 46px; height: 46px; }
  .whatsapp-float svg { width: 24px; height: 24px; }
}

/* Flechas de navegación dentro del lightbox (fotos siguiente/anterior). */
.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.15); color: #fff; font-size: 22px; line-height: 1;
  cursor: pointer; z-index: 1001;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-nav-prev { left: 16px; }
.lightbox-nav-next { right: 16px; }

/* Utilidades de layout para plantillas por tema (theme-templates/) — capas
 * genéricas de estructura, sin color propio, para que cualquier tema las
 * pueda usar armando una portada con otra forma (panel lateral, filas de
 * listado, barra lateral de widgets…) en vez del layout por defecto. */
.layout-sidebar { display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start; }
@media (max-width: 800px) { .layout-sidebar { grid-template-columns: 1fr; } }

.filter-panel { position: sticky; top: 16px; }
.filter-panel .field { margin-bottom: 12px; }
.filter-panel .field:last-child { margin-bottom: 0; }
/* En columna única (ver .layout-sidebar arriba) el panel de filtros
 * queda apilado ARRIBA de los resultados, no al costado — dejarlo
 * "sticky" ahí lo mantendría pegado a la pantalla mientras se
 * desplazan los resultados debajo, tapándolos. Solo tiene sentido
 * fijo cuando de verdad está al costado (2 columnas). */
@media (max-width: 800px) { .filter-panel { position: static; } }

.sidebar-widget h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 0 0 10px; }
.sidebar-widget + .sidebar-widget { margin-top: 20px; }
.sidebar-widget .widget-list { list-style: none; margin: 0; padding: 0; }
.sidebar-widget .widget-list li { margin-bottom: 10px; font-size: 14px; }
.sidebar-widget .widget-list a { text-decoration: none; }
.sidebar-widget .widget-list a:hover { text-decoration: underline; }

.listing-row {
  display: flex; gap: 16px; padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.listing-row:first-child { padding-top: 0; }
.listing-row img { width: 140px; height: 105px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; }
.listing-row .listing-body { flex: 1; min-width: 0; }
.listing-row h3 { margin: 0 0 4px; }
@media (max-width: 560px) { .listing-row { flex-direction: column; } .listing-row img { width: 100%; height: 160px; } }
