/**
 * WantsMap Leaflet Custom Styles
 * Mobile-first, dark theme styling for markers and clusters
 */

/* ===== Map Container ===== */
#wants-map-container {
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    z-index: 1;
}

/* ===== Individual Markers ===== */
.wants-marker-container {
    background: transparent !important;
    border: none !important;
}

.wants-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    color: #ffffff;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wants-marker:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.wants-marker-small {
    width: 24px;
    height: 24px;
    font-size: 10px;
}

.wants-marker-medium {
    width: 30px;
    height: 30px;
    font-size: 11px;
}

.wants-marker-large {
    width: 36px;
    height: 36px;
    font-size: 12px;
}

/* ===== Cluster Icons ===== */
.marker-cluster {
    background: transparent !important;
}

.cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.cluster-icon:hover {
    transform: scale(1.1);
}

.cluster-small {
    width: 30px;
    height: 30px;
    font-size: 11px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.cluster-medium {
    width: 40px;
    height: 40px;
    font-size: 13px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
}

.cluster-large {
    width: 50px;
    height: 50px;
    font-size: 14px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* ===== Popup Styles ===== */
.leaflet-popup-content-wrapper {
    background: #1a1a2e;
    border: 1px solid #2d3a5a;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-content {
    margin: 12px 14px;
    color: #e0e0e0;
}

.leaflet-popup-tip {
    background: #1a1a2e;
    border: 1px solid #2d3a5a;
    box-shadow: none;
}

.wants-popup {
    min-width: 180px;
}

.popup-address {
    font-weight: 600;
    font-size: 14px;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.3;
}

.popup-count {
    font-size: 12px;
    color: #60a5fa;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2d3a5a;
}

.popup-names {
    margin-bottom: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.popup-person {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px dotted #2d3a5a;
}

.popup-person:last-child {
    border-bottom: none;
}

.popup-person-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    border: 2px solid #3b82f6;
    background-color: #2d3a5a;
}

.popup-person-name {
    font-size: 12px;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popup-more {
    font-size: 11px;
    color: #6b7280;
    font-style: italic;
    padding-top: 4px;
}

.popup-btn {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    /* Mobile touch target - minimum 44px */
    min-height: 44px;
}

.popup-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.popup-btn:active {
    transform: scale(0.98);
}

/* ===== Status Bar ===== */
.map-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    font-size: 14px;
    border-bottom: 1px solid #2d3a5a;
    min-height: 44px;
}

.status-text {
    color: #4ade80;
}

.status-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fbbf24;
}

.status-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #fbbf24;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-count {
    color: #60a5fa;
    font-weight: 600;
}

/* ===== Control Buttons ===== */
.map-controls {
    position: absolute;
    top: 70px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-control-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid #2d3a5a;
    background: rgba(26, 26, 46, 0.95);
    color: #e0e0e0;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.map-control-btn:hover {
    background: rgba(45, 58, 90, 0.95);
}

.map-control-btn:active {
    transform: scale(0.95);
}

/* ===== Legend ===== */
.map-legend {
    position: absolute;
    bottom: 80px;
    right: 10px;
    background: rgba(26, 26, 46, 0.95);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #2d3a5a;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.legend-title {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: #a0aec0;
    font-size: 11px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-marker {
    border-radius: 50%;
    border: 2px solid #ffffff;
    flex-shrink: 0;
}

.legend-marker.small {
    width: 12px;
    height: 12px;
    background: #ef4444;
}

.legend-marker.medium {
    width: 16px;
    height: 16px;
    background: #f97316;
}

.legend-marker.large {
    width: 20px;
    height: 20px;
    background: #dc2626;
}

/* ===== Instructions ===== */
.map-instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 46, 0.95);
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid #2d3a5a;
    color: #a0aec0;
    font-size: 12px;
    z-index: 1000;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .map-status-bar {
        padding: 8px 12px;
        font-size: 12px;
        flex-wrap: wrap;
        gap: 4px;
    }

    .map-legend {
        bottom: 70px;
        right: 8px;
        padding: 10px 12px;
    }

    .legend-item {
        font-size: 10px;
    }

    .map-instructions {
        bottom: 15px;
        padding: 8px 16px;
        font-size: 11px;
        max-width: 80%;
    }

    .popup-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .map-controls {
        top: 60px;
        right: 8px;
    }

    /* Larger touch targets on mobile */
    .wants-marker-small {
        width: 28px;
        height: 28px;
    }

    .wants-marker-medium {
        width: 34px;
        height: 34px;
    }

    .wants-marker-large {
        width: 40px;
        height: 40px;
    }

    .cluster-small {
        width: 36px;
        height: 36px;
    }

    .cluster-medium {
        width: 46px;
        height: 46px;
    }

    .cluster-large {
        width: 56px;
        height: 56px;
    }
}

/* ===== Dark Mode Leaflet Overrides ===== */
.leaflet-control-zoom a {
    background: rgba(26, 26, 46, 0.95) !important;
    color: #e0e0e0 !important;
    border: 1px solid #2d3a5a !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(45, 58, 90, 0.95) !important;
}

.leaflet-control-attribution {
    background: rgba(26, 26, 46, 0.8) !important;
    color: #6b7280 !important;
}

.leaflet-control-attribution a {
    color: #60a5fa !important;
}

/* Hide default cluster styles */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: transparent !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: transparent !important;
}
