/* ==========================================================================
   CORDOBAPROP - Prototipo UI/UX v2
   Mobile-first responsive design
   ========================================================================== */

/* --- 1. Variables y Reset --- */
:root {
    --color-primary:    #1a237e;
    --color-secondary:  #d15029;
    --color-bg:         #f5f6fa;
    --color-card:       #ffffff;
    --color-text:       #2d3436;
    --color-muted:      #636e72;
    --color-border:     #dfe6e9;
    --color-success:    #00b894;
    --color-venta:      #1a237e;
    --color-alquiler:   #d15029;
    --shadow-sm:        0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:        0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg:        0 8px 30px rgba(0,0,0,0.12);
    --radius:           12px;
    --radius-sm:        8px;
    --transition:       all 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    max-width: 100vw;
    /* clip en vez de hidden — no rompe position:sticky en descendientes */
    overflow-x: clip;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img, video, iframe { max-width: 100%; }

/* Inputs / form controls: nunca rompen el contenedor */
input, select, textarea, button {
    max-width: 100%;
    font-family: inherit;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

/* --- 2. Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    padding: 0 0;
    transition: var(--transition);
    box-shadow: 0 1px 8px rgba(0,0,0,0.08);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.navbar-logo img {
    height: 36px;
    width: auto;
}

.navbar-menu {
    display: none;
    list-style: none;
    gap: 4px;
}

.navbar-menu li a {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.navbar-menu li a:hover {
    color: var(--color-primary);
    background: rgba(26,35,126,0.06);
}

.navbar-menu li a.active {
    color: #fff;
    background: var(--color-secondary);
}

.navbar-cpi {
    display: none;
    align-items: center;
    gap: 8px;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.navbar-cpi:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.navbar-cpi img { height: 24px; filter: brightness(0) saturate(100%) invert(12%) sepia(67%) saturate(4547%) hue-rotate(232deg) brightness(82%) contrast(114%); }

.navbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(26,35,126,0.06);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-primary);
    font-size: 20px;
    cursor: pointer;
}

/* --- 3. Hero --- */
.hero {
    position: relative;
    padding: 100px 0 60px;
    background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #3949ab 100%);
    /* overflow: hidden cortaba los dropdowns que salen abajo. El pattern
       repetido del ::before ya no necesita clipping. */
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="0.5"/></svg>') repeat;
    background-size: 100px;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.hero h1 {
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.hero p {
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    margin-bottom: 32px;
}

/* --- Search Bar --- */
.search-bar {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 960px;
    margin: 0 auto;
}

.search-field {
    flex: 1;
}

.search-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    margin-bottom: 4px;
}

.search-field select,
.search-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--color-text);
    background: white;
    transition: var(--transition);
    appearance: auto;
}

.search-field select:focus,
.search-field input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26,35,126,0.1);
}

.btn-search {
    width: 100%;
    padding: 12px 32px;
    background: var(--color-secondary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-search:hover {
    background: #b8432a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(209,80,41,0.3);
}

/* ─── HERO SEARCH (tabs + bar) ─── */
.hero-search {
    max-width: 1000px;
    margin: 0 auto;
    text-align: left; /* override del hero centrado */
}

.hero-tabs {
    display: inline-flex;
    gap: 2px;
    background: rgba(255,255,255,0.95);
    border-radius: 12px 12px 0 0;
    padding: 4px 0 0 0;
    margin-left: 0; /* alineado exacto con el borde del searchbar (testeado en producción) */
}
.hero-tab {
    background: transparent;
    border: none;
    color: var(--color-muted);
    font-size: 16px;
    font-weight: 600;
    padding: 12px 22px 12px 14px; /* left:14px = padding del trigger del primer dropdown */
    cursor: pointer;
    position: relative;
    border-radius: 8px 8px 0 0;
    transition: color 0.15s ease;
    font-family: inherit;
}
.hero-tab:hover { color: var(--color-text); }
.hero-tab.active { color: var(--color-primary); }
.hero-tab.active::after {
    content: '';
    position: absolute;
    left: 14px; right: 14px; bottom: 0;
    height: 3px;
    background: var(--color-secondary);
    border-radius: 3px 3px 0 0;
}

.hero-searchbar {
    background: white;
    border-radius: 0 12px 12px 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
}

/* Campo ubicación (sin dropdown) */
.hero-field {
    display: flex;
    flex-direction: column;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background 0.15s ease;
    min-width: 0;
}
.hero-field:focus-within { background: rgba(26,35,126,0.04); }
.hero-field label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-muted);
    margin-bottom: 2px;
}
.hero-field input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    padding: 4px 0;
    outline: none;
    appearance: none;
}
.hero-field input::placeholder { color: #adb5bd; font-weight: 500; }

/* Custom dropdowns del hero */
.hero-dropdown {
    position: relative;
    min-width: 0;
}
.hero-dropdown-trigger {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 30px 8px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    border-radius: 8px;
    transition: background 0.15s ease;
    font-family: inherit;
    position: relative;
}
.hero-dropdown-trigger:hover { background: rgba(26,35,126,0.04); }
.hero-dropdown.open .hero-dropdown-trigger { background: rgba(26,35,126,0.06); }
.hero-dropdown-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-muted);
    margin-bottom: 2px;
}
.hero-dropdown-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.hero-dropdown-value.placeholder { color: #adb5bd; font-weight: 500; }
.hero-chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
    transition: transform 0.2s ease;
    pointer-events: none;
}
.hero-dropdown.open .hero-chevron { transform: translateY(-50%) rotate(180deg); color: var(--color-primary); }

.hero-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: 320px;
    background: var(--color-primary);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
    padding: 6px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
    max-height: 360px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.hero-dropdown.open .hero-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s;
}
.hero-dropdown-option {
    padding: 11px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    transition: background 0.1s ease, color 0.1s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.hero-dropdown-option small {
    margin-left: auto;
    opacity: 0.5;
    font-size: 12px;
    font-weight: 400;
}
.hero-dropdown-option:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}
.hero-dropdown-option.active {
    background: var(--color-secondary);
    color: white;
    font-weight: 600;
}

/* Botón Buscar */
.hero-search-btn {
    height: 60px;
    border-radius: 8px;
    background: var(--color-secondary);
    color: white;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 32px;
    transition: background 0.15s ease, transform 0.1s ease;
    font-family: inherit;
    flex-shrink: 0;
}
.hero-search-btn:hover { background: #b8432a; }
.hero-search-btn:active { transform: scale(0.98); }

.hero-hint {
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    text-align: center;
    margin-top: 14px;
}
.hero-hint b { color: white; }

/* Google Places autocomplete — agrandar resultados */
.pac-container {
    border-radius: 12px !important;
    box-shadow: 0 16px 40px rgba(0,0,0,0.25) !important;
    border: none !important;
    margin-top: 8px !important;
    overflow: hidden;
    font-family: inherit !important;
    background: var(--color-primary) !important;
    padding: 6px !important;
}
.pac-item {
    padding: 11px 16px !important;
    font-size: 15px !important;
    cursor: pointer !important;
    border: none !important;
    line-height: 1.4;
    border-radius: 8px !important;
    color: rgba(255,255,255,0.9) !important;
    margin-bottom: 2px;
}
.pac-item:hover, .pac-item-selected { background: rgba(255,255,255,0.1) !important; color: white !important; }
.pac-icon { display: none !important; }
.pac-item-query { font-size: 15px !important; font-weight: 600 !important; color: white !important; }
.pac-matched { font-weight: 700; }

/* Tablet/Desktop layout horizontal */
@media (min-width: 768px) {
    .hero-searchbar {
        flex-direction: row;
        align-items: stretch;
        padding: 6px;
    }
    .hero-dropdown + .hero-dropdown,
    .hero-field + .hero-field,
    .hero-dropdown + .hero-field,
    .hero-field + .hero-dropdown {
        border-left: 1px solid var(--color-border);
    }
    .hero-dropdown { flex: 0 0 auto; min-width: 170px; }
    .hero-field-grow { flex: 1; min-width: 0; }
    .hero-search-btn { margin-left: 4px; }
}

@media (max-width: 767px) {
    .hero-tabs {
        display: flex;
        width: 100%;
        margin-left: 0;
        border-radius: 12px 12px 0 0;
        padding: 4px 4px 0;
    }
    .hero-tab {
        flex: 1;
        padding: 12px 8px;
        font-size: 15px;
        text-align: center;
    }
    .hero-tab.active::after {
        left: 30%; right: 30%;
    }
    .hero-search-btn { width: 100%; margin-top: 4px; }
}

/* --- 4. Sponsor Banner --- */
.sponsor-banner {
    text-align: center;
    padding: 20px 0;
}

.sponsor-banner img {
    max-width: 728px;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 0 auto;
}

.sponsor-banner small {
    display: block;
    font-size: 10px;
    color: var(--color-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- 5. Section --- */
.section {
    padding: 40px 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
}

.section-header h2 span {
    color: var(--color-secondary);
}

.btn-link {
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.btn-link:hover {
    color: var(--color-secondary);
}

/* --- 6. Property Grid --- */
.property-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* --- 7. Property Card --- */
.property-card {
    background: var(--color-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.property-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #e9ecef;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Placeholder limpio cuando no hay foto real */
.card-image-no-photo {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

/* ─── Skeletons (loading state) ─── */
@keyframes cbpShimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}
.skeleton-shimmer {
    background: linear-gradient(90deg, #f0f1f5 0%, #e4e6ec 50%, #f0f1f5 100%);
    background-size: 1000px 100%;
    animation: cbpShimmer 1.6s linear infinite;
}
.property-card.skeleton {
    cursor: default;
    pointer-events: none;
}
.property-card.skeleton:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}
.property-card.skeleton .card-image {
    aspect-ratio: 16/10;
    overflow: hidden;
}
.skeleton-line {
    border-radius: 6px;
    background-color: #e9ecef;
}
.card-image-empty {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--color-muted);
}
.card-image-empty i {
    font-size: 28px;
    opacity: 0.4;
}
.card-image-empty span {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.6;
}

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

.card-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-venta {
    background: var(--color-venta);
    color: white;
}

.badge-alquiler {
    background: var(--color-alquiler);
    color: white;
}

.badge-feature {
    background: rgba(0,0,0,0.6);
    color: white;
    backdrop-filter: blur(4px);
}

.card-images-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* ─── Amenity chips (checkboxes estilizados) ─── */
.amenity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 6px;
}
.amenity-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-muted);
    background: white;
    transition: all 0.15s ease;
    user-select: none;
    min-width: 0;
}
.amenity-chip input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
    pointer-events: none;
}
.amenity-chip i {
    font-size: 13px;
    color: var(--color-muted);
    flex-shrink: 0;
    transition: color 0.15s ease;
}
.amenity-chip span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.amenity-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-text);
}
.amenity-chip:hover i { color: var(--color-primary); }
.amenity-chip.is-checked,
.amenity-chip:has(input:checked) {
    background: rgba(26,35,126,0.08);
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
}
.amenity-chip.is-checked i,
.amenity-chip:has(input:checked) i { color: var(--color-primary); }

/* Comodidades dentro del map adv panel */
.map-adv-amenities {
    padding: 12px 4px 0;
    border-top: 1px solid var(--color-border);
    margin-top: 12px;
}
.map-adv-amenities-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-muted);
    margin-bottom: 8px;
}
.map-adv-amenities .amenity-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

/* CPI signature badge — sobre la imagen, esquina superior derecha */
.cpi-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.95);
    padding: 3px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    backdrop-filter: blur(4px);
    object-fit: contain;
    z-index: 2;
}

.cpi-badge-small {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: rgba(255,255,255,0.95);
    padding: 1px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    object-fit: contain;
}

/* map-card-image needs relative to contain the absolute badge */
.map-card-image { position: relative; }

.card-body {
    padding: 16px;
}

.card-location {
    font-size: 12px;
    color: var(--color-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-specs {
    display: flex;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
}

.card-spec {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-muted);
}

.card-spec svg {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
}

.card-price small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--color-muted);
}

.card-agency img {
    height: 30px;
    width: auto;
    max-width: 80px;
    object-fit: contain;
    opacity: 0.7;
    transition: var(--transition);
}

.property-card:hover .card-agency img {
    opacity: 1;
}

/* --- 8. Stats --- */
.stats {
    background: var(--color-primary);
    padding: 48px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    text-align: center;
}

.stat-item h3 {
    font-size: 32px;
    font-weight: 800;
    color: white;
}

.stat-item p {
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* --- 9. Footer --- */
.footer {
    background: #0d1442;
    color: rgba(255,255,255,0.7);
    padding: 48px 0 24px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

.footer h4 {
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.footer ul {
    list-style: none;
}

.footer ul li {
    margin-bottom: 8px;
}

.footer ul li a {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    transition: var(--transition);
}

.footer ul li a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.footer-bottom p {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.footer-social {
    display: flex;
    gap: 12px;
}

.footer-social a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    transition: var(--transition);
    font-size: 14px;
}

.footer-social a:hover {
    background: var(--color-secondary);
    color: white;
}

/* --- 10. Admin Banner Indicator --- */
.admin-slot-indicator {
    border: 2px dashed var(--color-secondary);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    background: rgba(209,80,41,0.05);
    position: relative;
}

.admin-slot-indicator::before {
    content: attr(data-slot);
    position: absolute;
    top: -10px;
    left: 16px;
    background: var(--color-secondary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* --- 11. Listing Page --- */
.listing-layout {
    display: flex;
    gap: 24px;
    padding-top: 80px;
    min-height: 100vh;
}

.listing-sidebar {
    display: none;
    width: 280px;
    flex-shrink: 0;
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 80px;
    /* Scroll interno propio: el panel no obliga a scrollear toda la página */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
}
.listing-sidebar::-webkit-scrollbar { width: 8px; }
.listing-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.filter-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-muted);
    margin-bottom: 10px;
}

.filter-section select,
.filter-section input[type="number"],
.filter-section input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--color-text);
    background: white;
    margin-bottom: 8px;
    transition: var(--transition);
}

.filter-section select:focus,
.filter-section input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26,35,126,0.08);
}

.filter-row {
    display: flex;
    gap: 8px;
}

.filter-row > * { flex: 1; }

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
}

.filter-checkbox input[type="checkbox"] {
    accent-color: var(--color-primary);
    width: 16px;
    height: 16px;
}

.btn-filter {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 10px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-filter:hover {
    background: #0d1442;
}

.btn-filter-clear {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--color-muted);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    margin-top: 8px;
    transition: var(--transition);
}

.btn-filter-clear:hover {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

.listing-main {
    flex: 1;
    min-width: 0;
}

.listing-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.listing-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.listing-topbar-left h2 {
    font-size: 16px;
    font-weight: 600;
}

.listing-topbar-left span {
    font-size: 13px;
    color: var(--color-muted);
}

.listing-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.listing-sort select {
    padding: 6px 10px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: white;
    color: var(--color-text);
}

.view-toggle {
    display: flex;
    gap: 4px;
}

.view-toggle-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--color-border);
    background: white;
    border-radius: var(--radius-sm);
    color: var(--color-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.view-toggle-btn.active,
.view-toggle-btn:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.listing-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.listing-grid-3col {
    grid-template-columns: repeat(3, 1fr);
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(26,35,126,0.08);
    color: var(--color-primary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.active-filter-tag i {
    cursor: pointer;
    opacity: 0.6;
}

.active-filter-tag i:hover {
    opacity: 1;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 32px;
    padding: 16px 0;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border: 1.5px solid transparent;
}

.pagination a {
    color: var(--color-text);
    border-color: var(--color-border);
    background: white;
    cursor: pointer;
}

.pagination a:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination .active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination .dots {
    color: var(--color-muted);
    border: none;
}

.btn-show-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition);
}

.btn-show-filters:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* --- 12. Map Page --- */
.map-layout {
    display: flex;
    height: calc(100vh - 64px);
    margin-top: 64px;
}

.map-sidebar {
    width: 420px;
    flex-shrink: 0;
    overflow-y: auto;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    display: none;
}

.map-sidebar-header {
    padding: 16px;
    background: white;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.map-sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.map-sidebar-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.map-sidebar-filters select {
    padding: 6px 10px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    background: white;
    color: var(--color-text);
    flex: 1;
    min-width: 100px;
}

.map-results {
    padding: 12px;
}

.map-property-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.map-property-card:hover,
.map-property-card.highlighted {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.map-card-image {
    width: 120px;
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.map-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-card-info {
    flex: 1;
    min-width: 0;
}

.map-card-info .badge {
    font-size: 10px;
    padding: 2px 8px;
    margin-bottom: 4px;
}

.map-card-info h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-card-info .card-location {
    font-size: 11px;
    margin-bottom: 6px;
}

.map-card-info .card-price {
    font-size: 16px;
}

.map-card-info .card-price small {
    font-size: 11px;
}

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

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

.map-overlay-btn {
    position: absolute;
    top: 12px;
    z-index: 5;
    padding: 8px 14px;
    background: white;
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.map-overlay-btn:hover {
    background: var(--color-primary);
    color: white;
}

.map-toggle-list {
    left: 12px;
}

.map-toggle-satellite {
    right: 12px;
}

.map-results-count {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: white;
    padding: 8px 20px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 5;
}

/* --- 13. Map Price Markers & InfoWindow --- */
.price-marker {
    background: white;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: all 0.15s ease;
}

.price-marker:hover,
.price-marker.active {
    background: var(--color-primary);
    color: white;
    transform: scale(1.1);
}

.gm-style .gm-style-iw-c { border-radius: 12px !important; padding: 0 !important; }
.gm-style .gm-style-iw-d { overflow: hidden !important; padding: 0 !important; }

.iw-card {
    width: 280px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.iw-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}

.iw-card-body {
    padding: 12px 14px;
}

.iw-card-body .badge {
    font-size: 10px;
    padding: 2px 8px;
    margin-bottom: 6px;
    display: inline-block;
}

.iw-card-body h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--color-text);
    line-height: 1.3;
}

.iw-location {
    font-size: 12px;
    color: var(--color-muted);
    margin-bottom: 8px;
}

.iw-specs {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--color-muted);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.iw-specs i { color: var(--color-primary); margin-right: 3px; }

.iw-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.iw-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}

.iw-btn {
    padding: 6px 14px;
    background: var(--color-secondary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.iw-btn:hover { background: #b8432a; }

/* --- 14. Inmobiliarias --- */
.inmo-hero {
    background: linear-gradient(135deg, #1a237e 0%, #283593 60%, #3949ab 100%);
    padding: 96px 0 32px;
    color: white;
    text-align: center;
}
.inmo-hero h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
}
.inmo-hero p {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-bottom: 22px;
}
.inmo-search {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    max-width: 620px;
    margin: 0 auto;
    padding: 6px 6px 6px 16px;
    gap: 10px;
}
.inmo-search > i {
    color: var(--color-muted);
    font-size: 15px;
    flex-shrink: 0;
}
.inmo-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
    background: transparent;
    min-width: 0;
}
.inmo-search input::placeholder { color: #adb5bd; font-weight: 400; }
.inmo-search button {
    flex-shrink: 0;
    border: none;
    background: var(--color-secondary);
    color: white;
    font-weight: 600;
    font-size: 14px;
    padding: 11px 22px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.inmo-search button:hover { background: #b8432a; }

.inmo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.inmo-card {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.inmo-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.inmo-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.inmo-logo {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: #fff;
    overflow: hidden;
}
/* Placeholder CSS para inmobiliarias sin logo (no depende de imagen) */
.inmo-logo-ph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(26,35,126,0.08), rgba(57,73,171,0.12));
    color: var(--color-primary);
    font-size: 24px;
}
.inmo-logo img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    padding: 4px;
}
.inmo-id { min-width: 0; flex: 1; }
.inmo-id h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.25;
    margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.inmo-mat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(26,35,126,0.08);
    padding: 3px 10px;
    border-radius: 12px;
}
.inmo-addr {
    font-size: 13px;
    color: var(--color-muted);
    display: flex;
    align-items: flex-start;
    gap: 6px;
}
.inmo-addr i { margin-top: 3px; flex-shrink: 0; }
.inmo-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}
.inmo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}
.inmo-btn-primary {
    flex: 1;
    background: var(--color-primary);
    color: white;
}
.inmo-btn-primary:hover { background: #0d1442; }
.inmo-btn-wa {
    flex-shrink: 0;
    width: 44px;
    background: #25D366;
    color: white;
    font-size: 18px;
}
.inmo-btn-wa:hover { background: #1da851; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Mobile menu toggle */
.navbar-menu.open {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    padding: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    gap: 2px;
    z-index: 999;
    border-top: 1px solid var(--color-border);
}
.navbar-menu.open li { list-style: none; }
.navbar-menu.open li a {
    display: block;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--color-text);
    font-weight: 500;
    text-decoration: none;
}
.navbar-menu.open li a:hover,
.navbar-menu.open li a.active {
    background: rgba(26,35,126,0.08);
    color: var(--color-primary);
}

/* Tablet */
@media (min-width: 640px) {
    .property-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .listing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .inmo-grid { grid-template-columns: repeat(2, 1fr); }
    .inmo-hero h1 { font-size: 30px; }
    .search-bar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
    }
    .search-field { flex: 1; min-width: 140px; }
    .btn-search { width: auto; flex: 0 0 auto; }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .map-sidebar { display: block; width: 360px; }
}

/* Desktop */
@media (min-width: 1024px) {
    .container { padding: 0 32px; }
    .navbar-toggle { display: none; }
    .navbar-menu { display: flex; }
    .navbar-cpi { display: flex; }
    .hero { padding: 140px 0 80px; }
    .hero h1 { font-size: 42px; }
    .hero p { font-size: 18px; }
    .property-grid { grid-template-columns: repeat(4, 1fr); }
    .listing-main .property-grid { grid-template-columns: repeat(3, 1fr); }
    .listing-grid { grid-template-columns: repeat(3, 1fr); }
    .inmo-grid { grid-template-columns: repeat(3, 1fr); }
    .listing-sidebar { display: block; }
    .btn-show-filters { display: none; }
    .section { padding: 56px 0; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
    .footer-bottom { flex-direction: row; justify-content: space-between; }
    .search-bar { flex-wrap: nowrap; padding: 20px 24px; }
    .map-sidebar { display: block; width: 420px; }
}

/* Large Desktop */
@media (min-width: 1440px) {
    .container { max-width: 1360px; }
}