/**
 * Multi Apartments Map Styles - MapLibre GL JS Version
 */

.multi-apartments-map-container {
    position: relative;
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    height: 500px; /* Required for MapLibre GL JS */
}

.multi-apartments-map {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    z-index: 1;
}

/* Ensure map canvas receives mouse events */
.multi-apartments-map .maplibregl-canvas {
    cursor: grab !important;
    pointer-events: auto !important;
}

.multi-apartments-map .maplibregl-canvas:active {
    cursor: grabbing !important;
}

.multi-apartments-map .maplibregl-canvas-container {
    cursor: grab !important;
    pointer-events: auto !important;
}

.multi-apartments-map .maplibregl-canvas-container:active {
    cursor: grabbing !important;
}

/* Ensure no overlays block map interaction */
.multi-apartments-map-container * {
    pointer-events: none;
}

.multi-apartments-map-container .maplibregl-canvas-container,
.multi-apartments-map-container .maplibregl-canvas,
.multi-apartments-map-container .maplibregl-ctrl,
.multi-apartments-map-container .maplibregl-ctrl * {
    pointer-events: auto !important;
}

/* Filters */
.map-filters {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.map-search-input,
.map-filter-select {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.map-search-input:focus,
.map-filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* MapLibre GL JS Controls */
.maplibregl-ctrl {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

.maplibregl-ctrl-group {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
    overflow: hidden;
}

.maplibregl-ctrl button {
    background: transparent !important;
    border: none !important;
    color: #374151 !important;
    font-size: 18px !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
}

.maplibregl-ctrl button:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #3b82f6 !important;
}

.maplibregl-ctrl button:not(:disabled):hover {
    background: rgba(59, 130, 246, 0.1) !important;
}

/* Reset Control Specific Styles */
.map-reset-control {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 12px !important;
    border: none !important;
    overflow: hidden !important;
    margin-bottom: 10px !important;
}

.maplibregl-ctrl-reset {
    background: transparent !important;
    border: none !important;
    color: #374151 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 8px 16px !important;
    width: auto !important;
    height: auto !important;
    min-width: 80px !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    border-radius: 8px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

.maplibregl-ctrl-reset:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #3b82f6 !important;
    transform: translateY(-1px) !important;
}

/* Popup styling for MapLibre GL JS */
.maplibregl-popup {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.maplibregl-popup-content {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 0;
    overflow: hidden;
}

.custom-popup {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    max-width: 320px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.custom-popup .popup-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 16px;
    border-radius: 16px 16px 0 0;
}

.custom-popup .popup-image {
    width: 90px;
    height: 70px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.custom-popup .popup-image:hover {
    transform: scale(1.05);
}

.custom-popup .popup-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.custom-popup .popup-price {
    font-size: 20px;
    font-weight: 800;
    color: #059669;
    margin-bottom: 10px;
    text-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}

.custom-popup .popup-details {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.custom-popup .popup-details span {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 500;
}

.custom-popup .popup-link {
    display: inline-block;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.custom-popup .popup-link:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* Dark theme option */
.multi-apartments-map-container.dark-theme {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.multi-apartments-map-container.dark-theme .map-filters {
    background: rgba(30, 41, 59, 0.95);
    color: #f1f5f9;
}

.multi-apartments-map-container.dark-theme .filter-group label {
    color: #cbd5e1;
}

.multi-apartments-map-container.dark-theme .map-search-input,
.multi-apartments-map-container.dark-theme .map-filter-select {
    background: rgba(51, 65, 85, 0.8);
    border-color: #475569;
    color: #f1f5f9;
}

.multi-apartments-map-container.dark-theme .map-search-input::placeholder,
.multi-apartments-map-container.dark-theme .map-filter-select {
    color: #94a3b8;
}

.multi-apartments-map-container.dark-theme .map-legend {
    background: rgba(30, 41, 59, 0.95);
    color: #f1f5f9;
}

.multi-apartments-map-container.dark-theme .legend-item {
    color: #cbd5e1;
}

/* Smooth transitions for interactive elements only */
.multi-apartments-map-container button,
.multi-apartments-map-container input,
.multi-apartments-map-container select {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading state */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    border-radius: 12px;
}

.map-loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */

/* Property Card Popup Styles */
.map-property-popup .maplibregl-popup-content {
    padding: 0;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    background: transparent;
    border: none;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.map-property-popup .maplibregl-popup-content.popup-fade-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.map-property-popup .maplibregl-popup-content.popup-fade-out {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
}

/* Hide all popup tips */
.map-property-popup .maplibregl-popup-tip {
    display: none !important;
}

/* Disable interfering popup tip styles */
.maplibregl-popup-tip {
    background: transparent !important;
    box-shadow: none !important;
}

/* Fix popup close button styling */
.map-property-popup .maplibregl-popup-close-button {
    background: transparent !important;
    border: none !important;
    color: #666 !important;
    font-size: 20px !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    font-family: Arial, sans-serif !important;
    font-weight: normal !important;
    cursor: pointer !important;
    opacity: 0.7 !important;
    transition: opacity 0.2s ease !important;
}

.map-property-popup .maplibregl-popup-close-button:hover {
    opacity: 1 !important;
    background: transparent !important;
}

.map-popup-card {
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    background: var(--e-global-color-aa5884c);
}

.map-popup-card .property-image-wrapper {
    height: 50%;
    position: relative;
    overflow: hidden;
}

.map-popup-card .property-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.map-popup-card .property-info {
    padding: 15px;
    background: var(--e-global-color-aa5884c);
}

.map-popup-card .property-title {
    font-size: clamp(18px, 4vw, 26px);
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.3;
    min-height: auto;
}

.map-popup-card .property-title a {
    color: var(--e-global-color-primary);
    text-decoration: none;
}

.map-popup-card .property-title a:hover {
    color: var(--e-global-color-secondary);
}

.map-popup-card .property-price {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    font-family: var(--e-global-typography-primary-font-family), Sans-serif;
}

.map-popup-card .property-meta-cards {
    display: flex;
    gap: 12px;
    padding-top: 0;
    border-top: none;
    margin-top: 8px;
}

.map-popup-card .property-meta-cards span {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--e-global-color-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.map-popup-card .property-meta-cards .icon-small {
    width: 14px;
    height: 14px;
    color: var(--e-global-color-secondary);
}

.map-popup-card a[href]:not(.property-title a) {
    display: inline-block;
    color: var(--e-global-color-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.map-popup-card a[href]:not(.property-title a):hover {
    color: var(--e-global-color-secondary);
}

/* ========================================
   MOBILE MODAL STYLES
   ======================================== */

/* Mobile modal overlay */
.map-mobile-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
}

/* Mobile modal content */
.map-mobile-modal-content {
    background: var(--e-global-color-aa5884c) !important;
    border-radius: 8px !important;
    max-width: 90% !important;
    max-height: 80% !important;
    overflow-y: auto !important;
    position: relative !important;
    animation: modalFadeIn 0.3s ease-out !important;
}

/* Mobile modal card adjustments */
.map-mobile-modal .map-popup-card {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Close button for mobile modal */
.map-mobile-modal-close {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    background: var(--e-global-color-aa5884c) !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 18px !important;
    cursor: pointer !important;
    z-index: 10000 !important;
    color: var(--e-global-color-secondary) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    border: none !important;
}

/* Modal fade-in animation */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Prevent body scroll when modal is open */
body.has-mobile-modal {
    overflow: hidden !important;
}