/* ================================================
   Leaflet Map Custom Controls
   ================================================ */

.workzone-map-container {
    height: 300px;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 8px;
    position: relative;
    z-index: 1;
    /* Ensure map stays below modal overlays if any */
}

@media (max-width: 768px) {
    .workzone-map-container {
        height: 400px;
        /* Taller on mobile for better visibility */
    }
}

/* --- Search Control Container --- */
.map-search-control {
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    border: none !important;
    padding: 8px !important;
    min-width: 260px;
    max-width: 320px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

.search-container {
    position: relative;
}

/* --- Search Input Row --- */
.search-input-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.map-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f8fafc;
    color: #1e293b;
}

.map-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: white;
}

.map-search-input::placeholder {
    color: #94a3b8;
}

.map-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: #3b82f6;
    color: white;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.map-search-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.map-search-btn:active {
    transform: scale(0.95);
}

/* --- Search Results Dropdown --- */
.map-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 10000;
    border: 1px solid #e2e8f0;
}

.map-search-results::-webkit-scrollbar {
    width: 6px;
}

.map-search-results::-webkit-scrollbar-track {
    background: transparent;
}

.map-search-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.search-result-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #eff6ff;
}

.result-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.result-subtitle {
    font-size: 11px;
    color: #64748b;
    line-height: 1.3;
}

.search-loading,
.search-no-results {
    padding: 14px 12px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
    list-style: none;
}

.search-loading {
    color: #3b82f6;
}

/* --- My Location Button --- */
.map-location-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.map-location-btn:hover {
    background: #f0f9ff;
    border-color: #3b82f6;
    color: #2563eb;
}

.map-location-btn:active {
    transform: scale(0.95);
}

.map-location-btn.locating {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}

/* Spinning animation for locating */
.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ================================================
   "You Are Here" Pulsing Blue Dot
   ================================================ */
.user-location-marker {
    background: transparent !important;
    border: none !important;
}

.pulse-dot {
    position: relative;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-dot::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4285f4;
    border: 2.5px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.pulse-ring {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(66, 133, 244, 0.25);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse-ring 2s ease-out infinite;
    z-index: 1;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* ================================================
   Responsive: Smaller screens
   ================================================ */
@media (max-width: 480px) {
    .map-search-control {
        min-width: 180px;
        max-width: 220px;
        padding: 6px !important;
        border-radius: 8px !important;
    }

    .map-search-input {
        font-size: 11px;
        padding: 5px 8px;
    }

    .map-search-btn {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }

    .map-search-btn svg {
        width: 14px;
        height: 14px;
    }

    .map-location-btn {
        font-size: 11px;
        padding: 5px 8px;
        gap: 4px;
        border-radius: 6px;
    }

    .map-location-btn svg {
        width: 14px;
        height: 14px;
    }

    .search-divider {
        margin: 4px 0;
    }

    /* Scale down default Leaflet layer control */
    .leaflet-control-layers {
        border-radius: 8px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    }

    .leaflet-control-layers-toggle {
        width: 32px !important;
        height: 32px !important;
        background-size: 20px 20px !important;
    }

    .leaflet-control-layers-list {
        font-size: 11px;
        padding: 4px;
    }
}