:root {
    --building-color: #ff9800;
    --house-color: #0288d1;
    --shop-color: #7b1fa2;
    --warehouse-color: #558b2f;
}

/*
 * Optional: Makes the sample page fill the window.
 */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}
body {
    padding-top: 0;
    display: flex;
    flex-direction: column;
}

/* Map Container Layout */
#map-container {
    display: flex;
    flex: 1;
    width: 100%;
    overflow: hidden;
}

#map-sidebar {
    width: 320px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(241,245,249,0.98));
    border-right: 1px solid rgba(148, 163, 184, 0.26);
    overflow-y: auto;
    padding: 1rem;
    box-shadow: 12px 0 24px rgba(15, 23, 42, 0.08);
    z-index: 100;
}

.search-box {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(148,163,184,0.18);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.search-input {
    flex: 1;
    padding: 0.8rem 0.9rem;
    border: none;
    border-radius: 10px;
    font-size: 0.94rem;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

.search-input:focus {
    box-shadow: inset 0 0 0 2px rgba(37,99,235,0.28);
    background: white;
}

.search-btn {
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.18);
}

.search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(37, 99, 235, 0.22);
}

.map-actions {
    margin-bottom: 1rem;
}

.use-location-btn {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e3a8a;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    box-shadow: 0 12px 20px rgba(37, 99, 235, 0.12);
}

.use-location-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
    box-shadow: 0 14px 22px rgba(37, 99, 235, 0.16);
}

.use-location-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

#map-address,
#route-info,
#municipio-info h5,
#municipio-info .text-muted {
    display: none !important;
}

#municipio-info h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.ofertas-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.oferta-card {
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(248,250,252,0.9));
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
}

.oferta-card:hover {
    background: linear-gradient(180deg, rgba(239,246,255,0.95), rgba(219,234,254,0.8));
    border-color: rgba(37, 99, 235, 0.26);
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.12);
}

.oferta-card h6 {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oferta-card small {
    font-size: 0.75rem;
    color: #6b7280;
}

#map {
    flex: 1;
    height: 100%;
    width: auto;
    background: #f0f0f0;
}

#map-container {
    flex: 1;
    display: flex;
    min-height: calc(100vh - 110px);
}

#map-sidebar {
    width: 320px;
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    overflow-y: auto;
    padding: 1rem;
    box-shadow: 2px 0 14px rgba(15, 23, 42, 0.08);
    z-index: 100;
}

#map-sidebar p {
    margin: 0;
    color: #4b5563;
}

#map {
    flex: 1;
    height: 100%;
    width: auto;
    background: #f0f0f0;
}

/*
 * Always set the map height explicitly to define the size of the div element
 * that contains the map.
 */
/*
 * Property styles in unhighlighted state.
 */
.property {
    align-items: center;
    background-color: #ffffff;
    border-radius: 50%;
    color: #263238;
    display: flex;
    font-size: 14px;
    gap: 15px;
    height: 30px;
    justify-content: center;
    padding: 4px;
    position: relative;
    position: relative;
    transition: all 0.3s ease-out;
    width: 30px;
    transform: translateY(-9px);
}

.property::after {
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-top: 9px solid #ffffff;
    content: '';
    height: 0;
    left: 50%;
    position: absolute;
    top: 95%;
    transform: translate(-50%, 0);
    transition: all 0.3s ease-out;
    width: 0;
    z-index: 1;
}

.property .icon {
    align-items: center;
    display: flex;
    justify-content: center;
    color: #ffffff;
}

.property .icon svg {
    height: 20px;
    width: auto;
}

.property .details {
    display: none;
    flex-direction: column;
    flex: 1;
}

.property .address {
    color: #9e9e9e;
    font-size: 10px;
    margin-bottom: 10px;
    margin-top: 5px;
}

.property .features {
    align-items: flex-end;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.property .features > div {
    align-items: center;
    background: #f5f5f5;
    border-radius: 5px;
    border: 1px solid #ccc;
    display: flex;
    font-size: 10px;
    gap: 5px;
    padding: 5px;
}

/*
 * Property styles in highlighted state.
 */
.property.highlight {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 10px 10px 5px rgba(0, 0, 0, 0.2);
    height: 80px;
    padding: 8px 15px;
    width: auto;
}

.property.highlight::after {
    border-top: 9px solid #ffffff;
}

.property.highlight .details {
    display: flex;
}

.property.highlight .icon svg {
    width: 50px;
    height: 50px;
}

.property .bed {
    color: #ffa000;
}

.property .bath {
    color: #03a9f4;
}

.property .size {
    color: #388e3c;
}

/* Modo oscuro para el sidebar */
@media (prefers-color-scheme: dark) {
    #map-sidebar {
        background: #1f2937;
        border-right-color: rgba(255, 255, 255, 0.1);
        color: #f3f4f6;
    }

    #municipio-info h5 {
        color: #f3f4f6;
    }

    .search-input {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }

    .search-input:focus {
        border-color: #2563eb;
    }

    .oferta-card {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }

    .oferta-card:hover {
        background: #4b5563;
        border-color: #2563eb;
    }

    .oferta-card small {
        color: #d1d5db;
    }
}

/* Responsive */
@media (max-width: 768px) {
    #map-container {
        flex-direction: column;
    }

    #map-sidebar {
        width: 100%;
        height: auto;
        max-height: 35%;
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    #map {
        flex: 1;
        height: 65%;
    }
}

/*
 * House icon colors.
 */
.property.highlight:has(.fa-house) .icon {
    color: var(--house-color);
}

.property:not(.highlight):has(.fa-house) {
    background-color: var(--house-color);
}

.property:not(.highlight):has(.fa-house)::after {
    border-top: 9px solid var(--house-color);
}

/*
 * Building icon colors.
 */
.property.highlight:has(.fa-building) .icon {
    color: var(--building-color);
}

.property:not(.highlight):has(.fa-building) {
    background-color: var(--building-color);
}

.property:not(.highlight):has(.fa-building)::after {
    border-top: 9px solid var(--building-color);
}

/*
 * Warehouse icon colors.
 */
.property.highlight:has(.fa-warehouse) .icon {
    color: var(--warehouse-color);
}

.property:not(.highlight):has(.fa-warehouse) {
    background-color: var(--warehouse-color);
}

.property:not(.highlight):has(.fa-warehouse)::after {
    border-top: 9px solid var(--warehouse-color);
}

/*
 * Shop icon colors.
 */
.property.highlight:has(.fa-shop) .icon {
    color: var(--shop-color);
}

.property:not(.highlight):has(.fa-shop) {
    background-color: var(--shop-color);
}

.property:not(.highlight):has(.fa-shop)::after {
    border-top: 9px solid var(--shop-color);
}

/* Popup Styles para Ofertas */
.oferta-popup .leaflet-popup-content-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: none;
    padding: 0;
    overflow: hidden;
}

.oferta-popup .leaflet-popup-content {
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
}

.oferta-popup .leaflet-popup-tip-container {
    display: none;
}

/* Animación de hover para el popup */
.leaflet-popup {
    animation: popupFadeIn 0.2s ease-in;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}