/* ============================================================
   Project Atlas — atlas.css
   메인 지도 페이지 스타일
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%;
    font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#atlas-wrap {
    --atlas-forest:   #1b3a2a;
    --atlas-moss:     #4a7c59;
    --atlas-amber:    #c87941;
    --atlas-cream:    #f4ede3;
    --atlas-sand:     #e8ddd0;
    --atlas-track:    #d4581f;
    --atlas-gold:     #d4a017;
    --atlas-text:     #1c1c1c;
    --atlas-text-mid: #5a5a5a;

    position: relative;
    width: 100vw;
    height: 100dvh;
    height: 100vh;  /* 폴백 */
    height: 100dvh;
    overflow: hidden;
}

#atlas-main-map { width: 100%; height: 100%; }

/* ─────── 로딩 ─────── */
.atlas-loading {
    position: fixed; inset: 0; background: var(--atlas-forest);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 9999; gap: 14px;
}
.atlas-loading.hidden { display: none; }
.atlas-loading-status { color: rgba(255,255,255,.7); font-size: 13px; }
.atlas-loading-bar-wrap { width: 200px; height: 4px; background: rgba(255,255,255,.15); border-radius: 2px; overflow: hidden; }
.atlas-loading-bar { height: 100%; background: var(--atlas-track); transition: width .3s; width: 0%; }

/* ─────── 헤더 ─────── */
.atlas-header {
    position: absolute; top: 0; left: 0; right: 0; z-index: 600;
    padding: 14px 20px 0;
    height: 64px;
    background: linear-gradient(to bottom, rgba(27,58,42,.85) 0%, rgba(27,58,42,.4) 60%, transparent 100%);
    display: flex; align-items: flex-start; justify-content: space-between;
    pointer-events: none;
}
.atlas-header > * { pointer-events: auto; }
.atlas-brand-block { display: flex; align-items: center; gap: 14px; }
.atlas-logo {
    height: 44px; width: auto; display: block;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}
.atlas-brand-sub {
    color: rgba(255,255,255,.85); font-size: 12px; font-weight: 600;
    letter-spacing: 2px; text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(0,0,0,.6);
    line-height: 1.2; padding-top: 2px;
}

/* ─────── 검색 ─────── */
.atlas-search-wrap { position: relative; display: flex; align-items: center; gap: 8px; }
.atlas-search-toggle {
    width: 38px; height: 38px; border-radius: 50%; border: none;
    background: rgba(255,255,255,.95); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,.2);
    transition: background .2s; font-size: 18px;
}
.atlas-search-toggle:hover { background: #fff; }
.atlas-search-bar {
    display: none;
    background: rgba(255,255,255,.97); border-radius: 22px;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    padding: 5px 8px 5px 14px;
    align-items: center; gap: 6px;
}
.atlas-search-bar.open { display: flex; }
.atlas-search-bar.shake { animation: atlas-shake .5s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes atlas-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(3px); }
    30%, 50%, 70% { transform: translateX(-5px); }
    40%, 60% { transform: translateX(5px); }
}
.atlas-search-input {
    border: none; outline: none; background: transparent;
    font-family: inherit; font-size: 13px; width: 180px;
    color: var(--atlas-text);
}
.atlas-search-clear {
    width: 24px; height: 24px; border: none; border-radius: 50%;
    background: var(--atlas-sand); color: var(--atlas-text-mid);
    cursor: pointer; font-size: 12px; line-height: 1;
}
.atlas-search-clear:hover { background: #d4c8bb; }

.atlas-search-result {
    position: absolute; top: 46px; right: 0;
    background: rgba(255,255,255,.98); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    width: 320px;
    max-height: 360px;
    overflow-y: auto;
    display: none;
    padding: 4px;
}
.atlas-search-result.show { display: block; }
.atlas-search-empty {
    padding: 16px 12px; font-size: 12px; color: var(--atlas-text-mid);
    text-align: center;
}
.atlas-search-summary {
    padding: 8px 12px 6px; font-size: 11px; color: var(--atlas-text-mid);
    border-bottom: 1px solid var(--atlas-sand); margin-bottom: 2px;
}
.atlas-search-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; border-radius: 8px;
    cursor: pointer; transition: background .15s;
    font-size: 12.5px;
}
.atlas-search-item:hover { background: var(--atlas-sand); }
.atlas-search-region-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.atlas-search-region-label {
    font-size: 11px; color: var(--atlas-text-mid); font-weight: 600;
    flex-shrink: 0; min-width: 32px;
}
.atlas-search-course-name {
    flex: 1; color: var(--atlas-text); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.atlas-search-item .atlas-diff { font-size: 10px; padding: 2px 7px; flex-shrink: 0; }
.atlas-search-more {
    padding: 8px 12px; font-size: 11px; color: var(--atlas-text-mid);
    text-align: center; font-style: italic;
}

/* ─────── 필터 칩 (가로 스크롤) ─────── */
.atlas-filter {
    position: absolute; top: 70px; left: 16px; right: 16px;
    z-index: 500;
    display: flex; gap: 6px;
    white-space: nowrap;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.atlas-filter::-webkit-scrollbar { display: none; }
.atlas-chip {
    flex-shrink: 0;
    background: rgba(255,255,255,.95); color: var(--atlas-forest);
    border: none; border-radius: 18px;
    padding: 6px 14px; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all .2s;
    user-select: none; font-family: inherit;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.atlas-chip:hover  { background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.atlas-chip.active { background: var(--atlas-forest); color: #fff; box-shadow: 0 3px 8px rgba(27,58,42,.4); }

/* ─────── 모달 ─────── */
.atlas-modal {
    display: none;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 32px); max-width: 480px;
    max-height: calc(100% - 32px);
    background: var(--atlas-cream); border-radius: 16px;
    box-shadow: 0 20px 55px rgba(0,0,0,.5);
    z-index: 2000; overflow: hidden;
}
.atlas-modal.open { display: flex; flex-direction: column; }

.atlas-mini-wrap { position: relative; flex-shrink: 0; }
#atlas-mini-map { width: 100%; height: 300px; }
.atlas-mini-loading {
    position: absolute; inset: 0; background: var(--atlas-sand);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--atlas-text-mid); z-index: 10;
}

.atlas-region-bar {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 8px 14px;
    background: linear-gradient(transparent, rgba(0,0,0,.65));
    display: flex; justify-content: space-between; align-items: center;
    z-index: 1100;
    pointer-events: none;
}
.atlas-region-bar > * { pointer-events: auto; }
.atlas-region-name { color: #fff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.8); }

/* 미니맵의 Leaflet attribution 작게 */
#atlas-mini-map .leaflet-control-attribution {
    background: rgba(255,255,255,.7); font-size: 9px;
    padding: 1px 5px; line-height: 1.4;
    margin: 0; border-radius: 0 0 0 4px;
}

/* 난이도 뱃지 */
.atlas-diff { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 10px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.atlas-diff-매우쉬움  { background: #c8e6c9; color: #1b5e20; }
.atlas-diff-쉬움      { background: #dcedc8; color: #33691e; }
.atlas-diff-보통      { background: #fff9c4; color: #827717; }
.atlas-diff-약간어려움 { background: #ffe0b2; color: #e65100; }
.atlas-diff-어려움    { background: #ffcdd2; color: #b71c1c; }

.atlas-info { padding: 14px 18px 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.atlas-title { font-size: 17px; font-weight: 700; color: var(--atlas-text); margin: 0 0 10px; line-height: 1.35; }

.atlas-stats {
    display: flex; border: 1.5px solid var(--atlas-sand); border-radius: 10px;
    overflow: hidden; margin-bottom: 4px; background: #fff;
}
.atlas-stat { flex: 1; padding: 9px 6px; text-align: center; }
.atlas-stat + .atlas-stat { border-left: 1.5px solid var(--atlas-sand); }
.atlas-stat-lbl { font-size: 10px; color: var(--atlas-text-mid); margin-bottom: 3px; }
.atlas-stat-val { font-size: 13px; font-weight: 700; color: var(--atlas-forest); }
.atlas-stat-note { font-size: 10px; color: var(--atlas-text-mid); text-align: right; margin: 2px 0 12px; }

/* 이미지 슬라이드 */
.atlas-img-slider {
    position: relative; border-radius: 10px; overflow: hidden;
    margin-bottom: 10px; background: var(--atlas-sand);
    height: 175px;
}
.atlas-img-track { display: flex; height: 100%; transition: transform .4s cubic-bezier(.4, 0, .2, 1); }
.atlas-img-slide { flex: 0 0 100%; height: 100%; background-size: cover; background-position: center; cursor: pointer; }
.atlas-img-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 30px; height: 30px; border-radius: 50%; border: none;
    background: rgba(255,255,255,.85); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: var(--atlas-text);
    box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: background .2s;
    z-index: 5;
}
.atlas-img-arrow:hover { background: #fff; }
.atlas-img-arrow.prev { left: 8px; }
.atlas-img-arrow.next { right: 8px; }
.atlas-img-arrow:disabled { opacity: 0; pointer-events: none; }
.atlas-img-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; z-index: 5; }
.atlas-img-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); transition: all .2s; cursor: pointer; }
.atlas-img-dot.active { background: #fff; width: 16px; border-radius: 3px; }
.atlas-img-counter {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,.55); color: #fff;
    font-size: 10px; padding: 3px 8px; border-radius: 10px; z-index: 5;
}

/* 태그 */
.atlas-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.atlas-tag {
    font-size: 11px; padding: 3px 9px; background: var(--atlas-sand);
    color: var(--atlas-text-mid); border-radius: 9px;
    cursor: pointer; transition: background .15s;
    border: none; font-family: inherit;
}
.atlas-tag:hover { background: #d4c8bb; }

/* 설명 + 더보기 */
.atlas-desc-wrap { position: relative; margin-bottom: 14px; }
.atlas-desc { font-size: 12.5px; color: var(--atlas-text-mid); line-height: 1.6; overflow: hidden; max-height: 60px; transition: max-height .35s ease; }
.atlas-desc.expanded { max-height: 600px; }
.atlas-desc-fade {
    position: absolute; bottom: 24px; left: 0; right: 0; height: 30px;
    background: linear-gradient(transparent, var(--atlas-cream));
    pointer-events: none; display: block;
}
.atlas-desc.expanded + .atlas-desc-fade { display: none; }
.atlas-desc-more {
    display: block; margin-top: 4px;
    font-size: 11.5px; color: var(--atlas-track); font-weight: 600;
    background: none; border: none; cursor: pointer; padding: 2px 0;
    font-family: inherit;
}
.atlas-desc-more:hover { text-decoration: underline; }
.atlas-desc-more.hidden { display: none; }

/* 버튼 */
.atlas-btn-row { display: flex; gap: 8px; }
.atlas-book {
    flex: 1; background: var(--atlas-track); color: #fff; border: none;
    padding: 12px; border-radius: 9px; font-size: 13px; font-weight: 700;
    text-decoration: none; text-align: center; cursor: pointer;
    font-family: inherit; transition: background .2s;
}
.atlas-book:hover { background: #be4c16; }
.atlas-close-btn {
    background: var(--atlas-sand); color: var(--atlas-text-mid); border: none;
    padding: 12px 16px; border-radius: 9px; font-size: 16px;
    cursor: pointer; transition: background .2s; line-height: 1;
}
.atlas-close-btn:hover { background: #d4c8bb; }

/* ─────── 마커 ─────── */
.atlas-pin {
    width: 28px; height: 28px;
    border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    box-shadow: 0 3px 10px rgba(0,0,0,.35);
    border: 2.5px solid rgba(255,255,255,.7);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform .2s;
}
.atlas-pin:hover { transform: rotate(-45deg) scale(1.2); }
.atlas-pin span { transform: rotate(45deg); font-size: 12px; }

.atlas-pin-featured {
    width: 36px; height: 36px;
    border: 3px solid var(--atlas-gold);
    animation: atlas-pulse 2s infinite;
}
.atlas-pin-featured span { font-size: 15px; }
@keyframes atlas-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(212, 160, 23, 0.6); }
    70%  { box-shadow: 0 0 0 12px rgba(212, 160, 23, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 160, 23, 0); }
}

.atlas-pin-label {
    background: rgba(255,255,255,.95) !important;
    border: none !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.2) !important;
    color: #1b3a2a !important;
    font-family: 'Noto Sans KR', sans-serif !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 3px 8px !important;
    white-space: nowrap !important;
    letter-spacing: -0.2px !important;
}
.atlas-pin-label::before { display: none !important; }
.atlas-pin-label.featured {
    background: var(--atlas-gold) !important;
    color: #fff !important;
    font-weight: 700 !important;
}

/* 시작/끝/원점회귀 마커 */
.atlas-se-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px 4px 8px; border-radius: 14px;
    font-size: 11px; font-weight: 700; color: #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,.35);
    white-space: nowrap;
    border: 2px solid #fff;
    position: relative;
}
.atlas-se-pill-icon { font-size: 13px; line-height: 1; }
.atlas-se-start { background: #2e7d32; }
.atlas-se-end   { background: #c62828; }
.atlas-se-loop  { background: linear-gradient(135deg, #2e7d32, #c87941); }

.atlas-se-anchor-top    { transform: translate(-50%, -100%) translateY(-6px); }
.atlas-se-anchor-bottom { transform: translate(-50%, 0) translateY(6px); }
.atlas-se-anchor-left   { transform: translate(-100%, -50%) translateX(-6px); }
.atlas-se-anchor-right  { transform: translate(0, -50%) translateX(6px); }

/* 클러스터 */
.marker-cluster-small  div { background: rgba(46,125,50,.9);  color:#fff; }
.marker-cluster-medium div { background: rgba(200,121,65,.9); color:#fff; }
.marker-cluster-large  div { background: rgba(180,60,30,.9);  color:#fff; }
.marker-cluster-small  { background: rgba(46,125,50,.3); }
.marker-cluster-medium { background: rgba(200,121,65,.3); }
.marker-cluster-large  { background: rgba(180,60,30,.3); }

/* 베이스맵 컨트롤 */
.leaflet-control-layers {
    background: rgba(255,255,255,.95);
    border: none; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.2);
    font-family: 'Noto Sans KR', sans-serif; font-size: 12px;
}
.leaflet-control-layers-toggle { width: 36px; height: 36px; background-size: 20px 20px; }
.leaflet-control-layers-expanded { padding: 10px 14px; }
.leaflet-control-layers label { margin: 4px 0; cursor: pointer; }
.leaflet-control-layers input[type="radio"] { margin-right: 6px; }

/* ─────── 모바일 ─────── */
@media (max-width: 600px) {
    .atlas-brand-sub { display: none; }
    .atlas-search-input { width: 140px; }
    .atlas-search-result { width: calc(100vw - 32px); max-width: 320px; max-height: 50vh; }
    .atlas-search-course-name { font-size: 12px; }
    .atlas-filter { top: 66px; }
    #atlas-mini-map { height: 240px; }
}
