/*
 * Diseño Premium — catálogo de propiedades.
 *
 * Sistema propio y autocontenido: no depende del CSS antiguo ni pelea con él,
 * porque las plantillas premium usan sus propias clases (.rfp-*). Se apoya en
 * las variables de paleta del plugin (--rf-primary, --rf-accent, --rf-font,
 * --rf-radius), así que todo lo que el admin configure sigue mandando.
 *
 * Criterios:
 *  - La foto manda. En inmobiliaria la imagen vende, así que ocupa el máximo
 *    espacio posible y el texto se ordena a su alrededor.
 *  - El precio es el segundo elemento en jerarquía, nunca escondido.
 *  - Movimiento contenido: transiciones cortas y respeto a prefers-reduced-motion.
 *  - Contraste AA en todos los textos, también sobre imagen.
 */

/* ── Tokens ────────────────────────────────────────────────────────────────── */

.rfp {
    --rfp-ink:        var(--rf-text, #16181d);
    --rfp-muted:      var(--rf-text-muted, #6b7280);
    --rfp-line:       var(--rf-border, #e6e8ec);
    --rfp-bg:         var(--rf-bg, #ffffff);
    --rfp-soft:       var(--rf-bg-soft, #f6f7f9);
    --rfp-brand:      var(--rf-primary, #16181d);
    --rfp-accent:     var(--rf-accent, #1c7fb5);
    --rfp-radius:     var(--rf-radius, 16px);
    --rfp-radius-sm:  calc(var(--rf-radius, 16px) * .6);
    --rfp-shadow:     0 1px 2px rgba(16,24,40,.04), 0 12px 32px -12px rgba(16,24,40,.18);
    --rfp-shadow-lg:  0 2px 4px rgba(16,24,40,.04), 0 28px 60px -20px rgba(16,24,40,.28);
    --rfp-gap:        clamp(16px, 2vw, 26px);

    font-family: var(--rf-font, inherit);
    color: var(--rfp-ink);
    max-width: none;
}

.rfp *, .rfp *::before, .rfp *::after { box-sizing: border-box; }
.rfp img { max-width: 100%; display: block; }

/* Se escapa del contenedor estrecho de los temas de bloques. */
.rfp, .rfp > * { max-width: none !important; }

/* ── Tarjeta de propiedad ──────────────────────────────────────────────────── */

.rfp-grid {
    display: grid;
    grid-template-columns: repeat(var(--rf-cols, 3), minmax(0, 1fr));
    gap: var(--rfp-gap);
    padding: 0;
    margin: 0;
    list-style: none;
}

.rfp-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--rfp-bg);
    border: 1px solid var(--rfp-line);
    border-radius: var(--rfp-radius);
    overflow: hidden;
    transition: transform .28s cubic-bezier(.2,.7,.3,1), box-shadow .28s, border-color .28s;
}

.rfp-card:hover,
.rfp-card:focus-within {
    transform: translateY(-4px);
    box-shadow: var(--rfp-shadow-lg);
    border-color: transparent;
}

/* Enlace que cubre toda la tarjeta: clicable entera sin anidar <a> dentro de <a>. */
.rfp-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}
.rfp-card__link { text-decoration: none !important; color: inherit !important; }

.rfp-card__media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--rfp-soft);
}
.rfp-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s cubic-bezier(.2,.7,.3,1);
}
.rfp-card:hover .rfp-card__media img { transform: scale(1.05); }

/* Degradado inferior: sostiene el precio sobre cualquier foto. */
.rfp-card__media::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 45%;
    background: linear-gradient(180deg, rgba(10,12,16,0) 0%, rgba(10,12,16,.72) 100%);
    pointer-events: none;
}

/*
 * Precio y etiquetas van por encima del degradado pero NO deben capturar el
 * clic: si lo hicieran, pulsar justo sobre el precio no abriría la ficha.
 */
.rfp-card__price,
.rfp-badges { pointer-events: none; }

.rfp-card__price {
    position: absolute;
    left: 14px;
    bottom: 12px;
    z-index: 2;
    color: #fff;
    font-size: clamp(1.05rem, 1.5vw, 1.35rem);
    font-weight: 700;
    letter-spacing: -.01em;
    text-shadow: 0 1px 12px rgba(0,0,0,.4);
}
.rfp-card__price sup { font-size: 58%; font-weight: 500; opacity: .85; }

.rfp-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.rfp-badge {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.94);
    color: #16181d;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .02em;
    text-transform: uppercase;
    backdrop-filter: blur(6px);
    box-shadow: 0 1px 3px rgba(0,0,0,.14);
}
.rfp-badge--accent { background: var(--rfp-accent); color: #fff; }

/* Favorito: encima del enlace que cubre la tarjeta. */
.rfp-card .rf-fav-toggle-card,
.rfp-card__fav {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
}

.rfp-card__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 16px 18px;
    flex: 1 1 auto;
}

.rfp-card__title {
    margin: 0;
    font-size: 15.5px;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: -.005em;
    color: var(--rfp-ink);
    text-transform: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rfp-card__place {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--rfp-muted);
    min-width: 0;
}
.rfp-card__place span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Fila de características ───────────────────────────────────────────────── */

.rfp-specs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--rfp-line);
    font-size: 13px;
    color: var(--rfp-ink);
}
.rfp-spec {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.rfp-spec b { font-weight: 650; }
.rfp-spec small { color: var(--rfp-muted); font-size: 12.5px; font-weight: 400; }

.rfp-card__ref {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--rfp-muted);
    letter-spacing: .03em;
    font-variant-numeric: tabular-nums;
}

/* ── Iconos (máscara SVG: heredan currentColor, nítidos en retina) ─────────── */

.rfp-i {
    width: 16px; height: 16px; flex: none;
    display: inline-block;
    background: currentColor;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center;  mask-position: center;
    -webkit-mask-size: contain;     mask-size: contain;
    color: var(--rfp-muted);
}
.rfp-i--bed  { -webkit-mask-image: var(--i-bed);  mask-image: var(--i-bed); }
.rfp-i--bath { -webkit-mask-image: var(--i-bath); mask-image: var(--i-bath); }
.rfp-i--area { -webkit-mask-image: var(--i-area); mask-image: var(--i-area); }
.rfp-i--pin  { -webkit-mask-image: var(--i-pin);  mask-image: var(--i-pin); }
.rfp-i--plot { -webkit-mask-image: var(--i-plot); mask-image: var(--i-plot); }

.rfp {
    --i-bed:  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'><path d='M3 18v-6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6'/><path d='M3 18h18'/><path d='M6 10V7a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3'/><path d='M12 10V7a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3'/></svg>");
    --i-bath: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'><path d='M4 12h16v3a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4v-3Z'/><path d='M6 12V6a2 2 0 0 1 4 0'/><path d='M6 19l-1 2M18 19l1 2'/></svg>");
    --i-area: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='2'/><path d='M9 3v4M3 9h4M15 21v-4M21 15h-4'/></svg>");
    --i-pin:  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'><path d='M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z'/><circle cx='12' cy='10' r='2.6'/></svg>");
    --i-plot: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'><path d='m3 7 9-4 9 4-9 4-9-4Z'/><path d='m3 12 9 4 9-4M3 17l9 4 9-4'/></svg>");
}

/* ── Ficha: portada ────────────────────────────────────────────────────────── */

.rfp-detail { display: block; }

.rfp-hero {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 8px;
    aspect-ratio: 21 / 9;
    min-height: 320px;
    max-height: 560px;
    border-radius: var(--rfp-radius);
    overflow: hidden;
    background: var(--rfp-soft);
}
.rfp-hero__item { position: relative; overflow: hidden; margin: 0; }
.rfp-hero__item:first-child { grid-row: span 2; }
.rfp-hero__item img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .5s cubic-bezier(.2,.7,.3,1), filter .3s;
}
.rfp-hero__item:hover img { transform: scale(1.04); }

/* Cuando solo hay una foto, ocupa todo el ancho. */
.rfp-hero--single { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.rfp-hero--single .rfp-hero__item:first-child { grid-row: auto; }

.rfp-hero__more {
    position: absolute;
    right: 14px; bottom: 14px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.95);
    color: #16181d;
    font: inherit;
    font-size: 13.5px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    backdrop-filter: blur(8px);
    transition: transform .2s, background .2s;
}
.rfp-hero__more:hover { transform: translateY(-2px); background: #fff; }

/* ── Ficha: cuerpo a dos columnas ─────────────────────────────────────────── */

.rfp-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: clamp(24px, 3.5vw, 52px);
    align-items: start;
    margin-top: clamp(24px, 3vw, 40px);
}

.rfp-head { margin-bottom: 22px; }
.rfp-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--rfp-muted);
    margin-bottom: 10px;
}
.rfp-title {
    margin: 0 0 12px;
    font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.6rem);
    line-height: 1.12;
    font-weight: 700;
    letter-spacing: -.022em;
    color: var(--rfp-ink);
}
.rfp-price-inline {
    font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem);
    font-weight: 700;
    color: var(--rfp-brand);
    letter-spacing: -.02em;
}
.rfp-price-inline sup { font-size: 55%; font-weight: 500; color: var(--rfp-muted); }

/* Tarjetas de datos clave */
.rfp-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 24px 0;
}
.rfp-fact {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: var(--rfp-soft);
    border: 1px solid var(--rfp-line);
    border-radius: var(--rfp-radius-sm);
}
.rfp-fact__v {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.1;
}
.rfp-fact__l {
    font-size: 12.5px;
    color: var(--rfp-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.rfp-section { margin: clamp(28px, 4vw, 46px) 0; }
.rfp-section > h2 {
    margin: 0 0 16px;
    font-size: clamp(1.15rem, 1rem + .5vw, 1.45rem);
    font-weight: 650;
    letter-spacing: -.015em;
}
.rfp-prose {
    font-size: 15.5px;
    line-height: 1.72;
    color: #3f4451;
    max-width: 68ch;
}
.rfp-prose p { margin: 0 0 1em; }

/* Descripción plegable */
.rfp-prose--clamped {
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rfp-more {
    margin-top: 10px;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    color: var(--rfp-accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Características como etiquetas */
.rfp-feature-group { margin-bottom: 20px; }
.rfp-feature-group h3 {
    margin: 0 0 10px;
    font-size: 12.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--rfp-muted);
}
.rfp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rfp-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1px solid var(--rfp-line);
    border-radius: 999px;
    background: var(--rfp-bg);
    font-size: 13.5px;
    color: var(--rfp-ink);
}
.rfp-chip::before {
    content: "";
    width: 14px; height: 14px; flex: none;
    background: var(--rfp-accent);
    -webkit-mask: var(--i-check) center/contain no-repeat;
    mask: var(--i-check) center/contain no-repeat;
}
.rfp { --i-check: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='m4 12.5 5 5L20 6.5'/></svg>"); }

.rfp-map {
    border-radius: var(--rfp-radius-sm);
    overflow: hidden;
    border: 1px solid var(--rfp-line);
    line-height: 0;
}
.rfp-map iframe { width: 100%; height: 380px; border: 0; display: block; }

/* ── Ficha: columna de contacto ───────────────────────────────────────────── */

.rfp-rail { position: sticky; top: 24px; }

.rfp-cta {
    background: var(--rfp-bg);
    border: 1px solid var(--rfp-line);
    border-radius: var(--rfp-radius);
    box-shadow: var(--rfp-shadow);
    overflow: hidden;
}
.rfp-cta__head {
    padding: 20px 22px 18px;
    border-bottom: 1px solid var(--rfp-line);
    background: var(--rfp-soft);
}
.rfp-cta__price {
    font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -.022em;
    color: var(--rfp-brand);
    line-height: 1.1;
}
.rfp-cta__ref { margin-top: 6px; font-size: 12.5px; color: var(--rfp-muted); }
.rfp-cta__body { padding: 20px 22px 22px; }
.rfp-cta__body > h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -.01em;
}
.rfp-cta__sub { margin: 0 0 16px; font-size: 13.5px; color: var(--rfp-muted); line-height: 1.5; }

/* Formulario dentro del panel */
.rfp-cta .rf-lead-form p { margin: 0 0 10px; }
.rfp-cta .rf-lead-form input[type='text'],
.rfp-cta .rf-lead-form input[type='email'],
.rfp-cta .rf-lead-form input[type='tel'],
.rfp-cta .rf-lead-form textarea,
.rfp-cta .contact-form input,
.rfp-cta .contact-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--rfp-line);
    border-radius: var(--rfp-radius-sm);
    font-family: inherit;
    font-size: 14.5px;
    background: var(--rfp-bg);
    color: var(--rfp-ink);
    transition: border-color .15s, box-shadow .15s;
}
.rfp-cta .rf-lead-form input:focus,
.rfp-cta .rf-lead-form textarea:focus {
    border-color: var(--rfp-accent);
    outline: 0;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--rfp-accent) 16%, transparent);
}
.rfp-cta .rf-lead-form button[type='submit'] {
    width: 100%;
    min-height: 50px;
    border: 0;
    border-radius: var(--rfp-radius-sm);
    background: var(--rfp-brand);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    cursor: pointer;
    transition: transform .15s, background .2s, box-shadow .2s;
}
.rfp-cta .rf-lead-form button[type='submit']:hover {
    background: var(--rfp-accent);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--rfp-accent) 70%, transparent);
}
.rfp-cta .rf-consent { font-size: 12.5px; color: var(--rfp-muted); line-height: 1.5; }

/* Barra de acciones (guardar / compartir / aviso de precio) */
.rfp-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--rfp-line);
}
.rfp-actions .rf-btn {
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid var(--rfp-line) !important;
    border-radius: var(--rfp-radius-sm);
    background: var(--rfp-bg);
    color: var(--rfp-ink);
    font-size: 13.5px;
    font-weight: 600;
}

/* ── Barra móvil fija con precio y contacto ───────────────────────────────── */

.rfp-sticky-bar {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 60;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--rfp-line);
    box-shadow: 0 -6px 24px rgba(16,24,40,.1);
}
.rfp-sticky-bar__price { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.rfp-sticky-bar__ref { font-size: 12px; color: var(--rfp-muted); }
.rfp-sticky-bar a {
    display: inline-flex;
    align-items: center;
    height: 46px;
    padding: 0 22px;
    border-radius: 999px;
    background: var(--rfp-brand);
    color: #fff !important;
    font-size: 14.5px;
    font-weight: 650;
    text-decoration: none !important;
    white-space: nowrap;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
    .rfp-body { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (max-width: 1024px) {
    .rfp-grid { grid-template-columns: repeat(min(var(--rf-cols, 3), 2), minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .rfp-body { grid-template-columns: 1fr; }
    .rfp-rail { position: static; }
    .rfp-hero {
        grid-template-columns: 1fr 1fr;
        aspect-ratio: 4 / 3;
        max-height: 420px;
    }
    .rfp-hero__item:first-child { grid-column: span 2; }
    .rfp-hero__item:nth-child(n+4) { display: none; }
    .rfp-sticky-bar { display: flex; }
    /* Hueco para que la barra fija no tape el final del contenido. */
    .rfp-detail { padding-bottom: 84px; }
}

@media (max-width: 620px) {
    .rfp-grid { grid-template-columns: 1fr; }
    .rfp-hero { aspect-ratio: 3 / 2; min-height: 240px; }
    .rfp-hero__item:nth-child(n+3) { display: none; }
    .rfp-facts { grid-template-columns: repeat(2, 1fr); }
}

/* ── Accesibilidad ────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .rfp *, .rfp *::before, .rfp *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
    .rfp-card:hover { transform: none; }
    .rfp-card:hover .rfp-card__media img { transform: none; }
}

.rfp a:focus-visible,
.rfp button:focus-visible,
.rfp input:focus-visible,
.rfp .rfp-card__link:focus-visible::after {
    outline: 2px solid var(--rfp-accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Paleta oscura (skin "midnight"): el panel y las tarjetas se adaptan. */
.resalesfull-skin-midnight .rfp-badge { background: rgba(28,30,38,.92); color: #f2f2f2; }
.resalesfull-skin-midnight .rfp-sticky-bar { background: rgba(20,21,26,.97); }
.resalesfull-skin-midnight .rfp-prose { color: #c7cad3; }
