/* ═══════════════════════════════════════════════════
   [gis-map.css]
   사이드바 우측 영역 전용 (v503)
═══════════════════════════════════════════════════ */

/* ════════ [v504] GIS 전용 레이아웃 최적화 ════════ */

.main-content {
    padding: 0 !important;
    padding-top: 0 !important;
    /* 전역 패딩 강제 제거 */
    margin: 0 0 0 200px !important;
    /* 사이드바 공간 확보 */
    height: 100vh !important;
    overflow: auto !important;
    background: transparent !important;
    /* [v700] 테마 파티클 노출을 위해 투명화 */
}

/* ── [v650] 모바일 대응: 사이드바 공간 제거 및 전체화면 ── */
@media (max-width: 768px) {
    .main-content {
        margin: 0 !important;
        width: 100% !important;
    }

    /* 모바일에서 지도를 가리는 불필요한 요소 제거 */
    #particles-js,
    .canvas-background {
        display: none !important;
    }
}

.gis-viewer-container {
    position: relative;
    width: 100%;
    height: 100vh;
    background: transparent;
    /* [v700] 배경 파티클 유지 */
}

/* 페이지 래퍼 - 사이드바와 헤더(약 80px)를 뺀 나머지 공간 100% 사용 */
.map-page-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    /* 가용 공간 모두 채우기 */
    height: 100vh !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
    /* [v700] 배경 파티클 유지 */
}

/* 상단 정보 및 필터 바 (v505) */
.map-top-bar {
    position: absolute;
    top: 10px;
    /* 30px -> 40px로 하향 조정 (약 1cm 이상 하강) */
    left: 20px;
    right: 20px;
    width: auto !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 0 36px; /* [v1004] 왼쪽 패딩 20px 추가 */
    height: 49px;
    min-height: 49px;
    /* 35px -> 49px (User 요청: 1.3cm 반영) */
    background: rgba(10, 10, 10, 0.7) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    /* 다시 둥글게 복구 */
    z-index: 1000;
    pointer-events: auto;
    box-sizing: border-box !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    /* 그림자 강화 */
}

@media (max-width: 768px) {
    .map-top-bar {
        top: 10px;
        left: 10px;
        right: 10px;
        padding: 6px 10px !important;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        background: rgba(10, 10, 10, 0.88) !important;
    }

    .map-title-group {
        margin-right: 0;
    }

    /* 데스크탑 탭 필터 완전 숨김 */
    .map-filters {
        display: none !important;
    }

    .map-stats-panel {
        display: none !important;
    }
}

.map-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 15px;
    height: 100%;
}

.map-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 150px;
    height: 100%;
    /* 카테고리 메뉴를 기준 x축 기준 왼쪽으로 약 4cm 이동 */
    transition: margin 0.3s ease;
}



.map-main-title {
    font-size: 1rem !important;
    /* 1.1rem -> 1rem로 축소 */
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    color: #fff;
    margin: 0;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.map-sub-title {
    display: none !important;
}

.data-version {
    display: none !important;
}

.status-indicator {
    display: none !important;
}

.view-mode-tabs {
    display: flex;
    gap: 8px;
    /* 12px -> 8px로 축소 */
    align-items: center;
}

.view-tab {
    position: relative;
}

.view-tab::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: #ff5252;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(255, 82, 82, 0.6);
}

.view-tab.active::after {
    width: 100%;
}

/* ====== TIMELINE 뷰 오버레이 ====== */
.timeline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 맵과 상단 바 사이 레이어 (상단바는 z-index: 1000) */
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    background: transparent !important;
    /* [v700] 무조건 투명하게 유지 */
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: auto;
    overflow: hidden;
    overscroll-behavior: none;
}

/* [v900] 타임라인 뷰 모드에서 .main-content 스크롤 완전 차단 */
body.timeline-active .main-content,
html.timeline-active .main-content {
    overflow: hidden !important;
    overflow-y: hidden !important;
}

.timeline-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 타임라인 패닝 컨테이너 */

.timeline-track-container {
    width: 100%;
    height: 100%;
    padding-top: 100px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    overflow-x: auto;
}

/* ── 타임라인 UI 전용 스타일 ── */
.timeline-ui-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.timeline-controls {
    display: none !important;
    /* [v700] 모달로 이관하여 메인 뷰에서 제거 */
}

.timeline-controls input {
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 300px;
    outline: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.timeline-controls button {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    background: var(--accent, #ff4757);
    color: white;
    cursor: pointer;
    font-weight: 800;
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.timeline-controls button:hover {
    background: #ff6b81;
    transform: translateY(-2px);
}

.timeline-canvas-container {
    flex: 1;
    width: 100%;
    height: 100%;
    cursor: grab;
    margin-top: 40px;
}

.timeline-canvas-container:active {
    cursor: grabbing;
}

/* GIS 지도 div */
#gis-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000 !important;
    z-index: 1;
}

/* 타일 다크 필터 제거 (네이티브 다크 테마 사용) */
.leaflet-tile {
    filter: none !important;
}

.leaflet-container {
    background: #000 !important;
    outline: none;
}

#gis-map img {
    max-width: none !important;
}

.leaflet-tile {
    filter: inherit;
}

/* 지도 하단 Attribution 영역 스타일 (다크모드 최적화) */
.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.4) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 10px !important;
    border-radius: 4px;
    padding: 2px 8px !important;
}

.leaflet-control-attribution a {
    color: #fff !important;
    text-decoration: none;
    opacity: 0.8;
}

.leaflet-control-attribution a:hover {
    text-decoration: underline;
    opacity: 1;
}

/* Leaflet 로고 및 기타 아이콘 화이트 필터 */
.leaflet-control-attribution svg,
.leaflet-control-attribution img {
    filter: brightness(0) invert(1) !important;
}




/* 필터 버튼 스타일링 */
.gis-filter-pills {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-pill {
    padding: 3px 10px;
    /* 4px 12px -> 3px 10px로 축소 */
    border-radius: 6px;
    font-size: 0.72rem;
    /* 0.75rem -> 0.72rem로 축소 */
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.filter-pill:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.filter-pill.active {
    background: var(--accent, #4361EE);
    color: #fff;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

/* 테마 마커 (공원, 산책로 등) */
.theme-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-marker-inner {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}

.theme-marker:hover .theme-marker-inner {
    transform: scale(1.5);
}

/* ── [v650] 모바일 대응: 메뉴 겹침 방지 및 상단바 메뉴 연동 ── */
@media (max-width: 768px) {

    /* 기존 모바일 버튼 숨김 (GIS 맵 한정) */
    .mobile-top-bar {
        display: none !important;
    }
}

/* [v1130] CCTV 로딩 오버레이 플레이어 중앙 정렬 */
#cctv-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#cctv-loading-overlay.active {
    display: flex;
}

.cctv-loading-text {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    margin-top: 15px;
}


/* 상단바 내장 모바일 메뉴 버튼 스타일 */
.map-mobile-menu-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    padding: 0;
    margin-right: 8px;
    display: none;
    /* 기본 숨김 - 모바일 미디어쿼리에서 flex로 표시 */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.map-mobile-menu-btn:active {
    opacity: 0.6;
}

/* ═══ 커스텀 카테고리 드롭다운 ═══ */
.custom-dropdown-container {
    display: none;
    /* [PC 환경 기본 숨김] 모바일 미디어쿼리에서 display: block 됨 */
    position: relative;
    flex: 1;
    min-width: 140px;
}

.custom-dropdown-trigger {
    width: 100%;
    background: rgba(30, 30, 30, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 6px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    font-family: 'Rajdhani', sans-serif;
    cursor: pointer;
    outline: none;
    height: 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.custom-dropdown-trigger:active {
    background: rgba(50, 50, 50, 0.9);
}

.custom-dropdown-menu {
    position: absolute;
    top: 42px;
    left: 0;
    width: 100%;
    background: rgba(18, 18, 18, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    overflow: hidden;
    z-index: 9999;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-dropdown-item {
    padding: 10px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-dropdown-item:active,
.custom-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.custom-dropdown-item.active {
    background: var(--accent, #ff4757);
    color: #fff;
}

/* ═══ [v560] 중앙 재생/일시정지 토글 오버레이 ═══ */
.cctv-center-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    z-index: 20;
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

/* 재생 중이 아닐 때 (force-show 됨) 혹은 데스크탑 Hover 시에 보이기 */
.cctv-video-section:hover .cctv-center-play-overlay,
.cctv-center-play-overlay.force-show {
    opacity: 1;
    pointer-events: auto;
}

.cctv-center-play-overlay:hover {
    background: var(--accent, #ff4757);
    border-color: var(--accent, #ff4757);
    transform: translate(-50%, -50%) scale(1.15);
}

/* ═══ 모바일 (768px 이하) 통합 미디어 쿼리 ═══ */
@media (max-width: 768px) {

    /* 모바일 메뉴버튼 표시 */
    .map-mobile-menu-btn {
        display: flex !important;
    }

    /* 데스크탑 탭 버튼들은 완전 숨김 (중복 포함) */
    .map-filters {
        display: none !important;
    }

    .map-filters .filter-pill {
        display: none !important;
    }

    /* 모바일용 드롭다운 메뉴: 바 정중앙 배치 */
    .custom-dropdown-container {
        display: flex !important;
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

    .custom-dropdown-trigger {
        min-width: 150px;
        max-width: 200px;
        justify-content: center;
    }

    /* 모바일에서 stats panel 숨김 (공간 확보) */
    .map-stats-panel {
        display: none !important;
    }

    /* 모달 UI 반응형 대응 */
    #cctv-modal {
        left: 50% !important;
        width: 96vw !important;
        max-width: 96vw !important;
    }

    .cctv-modal-body {
        flex-direction: column !important;
        height: auto !important;
        max-height: 85vh;
        overflow-y: auto;
    }

    .cctv-ai-panel {
        min-width: unset !important;
        width: 100% !important;
        max-height: 220px;
    }


    /* 모바일에서는 랜드마크 팝업 크기를 원래대로 작게 되돌림 */
    .landmark-popup {
        min-width: 180px;
    }

    .landmark-popup img {
        max-width: 200px;
        height: 120px;
    }

    .landmark-popup .lm-title {
        font-size: 0.95rem;
    }
}

/* ═══ [v600] 전역 로딩 오버레이 Z-index 우선권 확보 (상단 메뉴 위 덮기) ═══ */
#global-loader {
    z-index: 99999 !important;
}

/* ── CCTV 상태 인디케이터 ── */
.cctv-status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: text-bottom;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.cctv-status-loading {
    background-color: #f39c12;
    box-shadow: 0 0 8px #f39c12;
}

.cctv-status-playing {
    background-color: #2ecc71;
    box-shadow: 0 0 8px #2ecc71;
}

.cctv-status-error {
    background-color: #e74c3c;
    box-shadow: 0 0 8px #e74c3c;
}

.cctv-status-fatal {
    background-color: #e74c3c;
    animation: blink-cctv-red 1.2s infinite;
}

@keyframes blink-cctv-red {
    0% {
        opacity: 1;
        box-shadow: 0 0 12px #e74c3c;
    }

    50% {
        opacity: 0.3;
        box-shadow: 0 0 2px #e74c3c;
    }

    100% {
        opacity: 1;
        box-shadow: 0 0 12px #e74c3c;
    }
}

/* ═══ [v700] Timeline Search Modal & Scale Badge ═══ */
.timeline-scale-badge {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: var(--accent, #ff4757);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-search-icon-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 15px;
    transition: all 0.2s;
    opacity: 0.7;
}

.timeline-search-icon-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    color: var(--accent, #ff4757);
}

#timeline-search-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    /* 다른 모달보다 위에 */
    background: var(--bg-modal, rgba(20, 20, 20, 0.95));
    backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    width: 90%;
    max-width: 450px;
}

#timeline-search-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border: none;
    padding: 0;
}

#timeline-search-modal h3 {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--accent, #ff4757);
}

.search-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.timeline-search-input-group {
    display: flex;
    gap: 10px;
}

.timeline-search-input-group input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 18px;
    border-radius: 10px;
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    outline: none;
}

.timeline-search-input-group button {
    background: var(--accent, #ff4757);
    color: #fff;
    border: none;
    padding: 0 20px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
}

.timeline-search-input-group button:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

/* ═══ [v700] Event Pulse Markers ═══ */
/* Leaflet의 .leaflet-marker-icon과 공존하므로 마진과 패딩을 초기화합니다. */
.pulse-marker-container {
    position: relative;
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block;
    overflow: visible;
    /* 펄스가 밖으로 퍼질 수 있도록 설정 */
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border: 3px solid #f59e0b;
    border-radius: 50%;
    animation: marker-pulse 1.8s ease-out infinite;
    pointer-events: none;
}

.pulse-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
    border: 1px solid #fff;
}

@keyframes marker-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.6);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* ═══ [v2600] ITS Event Pulse (Red) ═══ */
.event-pulse {
    position: relative;
    width: 30px;
    height: 30px;
}

.event-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 3px solid #ff0000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: marker-pulse 1.5s ease-out infinite;
    pointer-events: none;
}

.event-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: #ff0000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    border: 1.5px solid #fff;
}