/* =========================================
   ESTILOS PÁGINA DE PROPIEDADES
   ========================================= */

/* --- Cabecera con Filtros --- */
.properties-header {
    background-color: #f8f9fa;
    padding: 160px 0 50px;
    /* Padding superior aumentado para compensar navbar fija que lo cortaba */
    border-bottom: 1px solid #e9ecef;
}

/* La navbar es más baja en móvil (logo reducido en styles.css), así que
   este padding gigante ya no hace falta y deja un hueco vacío enorme */
@media (max-width: 767.98px) {
    .properties-header {
        padding: 100px 0 35px;
    }
}

.filter-bar {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.form-select,
.form-control {
    border: 1px solid #dee2e6;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.form-select:focus,
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(26, 26, 26, 0.1);
}

/* ─────────────────────────────────────────────
   DROPDOWNS PREMIUM — Filtros de propiedades
   ───────────────────────────────────────────── */

/* Botón del dropdown — estilo refinado */
.filter-bar .dropdown .form-select {
    background-color: #fafbfc;
    border: 1.5px solid #e2e6ea;
    border-radius: 10px;
    padding: 11px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #3a3a3a;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
}

.filter-bar .dropdown .form-select:hover {
    border-color: #c5cad0;
    background-color: #f5f6f8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.filter-bar .dropdown.show .form-select,
.filter-bar .dropdown .form-select[aria-expanded="true"] {
    border-color: #1a1a1a;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
}

/* Menú desplegable — animación y diseño premium */
.filter-bar .dropdown-menu {
    border: none;
    border-radius: 14px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.12),
        0 4px 12px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(0, 0, 0, 0.04);
    margin-top: 4px !important;
    top: 100% !important;
    max-height: 340px;
    overflow-y: auto;
    
    /* Animación de entrada */
    animation: filterDropdownIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top center;
}

@keyframes filterDropdownIn {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Scrollbar personalizado dentro del dropdown */
.filter-bar .dropdown-menu::-webkit-scrollbar {
    width: 5px;
}

.filter-bar .dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.filter-bar .dropdown-menu::-webkit-scrollbar-thumb {
    background: #d0d5db;
    border-radius: 10px;
}

.filter-bar .dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #a8aeb5;
}

/* Items del listado */
.filter-bar .dropdown-menu li {
    list-style: none;
    margin: 0;
}

.filter-bar .dropdown-menu li .form-check {
    padding: 0;
    margin: 0;
    border-radius: 9px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    min-height: auto;
}

.filter-bar .dropdown-menu li .form-check:hover {
    background: linear-gradient(135deg, #f7f8fa 0%, #f0f2f5 100%);
}

/* Separador (hr) dentro del dropdown */
.filter-bar .dropdown-menu li > hr {
    margin: 6px 10px;
    border-color: #eef0f3;
    opacity: 0.8;
}

/* ── Checkbox personalizado ── */
.filter-bar .dropdown-menu .form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    border: 2px solid #cfd4da;
    border-radius: 5px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    appearance: none;
    -webkit-appearance: none;
    pointer-events: none;
}

.filter-bar .dropdown-menu .form-check-input:hover {
    border-color: #999;
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.06);
}

.filter-bar .dropdown-menu .form-check-input:checked {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
    box-shadow: 0 2px 6px rgba(26, 26, 26, 0.25);
}

/* Tick animado */
.filter-bar .dropdown-menu .form-check-input:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    animation: checkTick 0.2s ease forwards;
}

@keyframes checkTick {
    0% {
        opacity: 0;
        transform: rotate(45deg) scale(0);
    }
    100% {
        opacity: 1;
        transform: rotate(45deg) scale(1);
    }
}

/* Item seleccionado — fondo sutil */
.filter-bar .dropdown-menu li:has(.form-check-input:checked) .form-check {
    background: linear-gradient(135deg, #f0f1f3 0%, #eaecef 100%);
}

.filter-bar .dropdown-menu li:has(.form-check-input:checked) .form-check-label {
    font-weight: 600;
    color: #1a1a1a;
}

/* Labels — cubren toda la fila para que sea clickable */
.filter-bar .dropdown-menu .form-check-label {
    display: block;
    padding: 9px 14px 9px 42px;
    margin: 0;
    font-size: 0.88rem;
    font-weight: 450;
    color: #4a4f55;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1.4;
    border-radius: 9px;
}

.filter-bar .dropdown-menu .form-check-label:hover {
    color: #1a1a1a;
}

.filter-bar .dropdown-menu .form-check-label .text-muted.small {
    font-weight: 400;
    opacity: 0.6;
    font-size: 0.78rem;
}

/* ── Labels del filtro (sobre el botón) ── */
.filter-bar .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a9099 !important;
    margin-bottom: 6px;
}

/* --- Acciones de búsqueda y limpieza --- */
.search-with-actions {
    width: 100%;
    justify-content: flex-end;
}

.search-with-actions .position-relative.flex-grow-1 {
    min-width: 0;
    flex: 1 1 auto;
}

.btn-clear-filters {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    color: #495057;
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-clear-filters:hover {
    border-color: #bfc7ce;
    background: #f8f9fa;
    color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.btn-clear-filters i {
    margin-right: 0.35rem;
}

/* ── Responsive: dropdowns se abren mejor en móvil ── */
@media (max-width: 768px) {
    .filter-bar .dropdown-menu {
        border-radius: 12px;
        max-height: 280px;
        position: fixed !important;
        left: 16px !important;
        right: 16px !important;
        top: auto !important;
        bottom: 16px !important;
        width: auto !important;
        transform: none !important;
        animation: filterDropdownMobile 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        box-shadow:
            0 -4px 40px rgba(0, 0, 0, 0.15),
            0 0 0 1px rgba(0, 0, 0, 0.05);
    }

    @keyframes filterDropdownMobile {
        0% {
            opacity: 0;
            transform: translateY(20px);
        }
        100% {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .search-with-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-clear-filters {
        width: 100%;
        min-height: 44px;
    }
}

.btn-filter {
    background-color: #1a1a1a;
    /* Tu color primario */
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-filter:hover {
    background-color: #333;
    transform: translateY(-2px);
}

/* --- Grid de Propiedades --- */
.properties-grid {
    padding: 60px 0;
}

.property-card {
    border: none;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

.property-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.card-img-wrapper {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.property-card:hover .card-img-top {
    transform: scale(1.05);
}

/* Enlace que envuelve la imagen */
.card-img-link {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Enlace del título */
.card-title-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-title-link:hover .card-title {
    color: #555;
}

/* Badges sobre la imagen */
.badge-status {
    position: absolute;
    top: 15px;
    left: 15px;
    background-color: rgba(26, 26, 26, 0.9);
    color: white;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
}

.badge-status.oferta {
    background-color: #e74c3c;
}

.price-tag {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: white;
    color: #1a1a1a;
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

/* Contenido de la tarjeta */
.card-body {
    padding: 25px;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 10px;
    color: #1a1a1a;
}

.card-location {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Iconos de características */
.property-features {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #f1f1f1;
    padding-top: 15px;
    margin-top: 15px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
}

.feature-item i {
    color: #1a1a1a;
}

/* Pie de tarjeta */
.card-footer-custom {
    padding: 15px 25px;
    background: transparent;
    border-top: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-details {
    color: #1a1a1a;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.btn-details:hover {
    color: #555;
    text-decoration: underline;
}

/* UI v2 — Skeleton loader para cards (shimmer mientras carga Firebase) */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}

.property-card-skeleton {
    border: none;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    height: 100%;
    pointer-events: none;
}

.property-card-skeleton .skeleton-img {
    height: 250px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
}

.property-card-skeleton .skeleton-body {
    padding: 25px;
}

.property-card-skeleton .skeleton-line {
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
    margin-bottom: 12px;
}

.property-card-skeleton .skeleton-line.short  { width: 55%; }
.property-card-skeleton .skeleton-line.medium { width: 80%; }
.property-card-skeleton .skeleton-line.full   { width: 100%; }

.property-card-skeleton .skeleton-features {
    display: flex;
    gap: 16px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f1f1f1;
}

.property-card-skeleton .skeleton-feat {
    height: 12px;
    width: 60px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
}

/* UI v2 — Hover state mejorado en cards */
.property-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.13);
}

/* UI v2 — Estado "Sin resultados" */
.no-results-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    color: #6c757d;
    grid-column: 1 / -1;
    width: 100%;
}

.no-results-message .no-results-icon {
    font-size: 4rem;
    color: #dee2e6;
    margin-bottom: 20px;
    line-height: 1;
}

.no-results-message .no-results-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.no-results-message .no-results-text {
    font-size: 0.95rem;
    color: #6c757d;
    max-width: 380px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.no-results-message .btn-reset-filters {
    background-color: #1a1a1a;
    color: white;
    border: none;
    padding: 11px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.no-results-message .btn-reset-filters:hover {
    background-color: #333;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Paginación */
.pagination .page-link {
    color: #1a1a1a;
    border: none;
    margin: 0 5px;
    border-radius: 5px;
    font-weight: 500;
}

.pagination .page-item.disabled .page-link {
    background-color: #f1f3f5;
    color: #adb5bd;
    pointer-events: none;
    cursor: not-allowed;
}

.pagination .page-item.active .page-link {
    background-color: #1a1a1a;
    color: white;
}

.pagination .page-link:hover {
    background-color: #f1f1f1;
    color: #1a1a1a;
}

.pagination .page-item.disabled .page-link:hover {
    background-color: #f1f3f5;
    color: #adb5bd;
}

@media (max-width: 575.98px) {
    .card-img-wrapper {
        height: 200px;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 6px;
    }
    }
}

/* CAROUSEL CONTROLS FOR PROPERTY CARDS */
.property-carousel {
    height: 100%;
}
.property-carousel .carousel-inner {
    height: 100%;
}
.property-carousel .carousel-item {
    height: 100%;
}
.property-carousel .carousel-item img {
    height: 100%;
    object-fit: cover;
}

.property-carousel .carousel-control-prev,
.property-carousel .carousel-control-next {
    width: 15%;
    opacity: 0.6;
    transition: opacity 0.3s ease, background 0.3s ease;
    background: rgba(0, 0, 0, 0.4);
    height: 100%;
    z-index: 5;
}

.property-carousel:hover .carousel-control-prev,
.property-carousel:hover .carousel-control-next {
    opacity: 1;
}

.property-carousel .carousel-control-prev:hover,
.property-carousel .carousel-control-next:hover {
    background: rgba(0, 0, 0, 0.7);
}

.property-carousel .carousel-control-prev-icon,
.property-carousel .carousel-control-next-icon {
    width: 2rem;
    height: 2rem;
    filter: drop-shadow(0px 0px 3px rgba(0,0,0,0.8));
}

.property-carousel .carousel-indicators {
    margin-bottom: 0.5rem;
    z-index: 5;
}
.property-carousel .carousel-indicators button {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 4px;
    background-color: rgba(255,255,255,0.7);
    border: none;
}
.property-carousel .carousel-indicators button.active {
    background-color: #fff;
    transform: scale(1.2);
}