/* ═══ view-home.css ═══
   Vista del Home: hero, stats, toolbar, grid de tarjetas, modales
   asociados (borrado y "nueva propiedad"), empty-state.
   Tres bloques cronológicos sucesivos en orden estricto:
   (1) Home v2  (2) Delete property — s13  (3) Fase 2 del 14.13.
   El orden interno NO se altera — la cascade depende de él.
   Depende de: tokens.css, base.css, layout.css, components.css.
   ═══════════════════════════════════════════════════════════════ */

/* ═══ Home v2 — Hero + Stats + Cards Grid (s32, Bloque 4) ═══ */

/* ── Hero banner ── */
.home-hero {
  background: linear-gradient(135deg, var(--c-primary-light) 0%, var(--c-bg) 50%, #EDE3DA 100%);
  border-bottom: 1px solid var(--c-border);
  padding: 0 20px;
}
.home-hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 28px 0 24px;
}
.home-hero-greeting {
  font-size: 13px;
  color: var(--c-primary-dark);
  margin-bottom: 4px;
}
.home-hero-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 6px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.home-hero-sub {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
  max-width: 480px;
}
.home-hero-sub strong {
  color: var(--c-primary-dark);
  font-weight: 600;
}
.home-hero-cta {
  gap: 6px;
}

/* ── Home page override ── */
.home-page {
  padding-top: 20px;
}

/* ── Stats row ── */
.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.home-stat {
  background: var(--c-bg2);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.home-stat-label {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-bottom: 4px;
}
.home-stat-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--c-text);
}

/* ── Toolbar ── */
.home-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.home-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text);
}

/* ── Property cards grid ── */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  /* Reserva de hueco: mientras home.js no ha pintado las tarjetas (o el
     empty-state), el grid está vacío. Le damos un alto mínimo para que el
     contenido no colapse a 0 y luego se expanda de golpe empujando el pie.
     Si hay más contenido del que cabe, el min-height no estorba. */
  min-height: 320px;
  /* Con pocas tarjetas (1 sola fila más baja que el min-height), el
     align-content por defecto (stretch) repartía el sobrante estirando
     esa fila hasta los 320px; align-items:stretch hacía entonces que las
     tarjetas llenaran la fila y quedaran altas. `start` apila las filas
     arriba a su altura de contenido sin estirarlas: las tarjetas mantienen
     la misma altura compacta que con 4+ (la igualación por fila la sigue
     dando align-items:stretch). El min-height solo reserva hueco. */
  align-content: start;
}

/* ── Property card ── */
.prop-card {
  position: relative;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  background: #FFFFFF;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.prop-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--c-border-hover);
}
.prop-card:active {
  transform: translateY(0);
}

/* Card top: icon + type + date */
.prop-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  /* Reserva la zona de la papelera (absolute, 30px @ right:8px): sin esto el
     texto de estado («Borrador») o la fecha, alineados a la derecha de esta
     fila, se superponen con el icono de eliminar. Deja hueco en todo ancho. */
  padding-right: 32px;
}
.prop-card-ico {
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--c-primary-light);
  color: var(--c-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.prop-card-ico svg { width: 16px; height: 16px; }
.prop-card-meta {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.prop-card-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-primary-dark);
  text-transform: capitalize;
}
.prop-card-date {
  font-size: 11px;
  color: var(--c-text-light);
}
/* Badge "Borrador": reutiliza la clase .pd-action-card-badge de la vista de
   propiedad, que es position:absolute (top/right) pensada para OTRO contenedor.
   En la tarjeta del Home eso lo anclaba a .prop-card justo sobre la papelera.
   Lo devolvemos al flujo de .prop-card-top para que se alinee con tipo/fecha y
   quede dentro de la zona reservada por el padding-right, sin pisar la papelera. */
.prop-card .pd-action-card-badge {
  position: static;
  margin-left: auto;
  flex-shrink: 0;
}

/* Card body */
.prop-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--c-text);
}
.prop-card-sub {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-bottom: 10px;
}

/* Card action */
.prop-card-actions {
  display: flex;
  gap: 8px;
}
.prop-card-btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.prop-card-btn:hover {
  border-color: var(--c-border-hover);
  background: var(--c-bg2);
}
.prop-card-btn-primary {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}
.prop-card-btn-primary:hover {
  background: var(--c-primary-hover);
}

/* ── Empty state ── */
.home-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 20px 44px;
  text-align: center;
}
.home-empty-ill {
  width: 140px;
  height: 110px;
  margin-bottom: 20px;
}
.home-empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 6px;
}
.home-empty-sub {
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: 18px;
  max-width: 320px;
  line-height: 1.5;
}

/* ── Card fade-in animation ── */
@keyframes homeCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.prop-card {
  animation: homeCardIn 0.3s ease-out both;
}
.prop-card:nth-child(2) { animation-delay: 0.05s; }
.prop-card:nth-child(3) { animation-delay: 0.10s; }
.prop-card:nth-child(4) { animation-delay: 0.15s; }
.prop-card:nth-child(5) { animation-delay: 0.20s; }
.prop-card:nth-child(6) { animation-delay: 0.25s; }

/* ── Home responsive ── */
@media (max-width: 640px) {
  .home-hero-inner { padding: 20px 0 18px; }
  .home-hero-title { font-size: 19px; }
  .home-hero-sub { font-size: 12.5px; }
  .home-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .home-stat { padding: 10px 10px; }
  .home-stat-label { font-size: 10px; }
  .home-stat-value { font-size: 17px; }
  .home-grid { grid-template-columns: 1fr; }
  .prop-card { padding: 14px 16px; }
  .prop-card-title { font-size: 14px; }
}

/* ═══ Delete property — s13 additions ═══
   ═════════════════════════════════════════ */
 
/* Trash button on property card */
.prop-card {
  position: relative;
}
 
.prop-card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--c-text-muted, #999);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  z-index: 2;
  padding: 0;
}
 
.prop-card:hover .prop-card-delete,
.prop-card-delete:focus-visible {
  opacity: 1;
}
 
.prop-card-delete:hover {
  background: var(--c-danger-bg);
  color: var(--c-danger);
}
 
/* Touch devices: always visible */
@media (hover: none) {
  .prop-card-delete {
    opacity: 0.7;
  }
}
 
/* Delete confirmation modal */
.delete-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  transition: background 0.2s ease, backdrop-filter 0.2s ease;
  padding: 16px;
}
 
.delete-modal-overlay.active {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}
 
.delete-modal-box {
  background: var(--c-surface, #FFFFFF);
  border-radius: 14px;
  padding: 28px 24px 20px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
 
.delete-modal-overlay.active .delete-modal-box {
  transform: scale(1);
  opacity: 1;
}
 
.delete-modal-icon {
  margin-bottom: 12px;
}
 
.delete-modal-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--c-text, #1a1a1a);
  margin: 0 0 8px;
}
 
.delete-modal-text {
  font-size: 14px;
  color: var(--c-text-muted, #666);
  margin: 0 0 20px;
  line-height: 1.5;
}
 
.delete-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
 
.delete-modal-actions .btn {
  flex: 1;
  max-width: 150px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, opacity 0.15s ease;
}
 
/* ═══ Fase 2 del refactor 14.13 — Home rehecho a propiedades (v67) ═══
   Anexar al final de css/styles.css.

   Tres bloques nuevos:
     1. Tarjeta de propiedad: franja de color superior + resumen de
        acciones al pie + papelera (las dos primeras nuevas; la papelera
        reusa los estilos .prop-card-delete del bloque anterior).
     2. Modal "Nueva propiedad": cuadro con campo nombre obligatorio
        y selector de color por swatches.
     3. Las tarjetas de propiedad ya no son clicables en el cuerpo
        (Fase 2 todavía no tiene vista de propiedad). Cursor por
        defecto y override del hover-translate de .prop-card existente.
   ═══════════════════════════════════════════════════════════ */

/* ── Franja superior de color en la tarjeta ── */

.prop-card-property {
  /* La tarjeta de propiedad lleva la franja de color en el borde
     superior interior. Padding-top reducido para que la franja no
     empuje el contenido. */
  padding-top: 14px;
  position: relative;
  overflow: hidden;
}

.prop-card-color-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  /* background lo pone home.js inline con el hex elegido */
}

.prop-card-color-bar-empty {
  /* Sin color: la franja existe en el DOM para que la altura del
     resto del layout sea idéntica entre tarjetas con y sin color,
     pero queda invisible. */
  background: transparent;
}

/* ── Resumen de acciones al pie de la tarjeta ──
   Sustituye al bloque .prop-card-actions (botón "Ver textos") del
   modelo anterior. Aquí no hay botón porque las acciones se invocan
   desde la vista de propiedad (Fase 3); este bloque es solo informativo. */

.prop-card-actions-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 11.5px;
  color: var(--c-text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--c-border);
  margin-top: 4px;
  line-height: 1.4;
}

.prop-card-action {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.prop-card-action.done {
  color: var(--c-text);
  font-weight: 500;
}

.prop-card-action.pending {
  color: var(--c-text-light);
}

/* Separador entre acciones. Usamos un span vacío con :before en lugar
   del · inline para tener control fino del color y el espaciado. No
   queremos un · entre la última pending y nada, así que solo añadimos
   antes de cada hermano que NO sea el primero. */
.prop-card-action + .prop-card-action::before {
  content: '·';
  color: var(--c-text-light);
  margin-right: 6px;
}

/* ═══ Modal "Nueva propiedad" (np-) ═══
   Plantilla similar al modal de borrado (.delete-modal-*) pero con
   form interno: campo nombre + selector de swatches de color.
   Prefijo `np-` para no chocar con otros modales del proyecto. */

.np-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  transition: background 0.2s ease, backdrop-filter 0.2s ease;
  padding: 16px;
}

.np-modal-overlay.active {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.np-modal-box {
  position: relative;
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  padding: 32px 28px 24px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.15s ease;
}

/* Tinte sutil del panel entero según el color elegido en los swatches.
   El JS fija la variable inline --np-tint-color al hex del swatch; sin
   selección o con «Sin color» la variable no existe y el panel queda blanco.
   El fondo se deriva claro (12% del color sobre blanco): perceptible como
   feedback pero sin ensuciar ni comprometer la legibilidad de textos,
   inputs y botones. Sin duplicar una regla por color. */
.np-modal-box[style*="--np-tint-color"] {
  background: color-mix(in srgb, var(--np-tint-color) 12%, #fff);
}

.np-modal-overlay.active .np-modal-box {
  transform: scale(1);
  opacity: 1;
}

.np-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 22px;
  color: var(--c-text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.np-modal-close:hover {
  background: var(--c-bg2);
  color: var(--c-text);
}

.np-modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--c-text);
}

.np-modal-note {
  font-size: 13.5px;
  color: var(--c-text);
  margin: 0 0 20px;
  line-height: 1.5;
  background: var(--c-primary-subtle);
  border: 1px solid var(--c-primary-light);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 12px;
}

.np-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

.np-modal-actions .btn {
  min-width: 110px;
}

/* ── Selector de swatches de color ── */

.np-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.np-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.np-swatch:hover {
  transform: scale(1.08);
}

.np-swatch.selected {
  border-color: var(--c-text);
  box-shadow: 0 0 0 2px #fff inset;
}

/* Variante "sin color" — círculo con guion centrado para que se
   distinga de los demás swatches y tenga estado visual cuando esté
   seleccionado. */
.np-swatch-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--c-text-muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .np-modal-box {
    padding: 24px 20px 18px;
  }
  .np-modal-title {
    font-size: 18px;
  }
  .np-swatch {
    width: 30px;
    height: 30px;
  }
}

/* ═══ Home: guía de pasos + tarjetas sin datos (solo presentación) ═══
   Bloque anexado al final para no alterar el orden de cascada de los
   bloques cronológicos anteriores. Selectores nuevos; el único override
   intencionado es `.prop-card-needs-data` sobre el border-color de
   `.prop-card` (misma especificidad, gana por orden posterior).
   Usa exclusivamente tokens vigentes de tokens.css.
   ═══════════════════════════════════════════════════════════════ */

/* ── Tira informativa "cómo funciona" (Home hero) ──
   Tres pasos en fila, número en círculo de acento + etiqueta. Solo
   informativa: no clicable, sin estado. Se intercala entre el subtítulo
   del hero y el CTA "Nueva propiedad". */
.home-how {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-bottom: 18px;
}
.home-how-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.home-how-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.home-how-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
}

@media (max-width: 640px) {
  .home-how { gap: 8px 16px; margin-bottom: 14px; }
  .home-how-text { font-size: 12.5px; }
}

/* ── Pie "empieza aquí" para tarjetas sin datos ──
   Sustituye al resumen de acciones (.prop-card-actions-summary) en las
   tarjetas cuya propiedad aún no tiene datos cacheados. Pie destacado con
   fondo de acento suave + flecha a la derecha. No es un botón: la tarjeta
   entera ya es clicable y abre la propiedad. */
.prop-card-empty-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}
.prop-card-empty-cta-arrow {
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.prop-card:hover .prop-card-empty-cta-arrow {
  transform: translateX(3px);
}

/* Borde fino de acento en la tarjeta sin datos para que destaque como
   "empieza por aquí". Override del border-color de .prop-card. */
.prop-card-needs-data {
  border-color: var(--c-primary);
}
