/* dex/app — portal público de clasificados.
 * Look inspirado en los mockups: navy oscuro, rosa vibrante, tarjetas
 * redondeadas, mobile-first. Sin bootstrap ni bundlers: CSS plano con
 * variables. */

:root {
  --navy:        #1e2a5e;   /* header y fondos oscuros */
  --navy-2:      #2a3670;
  --pink:        #e35d8f;   /* accion primaria (rosa mockup) */
  --pink-h:      #d24a7d;
  --pink-soft:   #fce4ec;   /* fondos suaves rosa */
  --yellow-soft: #fef3c7;
  --mint-soft:   #d4f4e9;
  --lilac:       #e9e6ff;   /* fondo global suave del mockup */
  --bg:          #eef0fa;
  --canvas:      #dfe2ec;   /* fondo del shell — más oscuro que --bg para que las tarjetas blancas destaquen */
  --surface:     #ffffff;
  --border:      #e5e7eb;
  --text:        #101636;   /* azul-tinta del mockup */
  --muted:       #7078a0;
  --star:        #f5b301;
  --radius-lg:   22px;
  --radius-md:   14px;
  --radius-sm:   10px;
  --shadow-sm:   0 2px 8px rgba(16, 22, 54, 0.06);
  --shadow-md:   0 8px 24px rgba(16, 22, 54, 0.08);
  --shadow-lg:   0 20px 40px rgba(16, 22, 54, 0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.4;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* Contenedor mobile-first — el portal se pinta como un stack vertical
 * angosto que respeta el look "app" incluso en desktop. */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  background: var(--canvas);
  min-height: 100vh;
  position: relative;
  /* deja lugar para que el contenido no quede tapado por el .app-nav
   * flotante. Cuenta: 16px de separación del bottom + ~48px del nav +
   * ~15px de gap visible entre el borde inferior de la tarjeta y el
   * borde superior del nav + safe-area de iOS. */
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}
/* En la página de detalle sumamos 20px extra de padding para que se
 * pueda scrollear un poco más allá del borde inferior de la tarjeta,
 * dejando aire visible entre la tarjeta y el nav flotante. */
.app-shell.page-detalle {
  padding-bottom: calc(95px + env(safe-area-inset-bottom, 0px));
}

/* --------- header navy --------- */

.app-header {
  background: var(--navy);
  color: #fff;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 22px 20px 60px;
  position: relative;
  overflow: hidden;
}
.app-header::after {
  /* triangulito verdoso arriba a la derecha, como en los mockups */
  content: '';
  position: absolute;
  top: 24px; right: 26px;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 12px solid #7ee0c7;
  transform: rotate(90deg);
  opacity: .9;
}

.app-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  position: relative;
  z-index: 2;
}
.app-header-title {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.app-header-title .accent { color: #f0b5cb; font-weight: 400; }

.app-back {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  text-decoration: none;
}
.app-header-actions {
  display: flex; gap: 10px; align-items: center;
}
.app-icon-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
  position: relative;
}
.app-icon-btn .dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--pink);
  border: 2px solid var(--navy);
}

/* buscador flotante que "cuelga" del header */
.app-search-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 2;
  margin-top: 4px;
}
.app-search-card input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  padding: 4px 0;
  font-family: inherit;
}
.app-search-card input::placeholder { color: #a3a9c4; }
.app-search-card .search-icon { color: #a3a9c4; font-size: 1.1rem; }
.app-search-card .filter-icon {
  background: var(--pink-soft);
  color: var(--pink);
  border: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
}

/* chips debajo del buscador (Best offers, Free, etc.) */
.app-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 10px 4px;
  scrollbar-width: none;
}
.app-chip-row::-webkit-scrollbar { display: none; }

.app-chip {
  background: var(--yellow-soft);
  color: #a16207;
  border: none;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.app-chip.pink   { background: var(--pink-soft); color: var(--pink); }
.app-chip.mint   { background: var(--mint-soft); color: #128473; }
.app-chip.lilac  { background: var(--lilac);     color: #6b5cb8; }
.app-chip.active { background: var(--navy);      color: #fff; }

/* --------- bloque de categorías (tarjetas grandes tipo mockup) --------- */

/* Las secciones dejan 10px libres a cada lado para que ni el panel de
 * tiles ni las tarjetas de aviso peguen contra el borde del shell. */
.app-section {
  padding: 20px 10px 4px;
}
.app-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-section-title .link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--pink);
}

.tiles-panel {
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.tiles-panel::before {
  content: '';
  position: absolute;
  right: -30px; bottom: -30px;
  width: 90px; height: 90px;
  background: #f0b344;
  border-radius: 50%;
  opacity: .3;
}
.tiles-panel::after {
  content: '';
  position: absolute;
  left: -18px; bottom: -18px;
  width: 50px; height: 50px;
  background: #8b5cf6;
  border-radius: 12px;
  transform: rotate(20deg);
  opacity: .35;
}
.tiles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  position: relative;
  z-index: 1;
}
.tile {
  background: transparent;
  color: #fff;
  border: none;
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: background .15s;
  text-decoration: none;
}
.tile:hover { background: rgba(255,255,255,.08); }
.tile-icon {
  font-size: 1.7rem;
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.08);
  border-radius: 14px;
  position: relative;
}
.tile-label { font-size: 0.85rem; font-weight: 500; }
.tile-badge {
  position: absolute;
  top: -4px; right: -8px;
  background: var(--pink);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

/* --------- tarjetas de aviso (listado / destacados) --------- */

.card-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 10px;
}
/* Cuando el listado vive dentro de una .app-section (home destacados),
 * la sección ya aporta el inset lateral — evitamos doblarlo. */
.app-section .card-list { padding: 0; }

/* Tarjeta grande con foto arriba y datos abajo. */
.aviso-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  color: var(--text);
  display: block;
}
.aviso-card:hover { box-shadow: var(--shadow-md); }

.aviso-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #eef0fa center/cover no-repeat;
  /* Marco blanco de 1px con esquinas redondeadas en los 4 lados
   * (antes solo iban redondeadas las de arriba). El pequeño margen
   * separa la foto del borde de la card, dejando un anillo blanco
   * visible que enmarca la imagen. */
  border: 1px solid #fff;
  border-radius: var(--radius-sm);
  margin: 6px 6px 0;
  overflow: hidden;
}
.aviso-media img {
  width: 100%; height: 100%; object-fit: cover;
}
.aviso-ribbon {
  position: absolute; top: 10px; left: 10px;
  background: var(--pink-soft);
  color: var(--pink);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.aviso-fav {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px;
  background: rgba(255,255,255,.85);
  color: var(--pink);
  border: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
}

.aviso-body { padding: 12px 14px 14px; }
.aviso-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.aviso-precio {
  color: var(--pink);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.aviso-precio .per { color: var(--muted); font-weight: 500; font-size: 0.75rem; }

.aviso-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 6px;
}
.aviso-meta .dot { color: #cfd3e5; }

.aviso-badges {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}
.aviso-badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}
.aviso-badge.op-venta    { background: var(--navy); color: #fff; }
.aviso-badge.op-alquiler { background: var(--mint-soft); color: #128473; }
.aviso-badge.tipo        { background: var(--lilac); color: #6b5cb8; }

/* Tarjeta más chica horizontal (jobs / listado angosto). */
.aviso-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  align-items: center;
  color: var(--text);
}
.aviso-row-thumb {
  width: 84px; height: 84px;
  border-radius: var(--radius-sm);
  background: #eef0fa center/cover no-repeat;
  overflow: hidden;
}
.aviso-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.aviso-row-body { min-width: 0; }
.aviso-row-title {
  font-weight: 700; font-size: 0.95rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------- CTA banner (Post a Job / Publica tu aviso) --------- */

.cta-panel {
  margin: 22px 10px 4px;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-panel::after {
  content: '';
  position: absolute;
  right: -25px; bottom: -25px;
  width: 60px; height: 60px;
  background: #f0b344;
  border-radius: 50%;
  opacity: .3;
}
.cta-title { font-weight: 600; margin-bottom: 12px; font-size: 0.95rem; }
.cta-btn {
  display: inline-block;
  background: var(--pink);
  color: #fff;
  padding: 10px 30px;
  border-radius: 99px;
  font-weight: 700;
  border: none;
  text-decoration: none;
  font-size: 0.9rem;
}
.cta-btn:hover { background: var(--pink-h); }

/* --------- filtros / listado --------- */

.list-toolbar {
  display: flex;
  gap: 8px;
  padding: 14px 10px 4px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.list-toolbar::-webkit-scrollbar { display: none; }
.list-toolbar .btn-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  cursor: pointer;
}
.list-toolbar .btn-toolbar.active {
  background: var(--navy); color: #fff; border-color: var(--navy);
}

/* empty state (No results — como el mockup) */
.empty-state {
  padding: 60px 30px;
  text-align: center;
  color: var(--muted);
}
.empty-state h3 {
  color: var(--text);
  margin-bottom: 6px;
  font-size: 1rem;
  font-weight: 700;
}
.empty-state p { font-size: 0.85rem; margin-bottom: 12px; }
.empty-state a { color: var(--pink); font-weight: 600; }

/* --------- detalle --------- */

/* Wrapper que contiene todo el aviso (foto + galería + título + ficha +
 * publicado por). Se lee como una .aviso-card "abierta" al hacer tap:
 * misma superficie blanca, mismas esquinas redondeadas y misma sombra
 * suave que las cards del listado. */
.detalle-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin: 12px 10px 0;
}

.detalle-hero {
  background: var(--surface);
  overflow: hidden;
  position: relative;
}
.detalle-hero img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #eef0fa;
}
.detalle-fav-lg {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,.9);
  color: var(--pink);
  border: none;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.detalle-body { padding: 16px 14px; }
.detalle-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 6px; }
.detalle-precio { color: var(--pink); font-weight: 700; font-size: 1.35rem; margin-bottom: 12px; }
.detalle-precio .per { color: var(--muted); font-weight: 500; font-size: 0.85rem; }

.detalle-section {
  padding: 0 14px;
  margin-bottom: 16px;
}
.detalle-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.detalle-section p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.spec {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
}
.spec .k { color: var(--muted); display: block; margin-bottom: 2px; font-size: 0.75rem; }
.spec .v { color: var(--text); font-weight: 600; }

.tags-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.tag {
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--pink-soft);
  color: var(--pink);
}
.tag.mint  { background: var(--mint-soft); color: #128473; }
.tag.lilac { background: var(--lilac);     color: #6b5cb8; }
.tag.yellow { background: var(--yellow-soft); color: #a16207; }

/* Barra de acciones al final del detalle. Vive dentro de .detalle-card
 * como sección interna: padding propio, sin margen externo. */
.detalle-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px 14px 16px;
}
.detalle-actions a {
  padding: 14px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.detalle-actions .btn-call  { background: var(--pink); color: #fff; }
.detalle-actions .btn-mail  { background: var(--navy); color: #fff; }

/* --------- galería mini abajo del hero --------- */
.gallery-strip {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 14px 12px;
  scrollbar-width: none;
}
.gallery-strip::-webkit-scrollbar { display: none; }
.gallery-strip img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
}
.gallery-strip img.active { border-color: var(--pink); }

/* --------- bottom nav flotante --------- */

/* Barra pill flotante: separada del borde inferior y con espacio a los
 * dos costados, para que "levite" sobre el contenido. */
.app-nav {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: calc(100% - 20px);
  max-width: 460px;      /* app-shell (480) - 10 - 10 */
  background: var(--surface);
  border-radius: 99px;
  box-shadow: 0 12px 32px rgba(16, 22, 54, 0.18),
              0 2px 8px  rgba(16, 22, 54, 0.08);
  display: flex;
  padding: 8px;
  z-index: 50;
}
.app-nav-item {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.66rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 99px;
  transition: color .15s, background .15s;
}
.app-nav-item i { font-size: 1.1rem; }
.app-nav-item:hover  { color: var(--text); }
.app-nav-item.active {
  color: #fff;
  background: var(--pink);
}
.app-nav-item.active i { color: #fff; }

/* --------- utility --------- */

.center { text-align: center; }
.hide-desktop { display: block; }

@media (min-width: 640px) {
  body { padding: 20px 0; }
  .app-shell {
    box-shadow: var(--shadow-lg);
    border-radius: 32px;
    overflow: hidden;
    min-height: calc(100vh - 40px);
  }
}
