/**
 * MapView Component Styles
 * Leaflet.js 기반 맵 컴포넌트 스타일
 */

/* 맵 컨테이너 */
.map-container {
    width: 100%;
    height: 100%;
    min-height: 400px;
    position: relative;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
}

.map-container-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
}

/* 맵 로딩 오버레이 */
.map-loading {
    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: 1000;
}

.map-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e5e5;
    border-top-color: #f97316;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.map-loading-text {
    margin-top: 12px;
    color: #666;
    font-size: 14px;
}

/* 커스텀 마커 아이콘 */
.custom-marker-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.leaflet-marker-icon {
    background: transparent !important;
    border: none !important;
}

/* 마커 클러스터 */
.marker-cluster {
    background: transparent;
}

.cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
}

/* 사용자 위치 마커 */
.user-marker {
    background: transparent;
}

.user-location-marker {
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* 맵 팝업 */
.map-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.map-popup .leaflet-popup-content {
    margin: 0;
    width: 280px !important;
}

.map-popup .leaflet-popup-tip {
    background: white;
}

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

.popup-image {
    position: relative;
    height: 140px;
    overflow: hidden;
}

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

.popup-partner-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.popup-info {
    padding: 12px;
}

.popup-title {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #666;
    margin-right: 12px;
}

.popup-rating .star {
    color: #FFD700;
}

.popup-price {
    display: inline-block;
    font-size: 13px;
    color: #f97316;
    font-weight: 600;
}

.popup-distance {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #3b82f6;
}

.popup-distance i {
    margin-right: 4px;
}

.popup-actions {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px;
}

.popup-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
}

.popup-btn-detail {
    background: #f97316;
    color: white;
}

.popup-btn-detail:hover {
    background: #ea580c;
}

.popup-btn-navi {
    background: #3b82f6;
    color: white;
}

.popup-btn-navi:hover {
    background: #2563eb;
}

/* 뷰 전환 버튼 */
.view-toggle {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: #666;
    background: transparent;
}

.view-toggle-btn:hover {
    background: #e5e7eb;
    color: #333;
}

.view-toggle-btn.active {
    background: white;
    color: #f97316;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-toggle-btn i,
.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* 맵 헤더 (필터 + 뷰 전환) */
.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 12px;
}

.map-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.map-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 맵 필터 패널 */
.map-filter-panel {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.map-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-filter-item label {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

.map-filter-item select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
}

.map-filter-item select:focus {
    outline: none;
    border-color: #f97316;
}

/* 맵 결과 카운트 */
.map-result-count {
    font-size: 14px;
    color: #666;
}

.map-result-count strong {
    color: #f97316;
    font-weight: 700;
}

/* 내 위치 버튼 */
.map-my-location-btn {
    position: absolute;
    bottom: 100px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.2s;
}

.map-my-location-btn:hover {
    background: #f3f4f6;
}

.map-my-location-btn svg {
    width: 20px;
    height: 20px;
    color: #3b82f6;
}

/* 모바일 최적화 */
@media (max-width: 768px) {
    .map-container {
        min-height: 300px;
    }

    .map-header {
        flex-direction: column;
        align-items: stretch;
    }

    .map-header-left,
    .map-header-right {
        justify-content: center;
    }

    .view-toggle {
        width: 100%;
    }

    .view-toggle-btn {
        flex: 1;
        justify-content: center;
    }

    .map-filter-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .map-filter-item {
        width: 100%;
    }

    .map-filter-item select {
        flex: 1;
    }

    .map-popup .leaflet-popup-content {
        width: 260px !important;
    }

    .popup-image {
        height: 120px;
    }
}

/* 다크 모드 지원 (선택적) */
@media (prefers-color-scheme: dark) {
    .map-loading {
        background: rgba(30, 30, 30, 0.9);
    }

    .map-loading-text {
        color: #ccc;
    }
}
