/* ================================
  MDC Mission Maps - Theme Integration
=================================== */

#mdc-mission-maps-container {
    display: flex;
    flex-wrap: wrap;
    font-family: 'Lato', sans-serif;
    background-color: #fff;
    width: 100%;
}

.map-controls {
    width: 100%;
    margin-bottom: 20px;
    border-bottom: 1px solid #e1e1e1;
    padding-bottom: 15px;
    display: flex;
    align-items: center;
}

.map-controls button {
    padding: 8px 16px;
    border: 1px solid #e1e1e1;
    background-color: #f8f8f8;
    color: #555;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-right: 6px;
    border-radius: 3px;
    transition: all 0.2s ease-in-out;
}

.map-controls button:hover {
    background-color: #fff;
    border-color: #ccc;
}

.map-controls button.active {
    background-color: #b0004a;
    border-color: #b0004a;
    color: white;
}

.zoom-controls {
    margin-left: auto;
}

.zoom-controls button {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
}

.map-area {
    width: 100%;
    height: 800px;
    transition: width 0.5s ease-in-out;
    text-align: center;
    background-color: #f8f8f8;
    border: 1px solid #e1e1e1;
    border-radius: 3px;
}

.map-container {
    display: none;
    height: 800px;
}

.map-container.active {
    display: block;
    height: 800px;
}

.map-container svg {
    width: 100% !important;
    height: 800px !important;
    max-height: 800px;
    will-change: transform;
}

/* Default state for map paths */
.map-container svg path,
.map-container svg polyline,
.map-container svg polygon {
    fill: #e9e9e9;
    stroke: #fff;
    stroke-width: 0.8;
}

/* Highlight class for regions with missions */
.map-container svg .highlight {
    fill: #b0004a;
    cursor: pointer;
    transition: fill 0.2s ease-in-out;
}
.map-container svg .highlight:hover {
    fill: #90003d;
}

/* ================================
   World Map (GROUP <g>) Hover & Selection
   - 그룹 단위 호버/선택
   - 그룹 선택 후 해당 그룹 안에서 나라 선택
=================================== */

/* 그룹(권역) 단위 transition */
#mdc-world-map-container svg g {
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, filter 0.3s ease-in-out;
    transform-origin: center;
    filter: drop-shadow(0 0 0 rgba(0,0,0,0));
}

/* 그룹 호버 효과 (국내 지도와 유사) */
#mdc-world-map-container svg g.world-group-hover-effect {
    transform: translateY(-8px) scale(1.02);
    opacity: 1;
    filter: drop-shadow(0 8px 6px rgba(0,0,0,0.3)) drop-shadow(0 3px 3px rgba(0,0,0,0.15));
    z-index: 10;
}

/* 그룹 호버 시, 해당 그룹의 기본 지역색을 살짝 밝게 */
#mdc-world-map-container svg g.world-group-hover-effect path,
#mdc-world-map-container svg g.world-group-hover-effect polygon {
    fill: #c8c8c8;
    stroke: #fff;
    stroke-width: 0.8;
}

/* highlight된 나라는 hover 시에도 강조색 유지 */
#mdc-world-map-container svg g.world-group-hover-effect .highlight {
    fill: #d4005e;
}

/* 그룹 dim 모드: 호버된 그룹 제외하고 흐리게 */
#mdc-world-map-container svg.world-group-dimmed-mode g:not(.world-group-hover-effect) {
    opacity: 0.3;
}

/* 그룹 선택 상태: 선택 그룹만 선명, 나머지는 비활성 */
#mdc-world-map-container svg.world-group-selected g {
    opacity: 0.25;
    pointer-events: none;
}
#mdc-world-map-container svg.world-group-selected g.active-world-group {
    opacity: 1;
    pointer-events: auto;
}

/* ✅ 선택된 나라(그룹 내부) - 흰색 테두리 제거 */
#mdc-world-map-container svg .highlight.active-region {
    fill: #d4005e;
    /* stroke / stroke-width 제거 */
    filter: drop-shadow(0 0 6px rgba(212,0,94,0.5));
}

/* 나라 선택 시 같은 그룹의 다른 하이라이트 나라들은 옅게 */
#mdc-world-map-container svg.country-selected .highlight {
    fill: #e0a0b8;
}

/* 선택된 나라는 강조색 유지 */
#mdc-world-map-container svg.country-selected .highlight.active-region {
    fill: #d4005e;
}

/* 나라 선택 상태에서 비-하이라이트 지역 흐리게 */
#mdc-world-map-container svg.country-selected path:not(.highlight),
#mdc-world-map-container svg.country-selected polygon:not(.highlight) {
    opacity: 0.4;
}

.info-area {
    width: 0;
    overflow: hidden;
    transition: width 0.5s ease-in-out;
    background-color: #fff;
}

.info-panel {
    padding: 0 25px;
    height: 800px; /* Should match map max-height */
    overflow-y: auto;
}

/* State when a region is selected */
.map-area.toggled {
    width: 65%;
}
.info-area.toggled {
    width: 35%;
}

.info-panel .initial-message {
    color: #888;
    font-size: 16px;
    text-align: center;
    margin-top: 60px;
}

.info-panel .mission-item:last-child {
    border-bottom: none;
}

.info-panel .mission-item img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 15px;
}

.info-panel .mission-item h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.info-panel .mission-item p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #666;
}

#korea-map-container,
#world-map-container {
    overflow: hidden;
    cursor: grab;
    height: 900px;
}

#korea-map-container svg,
#world-map-container svg {
    transform-origin: center;
    width: 100% !important;
    height: 900px !important;
}

#mdc-korea-map-container svg > g > g {
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, filter 0.3s ease-in-out;
    filter: drop-shadow(0 0 0 rgba(0,0,0,0));
}

#mdc-korea-map-container svg.province-selected > g > g {
    opacity: 0.3;
}

#mdc-korea-map-container svg.province-selected > g > g.active-province {
    opacity: 1;
}

#mdc-korea-map-container svg > g > g.province-hover-effect {
    transform: translateY(-8px) scale(1.02);
    opacity: 1;
    filter: drop-shadow(0 8px 6px rgba(0,0,0,0.3)) drop-shadow(0 3px 3px rgba(0,0,0,0.15));
    z-index: 10;
}

/* Hover 상태의 path 색상을 약간 밝게 */
#mdc-korea-map-container svg > g > g.province-hover-effect path,
#mdc-korea-map-container svg > g > g.province-hover-effect polygon {
    fill: #c8c8c8;
    stroke: #fff;
    stroke-width: 0.8;
}

/* highlight된 지역은 hover 시에도 고유 색상 유지 */
#mdc-korea-map-container svg > g > g.province-hover-effect .highlight {
    fill: #d4005e;
}

#mdc-korea-map-container svg > g > g.dimmed {
    opacity: 0.3;
}

/* Animation container */
.info-panel .province-mission-list {
    opacity: 1;
}

/* mission-item: 페이드아웃 + 축소 애니메이션 지원 */
.info-panel .mission-item {
    border-bottom: 1px solid #e1e1e1;
    padding: 20px 0;
    max-height: 500px;
    overflow: hidden;
    transition: opacity 0.3s ease-out, max-height 0.4s ease-out 0.1s, padding 0.4s ease-out 0.1s, border-color 0.3s ease-out;
}

/* 선택되지 않은 항목 페이드아웃 + 축소 */
.info-panel .mission-item.mission-item-fading {
    opacity: 0;
    max-height: 0;
    padding: 0;
    border-color: transparent;
}

/* 선택된 항목 강조 */
.info-panel .mission-item.mission-item-selected {
    border-bottom: 1px solid #e1e1e1;
}

/* 헤더 페이드아웃 */
.info-panel .province-mission-list > h2 {
    transition: opacity 0.3s ease-out;
}
.info-panel .province-mission-list > h2.header-fading {
    opacity: 0;
}

/* 새로 등장하는 요소 페이드 인 */
.info-panel .back-to-province,
.info-panel .region-detail-title {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}
.info-panel .back-to-province.fade-in-element,
.info-panel .region-detail-title.fade-in-element {
    opacity: 1;
}

/* Region detail title */
.info-panel .region-detail-title {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

/* Back to province button */
.info-panel .back-to-province {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    margin-bottom: 15px;
    background: none;
    border: 1px solid #e1e1e1;
    border-radius: 3px;
    color: #b0004a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.info-panel .back-to-province.fade-in-element:hover {
    background-color: #f8f8f8;
    border-color: #b0004a;
}

/* ================================
   Mission Detail View
=================================== */
.info-panel .mission-detail {
    padding: 20px 0;
    border-bottom: 1px solid #e1e1e1;
}
.info-panel .mission-detail:last-child {
    border-bottom: none;
}
.info-panel .mission-detail h3 {
    margin: 15px 0 6px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}
.info-panel .mission-detail .mission-region-name {
    color: #999;
    font-size: 13px;
    margin: 0 0 4px;
}
.info-panel .mission-detail .mission-pastor {
    font-size: 14px;
    color: #666;
    margin: 0 0 15px;
}
.info-panel .mission-description,
.info-panel .mission-prayer {
    margin-top: 15px;
}
.info-panel .mission-description h4,
.info-panel .mission-prayer h4 {
    font-size: 15px;
    font-weight: 600;
    color: #b0004a;
    margin: 0 0 8px;
}
.info-panel .mission-description p,
.info-panel .mission-prayer p {
    font-size: 14px;
    line-height: 1.7;
    color: #555;
    margin: 0;
}

/* ================================
   Image Slider
=================================== */
.mission-slider {
    position: relative;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
}
.slider-track {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
}
.slider-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}
.slider-slide.active {
    opacity: 1;
}
.slider-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    display: block;
}
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 2;
}
.slider-btn:hover {
    background: rgba(0,0,0,0.7);
}
.slider-prev { left: 8px; }
.slider-next { right: 8px; }
.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}
.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.2s;
}
.slider-dot.active {
    background: #fff;
}

/* ================================
   Lightbox
=================================== */
.mdc-lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mdc-lightbox.active {
    opacity: 1;
}
.mdc-lightbox-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}
.mdc-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}
.mdc-lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}
.mdc-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    background: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.mdc-lightbox-close:hover {
    background: #eee;
}

