/**
 * HOMQI - Propiedades Destacadas v2.0
 * Diseño premium: card blanca, badges duales, specs con iconos, copy button, CTA full-width.
 *
 * Paleta:
 *   - Fondo sección: #0f1d24
 *   - Fondo card:    #ffffff
 *   - Acento dorado: #E3A708
 *   - Texto card:    #0f1d24 (oscuro sobre blanco)
 *   - Texto muted:   #6b7280
 */

/* ========================================
   VARIABLES Y BASE
   ======================================== */
.homqi-pd-section {
    --homqi-pd-accent: #E3A708;
    --homqi-pd-accent-rgb: 227, 167, 8;
    --homqi-pd-section-bg: #0f1d24;
    --homqi-pd-card-bg: #ffffff;
    --homqi-pd-text-light: #ffffff;
    --homqi-pd-text-muted: #9ca8b5;
    --homqi-pd-text-dark: #0f1d24;
    --homqi-pd-text-meta: #6b7280;
    --homqi-pd-text-category: #9ca3af;
    --homqi-pd-font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --homqi-pd-font-serif: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;

    padding: 80px 0;
    background-color: var(--homqi-pd-section-bg);
    color: var(--homqi-pd-text-light);
    font-family: var(--homqi-pd-font-sans);
}

.homqi-pd-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

/* ========================================
   ENCABEZADO
   ======================================== */
.homqi-pd-header {
    text-align: center;
    margin-bottom: 56px;
}

.homqi-pd-eyebrow {
    font-family: var(--homqi-pd-font-sans);
    color: var(--homqi-pd-accent);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 4.5px;
    text-transform: uppercase;
    line-height: 1.4;
    margin-bottom: 16px;
}

.homqi-pd-title {
    font-family: var(--homqi-pd-font-sans);
    color: var(--homqi-pd-text-light);
    font-size: clamp(28px, 4.5vw, 44px);
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    line-height: 1.1;
    margin: 0 0 20px;
}

.homqi-pd-subtitle {
    font-family: var(--homqi-pd-font-sans);
    color: var(--homqi-pd-text-muted);
    font-size: 16px;
    line-height: 1.6;
    max-width: 640px;
    margin: 0 auto;
}

/* ========================================
   GRID
   ======================================== */
.homqi-pd-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols-desk, 3), minmax(0, 1fr));
    gap: var(--gap, 24px);
}

@media (max-width: 1024px) {
    .homqi-pd-grid {
        grid-template-columns: repeat(var(--cols-tab, 2), minmax(0, 1fr));
        gap: var(--gap, 24px);
    }
}

@media (max-width: 640px) {
    .homqi-pd-grid {
        grid-template-columns: repeat(var(--cols-mob, 1), minmax(0, 1fr));
        gap: 20px;
    }
    .homqi-pd-section { padding: 56px 0; }
}

/* ========================================
   CARD
   ======================================== */
.homqi-pd-card {
    background-color: var(--homqi-pd-card-bg);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.homqi-pd-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* ========================================
   IMAGEN
   ======================================== */
.homqi-pd-card__image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: var(--aspect, 16/9);
    background-color: var(--homqi-pd-section-bg);
    /* IMPORTANTE: line-height 0 evita franja blanca de baseline del inline-image */
    line-height: 0;
    font-size: 0;
}

.homqi-pd-card__image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.homqi-pd-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.5s ease;
}

.homqi-pd-card:hover .homqi-pd-card__image {
    transform: scale(1.05);
}

/* ========================================
   BADGES (esquina superior izquierda)
   ======================================== */
.homqi-pd-card__badges {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 2;
    max-width: calc(100% - 80px); /* deja espacio para el copy button */
}

.homqi-pd-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-family: var(--homqi-pd-font-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.homqi-pd-badge--featured {
    background-color: var(--homqi-pd-accent);
    color: var(--homqi-pd-text-dark);
}

.homqi-pd-badge--action {
    background-color: var(--homqi-pd-accent);
    color: var(--homqi-pd-text-dark);
}

.homqi-pd-badge--offer {
    background-color: #e74c3c;
    color: #ffffff;
}

.homqi-pd-badge--new {
    background-color: #27ae60;
    color: #ffffff;
}

.homqi-pd-badge--default {
    background-color: rgba(15, 29, 36, 0.85);
    color: #ffffff;
}

/* ========================================
   BOTÓN COPIAR LINK (esquina superior derecha)
   Oculto por defecto, aparece en hover de la card
   ======================================== */
.homqi-pd-card__copy {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: rgba(15, 29, 36, 0.7);
    color: #dfdfdf;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    /* Estado oculto por defecto */
    opacity: 0;
    transform: translateY(-6px) scale(0.9);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.25s ease, color 0.25s ease;
}

/* Aparece al hacer hover sobre la IMAGEN (no toda la card) */
.homqi-pd-card__image-wrapper:hover .homqi-pd-card__copy,
.homqi-pd-card__image-wrapper:focus-within .homqi-pd-card__copy {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Mantener visible si está en estado "copiado" */
.homqi-pd-card__copy.is-copied {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    background-color: var(--homqi-pd-accent);
}

.homqi-pd-card__copy:hover {
    background-color: var(--homqi-pd-accent);
    transform: translateY(0) scale(1.08);
}

.homqi-pd-card__copy:hover svg {
    color: var(--homqi-pd-text-dark);
}

.homqi-pd-card__copy:active {
    transform: translateY(0) scale(0.95);
}

.homqi-pd-card__copy:focus-visible {
    outline: 2px solid var(--homqi-pd-accent);
    outline-offset: 2px;
}

.homqi-pd-card__copy svg {
    color: #dfdfdf;
    transition: color 0.25s ease, opacity 0.2s ease, transform 0.25s ease;
    /* Apilar los dos iconos en el mismo punto */
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%);
    width: 18px !important;
    height: 18px !important;
}

/* Estado normal: visible el de "documento", oculto el "check" */
.homqi-pd-card__copy .homqi-pd-card__copy-icon-default {
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
}

.homqi-pd-card__copy .homqi-pd-card__copy-icon-success {
    opacity: 0 !important;
    visibility: hidden !important;
    display: block !important; /* mantenido en flujo, oculto por opacity */
    transform: translate(-50%, -50%) scale(0.5);
}

/* Estado "copiado": invertir */
.homqi-pd-card__copy.is-copied .homqi-pd-card__copy-icon-default {
    opacity: 0 !important;
    visibility: hidden !important;
}

.homqi-pd-card__copy.is-copied .homqi-pd-card__copy-icon-success {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate(-50%, -50%) scale(1);
    color: var(--homqi-pd-text-dark);
}

.homqi-pd-card__copy.is-copied svg {
    color: var(--homqi-pd-text-dark);
}

@keyframes homqi-pd-pop {
    0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

/* En dispositivos táctiles siempre visible (no hay hover real) */
@media (hover: none) {
    .homqi-pd-card__copy {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }
}

/* Tooltip "Link copiado" */
.homqi-pd-card__copy-tooltip {
    position: absolute;
    top: 50%;
    right: calc(100% + 10px);
    transform: translateY(-50%);
    background-color: var(--homqi-pd-text-dark);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    letter-spacing: 0.3px;
}

.homqi-pd-card__copy-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-left-color: var(--homqi-pd-text-dark);
}

.homqi-pd-card__copy.is-copied .homqi-pd-card__copy-tooltip {
    opacity: 1;
}

/* ========================================
   PRECIO (esquina inferior izquierda sobre imagen)
   ======================================== */
.homqi-pd-card__price-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 60px 20px 20px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.4) 60%,
        transparent 100%
    );
    pointer-events: none;
}

.homqi-pd-card__price {
    font-family: var(--homqi-pd-font-sans);
    color: var(--homqi-pd-text-light);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.1;
}

/* ========================================
   BODY DE CARD
   ======================================== */
.homqi-pd-card__body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* TÍTULO */
.homqi-pd-card__title {
    font-family: var(--homqi-pd-font-serif);
    color: var(--homqi-pd-text-dark);
    font-size: 19px;
    font-weight: 500;
    line-height: 1.35;
    margin: 0 0 16px;
}

.homqi-pd-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.homqi-pd-card__title a:hover {
    color: var(--homqi-pd-accent);
}

/* SPECS (camas / baños / área) */
.homqi-pd-card__specs {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.homqi-pd-spec {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--homqi-pd-text-dark);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}

.homqi-pd-spec svg {
    color: var(--homqi-pd-accent);
    flex-shrink: 0;
}

/* CATEGORÍA */
.homqi-pd-card__category {
    color: var(--homqi-pd-text-category);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin: 0 0 16px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

/* META: AGENTE + FECHA */
.homqi-pd-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--homqi-pd-text-meta);
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 16px;
}

.homqi-pd-card__agent {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.homqi-pd-card__time {
    flex-shrink: 0;
    white-space: nowrap;
}

/* BOTÓN "VER DETALLES" full-width */
.homqi-pd-card__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    margin-top: auto;
    background-color: var(--homqi-pd-accent);
    color: var(--homqi-pd-text-dark);
    border-radius: 8px;
    font-family: var(--homqi-pd-font-sans);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    text-decoration: none;
    transition: background-color 0.25s ease, transform 0.25s ease, gap 0.25s ease;
    box-sizing: border-box;
}

.homqi-pd-card__cta:hover {
    background-color: #c98e07;
    gap: 12px;
}

.homqi-pd-card__cta svg {
    transition: transform 0.25s ease;
}

.homqi-pd-card__cta:hover svg {
    transform: translateX(3px);
}

/* ========================================
   ESTADO VACÍO (editor)
   ======================================== */
.homqi-pd-empty {
    padding: 60px 24px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #9ca8b5;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 480px) {
    .homqi-pd-card__body { padding: 20px; }
    .homqi-pd-card__price { font-size: 20px; }
    .homqi-pd-card__title { font-size: 18px; }
    .homqi-pd-card__specs { gap: 14px; }
    .homqi-pd-card__copy-tooltip {
        right: auto;
        left: 50%;
        top: calc(100% + 8px);
        transform: translateX(-50%);
    }
    .homqi-pd-card__copy-tooltip::after {
        top: auto;
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
        border-color: transparent transparent var(--homqi-pd-text-dark);
    }
}

/* ========================================
   CAROUSEL (Swiper integration)
   ======================================== */
.homqi-pd-carousel-wrap {
    position: relative;
    width: 100%;
}

.homqi-pd-swiper {
    width: 100%;
    overflow: hidden;
    /* Padding necesario para que el hover-lift de las cards no quede cortado por overflow */
    padding: 8px 4px 12px;
    margin: -8px -4px -12px;
}

.homqi-pd-swiper .swiper-wrapper {
    align-items: stretch;
}

.homqi-pd-swiper .swiper-slide {
    height: auto;
    display: flex;
}

.homqi-pd-swiper .swiper-slide > .homqi-pd-card {
    width: 100%;
}

/* --- FLECHAS BASE --- */
.homqi-pd-carousel-prev,
.homqi-pd-carousel-next {
    background: var(--homqi-pd-card-bg);
    color: var(--homqi-pd-text-dark);
    border: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.25s ease;
    z-index: 5;
}

.homqi-pd-carousel-prev:hover,
.homqi-pd-carousel-next:hover {
    background: var(--homqi-pd-accent);
    color: var(--homqi-pd-text-dark);
    transform: scale(1.08);
}

.homqi-pd-carousel-prev:disabled,
.homqi-pd-carousel-next:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.homqi-pd-carousel-prev.swiper-button-disabled,
.homqi-pd-carousel-next.swiper-button-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* --- POSICIÓN "OVERLAY" (sobre las cards, a los lados) --- */
.homqi-pd-arrows-overlay .homqi-pd-carousel-prev,
.homqi-pd-arrows-overlay .homqi-pd-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}
.homqi-pd-arrows-overlay .homqi-pd-carousel-prev {
    left: -16px;
}
.homqi-pd-arrows-overlay .homqi-pd-carousel-next {
    right: -16px;
}
.homqi-pd-arrows-overlay .homqi-pd-carousel-prev:hover {
    transform: translateY(-50%) scale(1.08);
}
.homqi-pd-arrows-overlay .homqi-pd-carousel-next:hover {
    transform: translateY(-50%) scale(1.08);
}

/* --- POSICIÓN "OUTSIDE" (debajo del carrusel, centradas) --- */
.homqi-pd-arrows-outside {
    padding-bottom: 0;
}
.homqi-pd-arrows-outside .homqi-pd-carousel-prev,
.homqi-pd-arrows-outside .homqi-pd-carousel-next {
    position: static;
    margin-top: 32px;
}
.homqi-pd-arrows-outside .homqi-pd-carousel-prev {
    margin-right: 8px;
}
.homqi-pd-arrows-outside {
    text-align: center;
}

/* --- POSICIÓN "TOP" (arriba a la derecha) --- */
.homqi-pd-carousel-arrows-top {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 24px;
}
.homqi-pd-carousel-arrows-top .homqi-pd-carousel-prev,
.homqi-pd-carousel-arrows-top .homqi-pd-carousel-next {
    width: 42px;
    height: 42px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* --- PAGINATION DOTS --- */
.homqi-pd-carousel-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.homqi-pd-carousel-pagination .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 0;
    margin: 0;
}

.homqi-pd-carousel-pagination .swiper-pagination-bullet:hover {
    background: rgba(255, 255, 255, 0.55);
}

.homqi-pd-carousel-pagination .swiper-pagination-bullet-active {
    background: var(--homqi-pd-accent);
    width: 32px;
    border-radius: 6px;
}

/* --- RESPONSIVE: en móvil flechas overlay se hacen más pequeñas --- */
@media (max-width: 640px) {
    .homqi-pd-arrows-overlay .homqi-pd-carousel-prev,
    .homqi-pd-arrows-overlay .homqi-pd-carousel-next {
        width: 40px;
        height: 40px;
    }
    .homqi-pd-arrows-overlay .homqi-pd-carousel-prev {
        left: 4px;
    }
    .homqi-pd-arrows-overlay .homqi-pd-carousel-next {
        right: 4px;
    }
    .homqi-pd-swiper {
        padding: 8px 0 12px;
        margin: -8px 0 -12px;
    }
}

/* --- CURSOR GRAB --- */
.homqi-pd-swiper.swiper-grab-cursor {
    cursor: grab;
}
.homqi-pd-swiper.swiper-grab-cursor:active {
    cursor: grabbing;
}
