/* === SEARCH/MAP PAGE (Split View) === */
.map-page {
    display: flex;
    height: calc(100vh - 80px);
}

.map-sidebar {
    width: 500px;
    padding: 24px 20px;
    overflow-y: auto;
    background: var(--white);
    display: flex;
    flex-direction: column;
}

.map-sidebar h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.map-view {
    flex: 1;
    position: relative;
}

.map-view #mapContainer {
    width: 100%;
    height: 100%;
}

.map-view #map {
    width: 100%;
    height: 100%;
}

/* Filter pills row: single button + inline active chips */
.filters-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 6px 0;
    flex-wrap: nowrap;
    min-height: 44px;
    margin-bottom: 12px;
}

.filters-row .filter-btn-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1.5px solid var(--dark-purple, #1f143c);
    border-radius: var(--radius-pill);
    background: var(--white);
    color: var(--dark-purple, #1f143c);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 180ms ease;
    flex-shrink: 0;
    position: relative;
}

.filters-row .filter-btn-main:hover {
    background: var(--dark-purple, #1f143c);
    color: var(--white);
}

.filters-row .filter-btn-main .filter-count {
    background: var(--primary-red);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.filters-row .active-filters-inline {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0;
}

.filters-row .active-filters-inline::-webkit-scrollbar { display: none; }

.filters-row .active-filters-inline .filtro {
    background: rgba(31, 20, 60, 0.06);
    border: 1px solid transparent;
    color: var(--dark-purple, #1f143c);
    border-radius: var(--radius-pill);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.filters-row .active-filters-inline .separador-ponto { display: none; }

/* --- SIDEBAR CARDS --- */
.map-sidebar .cards-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.map-sidebar .cards-grid .card {
    display: flex;
    flex-direction: row;
    background: var(--white);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #eef0f4;
    transition: box-shadow 200ms ease, border-color 200ms ease;
    cursor: pointer;
}

.map-sidebar .cards-grid .card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: #dde0e6;
}

/* Card Image */
.map-sidebar .card .card-img {
    width: 200px;
    min-width: 200px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.map-sidebar .card .card-img .carousel {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.map-sidebar .card .card-img .carousel-images {
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.4s ease;
}

.map-sidebar .card .card-img .carousel-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}

.map-sidebar .card .card-img .prev,
.map-sidebar .card .card-img .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.85);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 200ms ease;
    z-index: 2;
    color: var(--text-dark);
}

.map-sidebar .card:hover .prev,
.map-sidebar .card:hover .next {
    opacity: 1;
}

.map-sidebar .card .card-img .prev { left: 6px; }
.map-sidebar .card .card-img .next { right: 6px; }

/* Card Body */
.map-sidebar .card .card-body {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.map-sidebar .card .card-info {
    cursor: pointer;
}

.map-sidebar .card .card-location {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 2px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-sidebar .card .card-address {
    font-size: 12px;
    color: var(--text-light);
    margin: 0 0 10px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Specs row (metragem, quartos, vagas) */
.map-sidebar .card .card-specs {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.map-sidebar .card .card-specs .spec {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #555;
    white-space: nowrap;
}

.map-sidebar .card .card-specs .spec i {
    font-size: 11px;
    color: var(--primary-red);
}

/* Price */
.map-sidebar .card .card-negotiation {
    font-size: 12px;
    color: var(--text-light);
    margin: 0 0 2px;
}

.map-sidebar .card .card-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

/* Card Actions (favorite + message button) */
.map-sidebar .card .card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.map-sidebar .card .card-actions .favoritar {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 180ms ease;
    flex-shrink: 0;
}

.map-sidebar .card .card-actions .favoritar:hover {
    border-color: var(--primary-red);
    background: var(--primary-red-light);
}

.map-sidebar .card .card-actions .favoritar.favoritado {
    background: var(--primary-red);
    border-color: var(--primary-red);
}

.map-sidebar .card .card-actions .favoritar .card-fav-icon {
    width: 18px;
    height: 18px;
}

.map-sidebar .card .card-actions .btn-msg-card {
    flex: 1;
    background: var(--primary-red);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 180ms ease;
    text-align: center;
}

.map-sidebar .card .card-actions .btn-msg-card:hover {
    background: var(--primary-red-hover);
}

/* Empty state */
.cards-grid .empty-msg {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 14px;
}

/* Filter modal/sidebar overlay */
.modal-buscar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: flex-start;
}

.modal-buscar.hidden {
    display: none;
}

.modal-buscar .filtros-buscar {
    background: var(--white);
    width: 440px;
    max-width: 95%;
    height: 100%;
    overflow-y: auto;
    padding: 28px 28px 40px;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}

.modal-buscar .filtros-buscar hr {
    border: none;
    border-top: 1px solid #eef0f4;
    margin: 18px 0;
}

.modal-buscar .close-button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-bottom: 18px;
    padding: 6px;
    border-radius: 50%;
    transition: background 180ms ease;
}

.modal-buscar .close-button:hover {
    background: var(--light-bg, #f5f5f7);
}

/* Location autocomplete inside modal */
.modal-loc-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--white);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md, 10px);
    padding: 10px 14px;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.modal-loc-wrapper:focus-within {
    border-color: var(--dark-purple, #1f143c);
    box-shadow: 0 0 0 3px rgba(31, 20, 60, 0.08);
}

.modal-loc-icon {
    color: #999;
    margin-right: 10px;
    font-size: 14px;
}

#input-localizacao-modal {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: 14px;
    background: transparent;
    padding: 2px 0;
    color: var(--text-dark);
}

.modal-loc-wrapper .autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md, 10px);
    list-style: none;
    padding: 6px 0;
    margin: 0;
    z-index: 200;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.modal-loc-wrapper .autocomplete-list .autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 120ms ease;
}

.modal-loc-wrapper .autocomplete-list .autocomplete-item:hover {
    background: rgba(31, 20, 60, 0.05);
}

.modal-loc-wrapper .autocomplete-list .autocomplete-item i {
    color: var(--primary-red);
}

/* Search bar within sidebar */
.barra-busca {
    margin-bottom: 15px;
}

.barra-busca .input-container {
    display: flex;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    position: relative;
}

.barra-busca .input-localizacao {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--font);
    font-size: 14px;
    padding: 5px;
}

.barra-busca .icone-lupa {
    width: 18px;
    margin-right: 8px;
}

.barra-busca button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.barra-busca .autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    list-style: none;
    padding: 0;
    margin: 0;
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}

.barra-busca .autocomplete-list .autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background var(--transition);
}

.barra-busca .autocomplete-list .autocomplete-item:hover {
    background: var(--light-bg);
}

/* Tab navigation for Comprar/Alugar */
.alugar-comprar {
    margin-bottom: 15px;
}

.alugar-comprar .nav-underline {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.alugar-comprar .nav-item {
    padding: 8px 15px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.alugar-comprar .nav-item.active {
    background: var(--dark-purple);
    color: var(--white);
}

.alugar-comprar .nav-item img {
    width: 20px;
    height: 20px;
}

/* Filter form styles */
.localizacao .form-group select,
.localizacao .form-group input,
.valores .form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    background: var(--white);
}

.valores {
    display: flex;
    gap: 10px;
}

.opcoes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.opcoes .opcao {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
}

.opcoes .opcao:has(input:checked) {
    background: var(--dark-purple);
    color: var(--white);
    border-color: var(--dark-purple);
}

.opcoes .opcao input {
    display: none;
}

.opcoes-pill {
    gap: 8px;
    margin-bottom: 4px;
}

.opcoes-pill .opcao {
    min-width: 56px;
    justify-content: center;
    padding: 8px 14px;
    font-weight: 500;
}

.titulos-forms {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.titulo-objetivo,
.titulo-localizar {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.botoes-filtros {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-aplicar {
    flex: 1;
    background: var(--primary-red);
    color: var(--white);
    border: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition);
}

.btn-aplicar:hover {
    background: var(--primary-red-hover);
}

.btn-limpar {
    flex: 1;
    background: var(--white);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

/* Input wrapper for metragem fields */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    flex: 1;
    padding-right: 35px;
}

.input-wrapper .unit {
    position: absolute;
    right: 10px;
    color: #999;
    font-size: 13px;
    pointer-events: none;
}

/* Filter summary pills in sidebar */
.filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-dark);
}

.filtros .filtro {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    font-size: 12px;
}

/* Skeleton loading for cards */
.card-skeleton {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
}

.card-skeleton .skeleton-img {
    width: 150px;
    height: 120px;
}

.card-skeleton .skeleton-content {
    padding: 15px;
    flex: 1;
}

/* Pagination */
.map-sidebar .pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 15px 0;
    margin-top: auto;
}

/* === Map Price Labels === */
.map-price-label {
    background: var(--dark-purple, #1f143c);
    color: #fff;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font);
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: transform 150ms ease, box-shadow 150ms ease;
    z-index: 1;
}

.map-price-label:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    z-index: 2;
}

.map-price-arrow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--dark-purple, #1f143c);
}

/* === Map Card Popup Overlay === */
.map-popup-wrapper {
    pointer-events: all;
    z-index: 1000;
    transform: translate(-50%, calc(-100% - 40px));
}

.map-popup-card {
    position: relative;
    width: 260px;
    background: var(--white, #fff);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: visible;
    font-family: var(--font);
    animation: mapPopupIn 0.18s ease;
}

@keyframes mapPopupIn {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

.map-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background 150ms ease;
    line-height: 1;
    padding: 0;
}

.map-popup-close:hover {
    background: rgba(0, 0, 0, 0.65);
}

.map-popup-img {
    width: 100%;
    height: 170px;
    overflow: hidden;
    border-radius: 14px 14px 0 0;
    cursor: pointer;
}

.map-popup-img .carousel {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.map-popup-img .carousel-images {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.4s ease;
}

.map-popup-img .carousel-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}

.map-popup-img .prev,
.map-popup-img .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.85);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    color: #333;
}

.map-popup-img .prev { left: 6px; }
.map-popup-img .next { right: 6px; }

.map-popup-body {
    padding: 14px 16px 12px;
}

.map-popup-info {
    cursor: pointer;
}

.map-popup-location {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-popup-address {
    font-size: 12px;
    color: var(--text-light);
    margin: 0 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-popup-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.map-popup-features span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #555;
}

.map-popup-features span i {
    font-size: 11px;
    color: var(--primary-red);
}

.map-popup-price-label {
    font-size: 11px;
    color: var(--text-light);
    margin: 0 0 2px;
}

.map-popup-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 12px;
}

.map-popup-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-popup-actions .favoritar {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 180ms ease;
}

.map-popup-actions .favoritar:hover {
    border-color: var(--primary-red);
    background: rgba(229, 57, 53, 0.05);
}

.map-popup-actions .favoritar.favoritado {
    background: var(--primary-red);
    border-color: var(--primary-red);
}

.map-popup-actions .favoritar .card-fav-icon {
    width: 16px;
    height: 16px;
}

.map-popup-actions .btn-msg-card {
    flex: 1;
    background: var(--primary-red);
    color: var(--white, #fff);
    border: none;
    border-radius: 8px;
    padding: 9px 14px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 180ms ease;
    text-align: center;
}

.map-popup-actions .btn-msg-card:hover {
    background: var(--primary-red-hover);
}

.map-popup-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--white, #fff);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

/* Responsive */
@media (max-width: 768px) {
    .map-page {
        flex-direction: column-reverse;
        height: auto;
    }

    .map-sidebar {
        width: 100%;
        height: auto;
    }

    .map-view {
        height: 350px;
    }

    .map-sidebar .cards-grid .card {
        flex-direction: column;
    }

    .map-sidebar .card .card-img {
        width: 100%;
        min-width: 100%;
        height: 200px;
    }

    .map-sidebar .card .card-img .carousel,
    .map-sidebar .card .card-img .carousel-images,
    .map-sidebar .card .card-img .carousel-images img {
        height: 200px;
    }

    .map-sidebar .card .prev,
    .map-sidebar .card .next {
        opacity: 1;
    }

    .modal-buscar .filtros-buscar {
        width: 100%;
    }
}
