/**
 * Property Listing Modern - Design Premium
 * Sistema de Listagem de Imóveis
 */

/* ===== SEÇÃO PRINCIPAL ===== */
.property-listing-modern {
    padding: 4rem 0;
    background: linear-gradient(180deg, #f8fafb 0%, #ffffff 100%);
}

/* Container centralizado - expandido para melhor visualização */
/* Especificidade MÁXIMA para sobrescrever TODOS os outros CSS (app.css, site-styles.css, design-system.css) */
section#imoveis-disponiveis.property-listing-modern>.container.container,
section#imoveis-disponiveis>.container.container,
section.property-listing-modern#imoveis-disponiveis>.container,
section.property-listing-modern>.container.container,
section.property-listing-modern>.container,
.property-listing-modern>.container,
.property-listing-modern .container,
section.property-listing-modern .container {
    width: 100% !important;
    max-width: 1400px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    box-sizing: border-box !important;
}

/* ===== HEADER DA LISTAGEM ===== */
.listing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-wrap: wrap;
    gap: 1rem;
}

.listing-title-area {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.listing-title-area h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.listing-count {
    font-size: 0.875rem;
    color: #6c757d;
    background: #f1f5f9;
    padding: 0.35rem 0.875rem;
    border-radius: 20px;
    font-weight: 500;
}

.listing-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
}

.view-btn {
    width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #6c757d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn:hover {
    color: #10b981;
}

.view-btn.active {
    background: white;
    color: #10b981;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Sort Select */
.sort-select-modern {
    padding: 0.625rem 2.5rem 0.625rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #374151;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 170px;
}

.sort-select-modern:hover,
.sort-select-modern:focus {
    border-color: #10b981;
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Mobile Sort */
.mobile-sort-bar {
    margin-bottom: 1.5rem;
}

/* ===== LOADING STATE ===== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e2e8f0;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-state p {
    margin-top: 1rem;
    color: #6c757d;
    font-size: 0.875rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: #f8fafb;
    border-radius: 16px;
    border: 2px dashed #e2e8f0;
}

.empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

.btn-primary-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.35);
    color: white;
}

/* ===== GRID DE IMÓVEIS ===== */
/* Mobile: 1 coluna */
.property-listing-modern .properties-grid,
#imoveis-container.properties-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
    margin-bottom: 2rem;
    width: 100%;
}

/* Tablet: 2 colunas (>= 768px) */
@media (min-width: 768px) {

    .property-listing-modern .properties-grid,
    #imoveis-container.properties-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
}

/* Desktop: 4 colunas (>= 1200px) - Usar minmax para garantir tamanho mínimo adequado */
@media (min-width: 1200px) {

    .property-listing-modern .properties-grid,
    #imoveis-container.properties-grid {
        grid-template-columns: repeat(4, minmax(300px, 1fr)) !important;
        gap: 1.5rem !important;
    }
}

/* ===== CARD DE IMÓVEL V2 — PREMIUM REDESIGN ===== */
.property-card-v2 {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .06);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1), box-shadow .35s cubic-bezier(.4, 0, .2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    position: relative;
}

.property-card-v2:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .08), 0 20px 48px rgba(0, 0, 0, .06);
}

/* === Featured Card — Gold Highlight === */
.property-card-v2.featured-card,
.property-card-v2:has(.badge-featured) {
    border: 1.5px solid rgba(201, 162, 39, .25);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04), 0 4px 16px rgba(201, 162, 39, .1);
}

.property-card-v2.featured-card::before,
.property-card-v2:has(.badge-featured)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #c9a227, #f0d060, #c9a227);
    z-index: 10;
}

.property-card-v2.featured-card:hover,
.property-card-v2:has(.badge-featured):hover {
    box-shadow: 0 8px 24px rgba(201, 162, 39, .12), 0 20px 48px rgba(201, 162, 39, .08);
    border-color: rgba(201, 162, 39, .4);
}

/* === Card Image === */
.property-card-v2 .card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #f1f5f9;
}

@supports not (aspect-ratio: 16 / 10) {
    .property-card-v2 .card-image {
        padding-top: 62.5%;
    }
}

.property-card-v2 .card-image>a {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.property-card-v2 .card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s cubic-bezier(.4, 0, .2, 1);
}

.property-card-v2:hover .card-image img {
    transform: scale(1.06);
}

/* Image gradient overlay */
.property-card-v2 .card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    background: linear-gradient(to top, rgba(0, 0, 0, .35), transparent);
    pointer-events: none;
    z-index: 1;
    transition: opacity .3s;
}

.property-card-v2:hover .card-image::after {
    opacity: .7;
}

/* === Badges === */
.property-card-v2 .card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    z-index: 5;
}

.property-card-v2 .badge-modern {
    padding: 4px 10px;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-radius: 6px;
    backdrop-filter: blur(6px);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.property-card-v2 .badge-operation {
    padding: 4px 10px;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-radius: 6px;
    backdrop-filter: blur(6px);
}

.property-card-v2 .badge-operation.sale {
    background: rgba(26, 95, 74, .85);
    color: #fff;
}

.property-card-v2 .badge-operation.rent {
    background: rgba(59, 130, 246, .85);
    color: #fff;
}

.property-card-v2 .badge-featured {
    padding: 4px 10px;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    background: linear-gradient(135deg, #c9a227, #f0d060);
    color: #1a1a2e;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Sold/Rented Overlay */
.property-card-v2 .card-sold-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    backdrop-filter: blur(2px);
}

.property-card-v2 .card-sold-overlay span {
    background: #ef4444;
    color: #fff;
    padding: 10px 28px;
    font-size: .95rem;
    font-weight: 800;
    letter-spacing: 2px;
    border-radius: 6px;
    transform: rotate(-4deg);
}

.property-card-v2 .card-sold-overlay.rented span {
    background: #f59e0b;
}

/* Code Badge */
.property-card-v2 .card-code {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    color: rgba(255, 255, 255, .9);
    padding: 3px 8px;
    font-size: .62rem;
    font-weight: 600;
    border-radius: 5px;
    font-family: 'DM Sans', monospace;
    z-index: 5;
    letter-spacing: .3px;
}

/* === Card Content === */
.property-card-v2 .card-content {
    padding: 1rem 1.15rem 1.15rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0;
}

.property-card-v2 .card-title {
    font-size: .92rem;
    font-weight: 700;
    margin-bottom: .35rem;
    line-height: 1.35;
    min-height: 2.5em;
}

.property-card-v2 .card-title a {
    color: #0f172a;
    text-decoration: none;
    transition: color .2s;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.property-card-v2 .card-title a:hover {
    color: #1a5f4a;
}

.property-card-v2 .card-location {
    font-size: .75rem;
    color: #94a3b8;
    margin-bottom: .6rem;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.property-card-v2 .card-location i {
    color: #1a5f4a;
    font-size: .65rem;
    flex-shrink: 0;
}

.property-card-v2 .card-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: #1a5f4a;
    margin-bottom: .6rem;
    white-space: nowrap;
    letter-spacing: -.2px;
}

.property-card-v2 .price-period {
    font-size: .65rem;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0;
}

/* === Features === */
.property-card-v2 .card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: .6rem;
    border-top: 1px solid #f1f5f9;
    margin-bottom: .75rem;
}

.property-card-v2 .card-features span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .72rem;
    font-weight: 500;
    color: #64748b;
    background: #f8fafb;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.property-card-v2 .card-features i {
    color: #1a5f4a;
    font-size: .65rem;
}

/* === CTA Button === */
.property-card-v2 .card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: .65rem;
    background: linear-gradient(135deg, #1a5f4a 0%, #22785e 100%);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    margin-top: auto;
    letter-spacing: .2px;
}

.property-card-v2 .card-btn i {
    font-size: .7rem;
    transition: transform .3s;
}

.property-card-v2 .card-btn:hover {
    background: linear-gradient(135deg, #145040 0%, #1a5f4a 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(26, 95, 74, .25);
}

.property-card-v2 .card-btn:hover i {
    transform: translateX(4px);
}

/* ===== PAGINAÇÃO MODERNA ===== */
.pagination-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 0;
    border-top: 1px solid #f1f5f9;
}

.pagination-info {
    font-size: 0.875rem;
    color: #6c757d;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    background: white;
    color: #374151;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-btn:hover:not(.disabled):not(.active) {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.page-btn.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.page-ellipsis {
    color: #9ca3af;
    padding: 0 8px;
}

/* ===== VIEW ALL CTA ===== */
.view-all-cta {
    text-align: center;
    margin-top: 2rem;
}

.btn-view-all {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 1rem 2.5rem;
    background: transparent;
    color: #1a1a2e;
    border: 2px solid #1a1a2e;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-view-all i {
    transition: transform 0.3s ease;
}

.btn-view-all:hover {
    background: #1a1a2e;
    color: white;
}

.btn-view-all:hover i {
    transform: translateX(5px);
}

/* ===== RESPONSIVIDADE ===== */

/* Tablets (768px - 991px) */
@media (max-width: 991px) {
    .listing-title-area h2 {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .property-listing-modern {
        padding: 3rem 0;
    }

    .listing-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .listing-controls {
        width: 100%;
        display: none;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-btn {
        min-width: 38px;
        height: 38px;
    }
}

@media (max-width: 575px) {
    .listing-title-area h2 {
        font-size: 1.5rem;
    }

    .btn-view-all {
        width: 100%;
        justify-content: center;
    }
}

/* ===== LIST VIEW (Opcional) ===== */
.properties-grid.list-view {
    grid-template-columns: 1fr;
}

.properties-grid.list-view .property-card-v2 {
    flex-direction: row;
}

.properties-grid.list-view .property-card-v2 .card-image {
    width: 300px;
    height: auto;
    min-height: 200px;
}

.properties-grid.list-view .property-card-v2 .card-content {
    flex: 1;
}

@media (max-width: 768px) {
    .properties-grid.list-view .property-card-v2 {
        flex-direction: column;
    }

    .properties-grid.list-view .property-card-v2 .card-image {
        width: 100%;
        height: 200px;
    }
}