/* Interactive Map Styles */

/* Map Container */
.map-container {
    position: relative;
    height: 600px;
    border-radius: 0.5rem;
    overflow: hidden;
}

#interactive-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Map Controls Panel */
.map-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    max-width: 300px;
}

.control-section {
    margin-bottom: 1rem;
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* Search Box */
.search-container {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.search-input:focus {
    border-color: var(--exxon-blue);
    box-shadow: 0 0 0 2px rgba(var(--exxon-blue-rgb), 0.1);
    outline: none;
}

.search-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
}

.search-clear:hover {
    color: var(--gray-600);
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-300);
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
}

.search-suggestion {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
}

.search-suggestion:hover {
    background-color: var(--gray-50);
}

.search-suggestion:last-child {
    border-bottom: none;
}

.suggestion-title {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-900);
}

.suggestion-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Filter Controls */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: white;
}

.filter-select:focus {
    border-color: var(--exxon-blue);
    box-shadow: 0 0 0 2px rgba(var(--exxon-blue-rgb), 0.1);
    outline: none;
}

/* Project Count */
.project-count {
    font-size: 0.875rem;
    color: var(--gray-600);
    padding: 0.5rem 0;
    border-top: 1px solid var(--gray-200);
    margin-top: 0.5rem;
}

/* Clear Filters Button */
.clear-filters {
    width: 100%;
    padding: 0.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filters:hover {
    background: var(--gray-200);
}

/* Custom Markers */
.custom-marker {
    background: none;
    border: none;
}

.marker-pin {
    width: 24px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    background: #0066CC;
    border: 3px solid #22C55E;
    transform: rotate(-45deg);
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.marker-inner {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

/* Marker Clusters */
.marker-cluster {
    background-color: rgba(110, 204, 57, 0.8);
    border-radius: 50%;
    text-align: center;
    color: white;
    font-weight: bold;
    border: 2px solid rgba(110, 204, 57, 1);
}

.marker-cluster-small {
    width: 30px;
    height: 30px;
    line-height: 26px;
    font-size: 12px;
}

.marker-cluster-medium {
    width: 40px;
    height: 40px;
    line-height: 36px;
    font-size: 14px;
}

.marker-cluster-large {
    width: 50px;
    height: 50px;
    line-height: 46px;
    font-size: 16px;
}

.cluster-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.project-popup-content {
    padding: 0;
}

.popup-header {
    padding: 1rem 1rem 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.popup-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--gray-900);
}

.popup-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
}

.badge-delivery-line {
    /* Color set dynamically */
}

.badge-status {
    color: white;
}

.badge-active {
    background-color: #22C55E;
}

.badge-paused {
    background-color: #F59E0B;
}

.badge-closed {
    background-color: #EF4444;
}

.popup-body {
    padding: 1rem;
}

.popup-summary {
    margin: 0 0 1rem 0;
    color: var(--gray-700);
    line-height: 1.5;
}

.popup-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-item {
    font-size: 0.875rem;
    color: var(--gray-600);
}

.popup-footer {
    padding: 0 1rem 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--exxon-blue);
    color: white;
}

.btn-primary:hover {
    background-color: #0052A3;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Legend */
.map-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    max-width: 250px;
}

.legend-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    color: var(--gray-700);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.legend-count {
    margin-left: auto;
    font-weight: 500;
    color: var(--gray-600);
}

/* Responsive Design */
@media (max-width: 768px) {
    .map-controls {
        position: relative;
        top: 0;
        left: 0;
        max-width: none;
        margin-bottom: 1rem;
        border-radius: 0.5rem 0.5rem 0 0;
    }
    
    .map-container {
        height: 400px;
    }
    
    .filter-group {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .filter-select {
        flex: 1;
    }
    
    .map-legend {
        position: relative;
        bottom: auto;
        left: auto;
        margin-top: 1rem;
    }
}

/* Touch improvements */
@media (pointer: coarse) {
    .search-input,
    .filter-select,
    .clear-filters {
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .search-suggestion {
        padding: 1rem 0.75rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        min-height: 44px;
    }
}

/* Focus states for keyboard navigation */
.search-input:focus,
.filter-select:focus,
.clear-filters:focus {
    border-color: var(--exxon-blue);
    box-shadow: 0 0 0 3px rgba(var(--exxon-blue-rgb), 0.1);
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .marker-pin {
        border-width: 4px;
    }
    
    .badge {
        border: 2px solid currentColor;
    }
    
    .map-legend,
    .map-controls {
        border: 2px solid var(--gray-400);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .search-suggestion,
    .clear-filters {
        transition: none;
    }
    
    .marker-pin {
        box-shadow: none;
    }
}