/* ==========================================================================
   Map Common Styles — shared between Public/Map and GIS Map Editor
   ========================================================================== */

/* Top Bar */
.map-top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: linear-gradient(to bottom, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%);
    backdrop-filter: blur(8px);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.back-btn {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.back-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.page-title {
    font-weight: 600;
    color: #111827;
    font-size: 16px;
}

.page-subtitle {
    font-size: 11px;
    color: #6b7280;
}

/* Search Box */
.search-container {
    flex: 1;
    max-width: 400px;
    margin-left: auto;
}

.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 36px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    background: white;
    transition: all 0.2s;
}

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

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
}

.clear-btn:hover {
    color: #6b7280;
}

/* Bottom Controls */
.bottom-controls {
    position: absolute;
    bottom: 24px;
    left: 16px;
    right: 16px;
    z-index: 1001;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
}

.bottom-controls > * {
    pointer-events: auto;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    width: 48px;
    height: 48px;
    background: white;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 18px;
}

.action-btn:hover {
    background: #f3f4f6;
    transform: scale(1.05);
}

.action-btn.location-btn {
    color: #22c55e;
}

.action-btn.location-btn:hover {
    background: #dcfce7;
}

.action-btn.home-btn {
    color: #3b82f6;
}

.action-btn.home-btn:hover {
    background: #dbeafe;
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
}

/* Hover Tooltip */
.map-tooltip {
    position: absolute;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    white-space: nowrap;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    transform: translate(-50%, -100%);
    margin-top: -12px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.map-tooltip.visible {
    opacity: 1;
}

.map-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
}

.map-tooltip .tooltip-type {
    font-size: 10px;
    opacity: 0.7;
    margin-right: 6px;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1002;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 16px;
    color: #6b7280;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .map-top-bar {
        padding: 10px 12px;
    }

    .page-title {
        font-size: 14px;
    }

    .search-container {
        display: none;
    }

    .bottom-controls {
        bottom: 16px;
        left: 12px;
        right: 12px;
    }

    .action-btn {
        width: 44px;
        height: 44px;
    }
}
