/* Enhanced Map Interactions CSS - Inspired by Mapbox Real Estate */

/* Hover Effects */
@keyframes pulse-hover {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.3;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.6;
    }
}

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

/* Hover Tooltip */
.map-hover-tooltip {
    background: rgba(0, 0, 0, 0.9) !important;
    border: none !important;
    border-radius: 8px !important;
    color: white !important;
    padding: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.map-hover-tooltip::before {
    border-top-color: rgba(0, 0, 0, 0.9) !important;
}

.hover-tooltip {
    padding: 12px 16px;
}

.tooltip-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.tooltip-type {
    font-size: 12px;
    color: #22c55e;
    margin-bottom: 4px;
}

.tooltip-price {
    font-size: 13px;
    font-weight: 600;
    color: #fbbf24;
}

/* Enhanced Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
    padding: 0 !important;
}

.enhanced-popup {
    min-width: 350px !important;
}

.enhanced-popup-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

.popup-image-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popup-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-image {
    color: #9ca3af;
    font-size: 24px;
}

.popup-header-info {
    flex: 1;
}

.popup-title-enhanced {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}

.popup-type-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #16a34a;
    color: white;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 12px;
    margin-bottom: 6px;
}

.popup-location {
    color: #6b7280;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.popup-details-enhanced {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.detail-item i {
    color: #16a34a;
    width: 14px;
    text-align: center;
}

.detail-item.price {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #92400e;
    font-weight: 600;
}

.detail-item.price i {
    color: #d97706;
}

.detail-item.feature {
    background: #dcfce7;
    border-color: #22c55e;
    color: #15803d;
}

.detail-item.rating {
    background: #fef3c7;
    border-color: #fbbf24;
}

.detail-item.rating i {
    color: #f59e0b;
}

.popup-actions-enhanced {
    padding: 16px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.action-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
}

.action-btn.primary {
    background: #16a34a;
    color: white;
}

.action-btn.primary:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.action-btn.secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.action-btn.secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.popup-footer-enhanced {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

.selection-count {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.compare-btn {
    padding: 6px 12px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.compare-btn:hover:not(:disabled) {
    background: #1d4ed8;
}

.compare-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Advanced Search Control */
.leaflet-control-advanced-search {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    min-width: 300px;
    max-width: 350px;
}

.search-control-header {
    padding: 12px 16px;
    background: #16a34a;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.search-control-header span {
    flex: 1;
    font-weight: 600;
    font-size: 14px;
}

.toggle-search {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.toggle-search:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-panel {
    padding: 16px;
}

.search-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.search-btn {
    padding: 10px 12px;
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-btn:hover {
    background: #15803d;
}

.search-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

.price-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
}

.search-tools {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.tool-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
}

.tool-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.tool-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.tool-btn.secondary {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.tool-btn.secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
}

/* Drawing Instructions */
.drawing-instructions {
    background: rgba(37, 99, 235, 0.95) !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

.drawing-instructions::before {
    border-top-color: rgba(37, 99, 235, 0.95) !important;
}

/* Feature State Animations */
.hover-indicator {
    pointer-events: none !important;
}

.selection-indicator {
    pointer-events: none !important;
    transform-origin: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .leaflet-control-advanced-search {
        min-width: 280px;
        max-width: 320px;
    }
    
    .popup-details-enhanced {
        grid-template-columns: 1fr;
    }
    
    .action-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .enhanced-popup {
        min-width: 300px !important;
    }
    
    .popup-header-enhanced {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .popup-image-placeholder {
        width: 100px;
        height: 100px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .leaflet-control-advanced-search {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .search-input, .price-input, .filter-group select {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .tool-btn {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .enhanced-popup-content {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .popup-header-enhanced {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    }
    
    .detail-item {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
}

/* Search Message Overlay */
.search-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    max-width: 400px;
    width: 90%;
}

.search-message-content {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

.search-message-content i.fa-info-circle {
    color: #2563eb;
    font-size: 20px;
    flex-shrink: 0;
}

.search-message-content span {
    flex: 1;
    font-size: 14px;
    color: #374151;
}

.search-message-content button {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.search-message-content button:hover {
    background: #f3f4f6;
    color: #374151;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Search Highlight Marker */
.search-highlight-marker {
    background: #2563eb !important;
    color: white !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    animation: searchPulse 1s infinite !important;
}

@keyframes searchPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .action-btn.primary {
        background: #000;
    }
    
    .popup-type-badge {
        background: #000;
    }
    
    .search-control-header {
        background: #000;
    }
    
    .search-message-content {
        border: 2px solid #000;
        background: #fff;
    }
}
/* Search Input Container with Clear Button */
.search-input-container {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

.map-search-input {
    width: 100% !important;
    padding: 8px 35px 8px 12px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    outline: none !important;
    transition: all 0.3s ease !important;
}

.search-clear-btn {
    position: absolute !important;
    right: 8px !important;
    background: none !important;
    border: none !important;
    color: #6b7280 !important;
    cursor: pointer !important;
    padding: 4px !important;
    border-radius: 3px !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important;
    font-size: 12px !important;
}

.search-clear-btn:hover {
    background: #f3f4f6 !important;
    color: #374151 !important;
}
