* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Malgun Gothic', -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* 모바일 브라우저 주소창 고려 */
    overflow: hidden;
}

/* ===== 헤더 ===== */
.header {
    background: #fee500;
    flex-shrink: 0;
}
.header-top {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    gap: 12px;
    flex-wrap: wrap;
}
.header h1 {
    color: #3c1e1e;
    font-size: 20px;
    white-space: nowrap;
}
.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-wrap: wrap;
}
.select-box {
    padding: 6px 10px;
    font-size: 12px;
    border: 2px solid #3c1e1e;
    border-radius: 4px;
    background: #fff;
    color: #3c1e1e;
    font-weight: bold;
    cursor: pointer;
}
.select-box:focus { outline: none; border-color: #5a3030; }
.select-label {
    font-size: 11px;
    color: #3c1e1e;
    font-weight: bold;
}
.select-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== 탭 ===== */
.header-tabs {
    display: flex;
    border-top: 1px solid rgba(60,30,30,0.15);
}
.tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: bold;
    color: #3c1e1e;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}
.tab-btn:hover { background: rgba(255,255,255,0.3); }
.tab-btn.active {
    background: rgba(255,255,255,0.5);
    border-bottom-color: #3c1e1e;
}

/* ===== 탭 패널 ===== */
.tab-panels {
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #ddd;
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* 콘텐츠 탭 패널 */
.panel-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 15px;
    flex-wrap: wrap;
}
.current-category {
    font-size: 13px;
    color: #3c1e1e;
    background: rgba(254,229,0,0.3);
    padding: 6px 12px;
    border-radius: 4px;
}

/* ===== 드롭다운 메뉴 ===== */
.dropdown { position: relative; }
.dropdown-btn {
    background: #3c1e1e;
    color: #fee500;
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
}
.dropdown-btn:hover { background: #5a3030; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 150px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    z-index: 1000;
}
.dropdown:hover .dropdown-menu { display: block; }
.menu-item { position: relative; }
.menu-item > a {
    display: block;
    padding: 10px 14px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}
.menu-item > a:hover { background: #fee500; color: #3c1e1e; }
/* BTS 부산 공연 특별 메뉴 (공연 종료 후 삭제) */
.event-menu > a { background: linear-gradient(135deg, #9b59b6, #6c3483); color: #fff !important; font-weight: 700; }
.event-menu > a:hover { background: linear-gradient(135deg, #8e44ad, #5b2c6f); color: #fee500 !important; }
.menu-item:last-child > a { border-bottom: none; }
.submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: #fff;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
}
.menu-item:hover .submenu { display: block; }
.submenu a {
    display: block;
    padding: 9px 14px;
    color: #333;
    text-decoration: none;
    font-size: 12px;
    border-bottom: 1px solid #eee;
}
.submenu a:hover { background: #fee500; color: #3c1e1e; }
.submenu a:last-child { border-bottom: none; }
.has-submenu > a::after {
    content: '\25B6';
    float: right;
    font-size: 10px;
    color: #999;
}

/* ===== 필터 바 (맛집찾기) ===== */
.filter-bar {
    padding: 8px 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
    min-width: 60px;
    flex-shrink: 0;
}
.filter-chips {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip {
    padding: 5px 12px;
    font-size: 12px;
    border: 1.5px solid #ccc;
    border-radius: 16px;
    background: #fff;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s;
}
.chip:hover { border-color: #3c1e1e; color: #3c1e1e; }
.chip.active {
    background: #3c1e1e;
    color: #fee500;
    border-color: #3c1e1e;
}
.cert-info {
    padding: 4px 15px 2px;
    animation: certFadeIn 0.2s ease;
}
.cert-info-text {
    display: inline-block;
    font-size: 11px;
    color: #555;
    background: #f0f7ff;
    border-left: 3px solid #4A90D9;
    padding: 5px 10px;
    border-radius: 0 4px 4px 0;
    line-height: 1.4;
}
@keyframes certFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.filter-result {
    padding: 4px 15px 8px;
    font-size: 12px;
    color: #888;
}

/* 즐겨찾기 칩 */
.favorites-chips {
    display: flex;
    gap: 8px;
    padding: 2px 0;
    flex-wrap: wrap;
}

/* ===== 지도 콘텐츠 영역 ===== */
.content {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}
#map {
    flex: 1;
    height: 100%;
}

/* ===== 사이드바 ===== */
#sidebar {
    width: 0;
    height: 100%;
    background: #fff;
    border-left: 1px solid #ddd;
    overflow: hidden;
    overflow-y: auto;
    transition: width 0.3s ease;
}
#sidebar.open { width: 350px; }
.sidebar-content {
    padding: 20px;
    width: 350px;
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #fee500;
}
.sidebar-header h2 { color: #3c1e1e; font-size: 18px; }
.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 4px;
}
.close-btn:hover { color: #333; }

/* 사진 / 미니맵 */
.info-photo-wrap {
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}
.info-photo-wrap img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}
.info-photo-wrap #info-minimap {
    width: 100%;
    height: 180px;
}

.info-item { margin-bottom: 14px; }
.info-label { font-size: 11px; color: #888; margin-bottom: 4px; }
.info-value { font-size: 14px; color: #333; }
.info-value a { color: #3c1e1e; text-decoration: underline; }
.info-value a:hover { color: #fee500; }

/* ===== 현재 위치 버튼 ===== */
.location-btn {
    position: absolute;
    bottom: 30px;
    left: 20px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #3c1e1e;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: all 0.2s ease;
}
.location-btn:hover { background: #fee500; transform: scale(1.1); }
.location-btn:active { transform: scale(0.95); }
.location-btn svg { width: 22px; height: 22px; fill: #3c1e1e; }
.location-btn.loading svg { animation: pulse 1s infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== 지하철 정보 ===== */
#info-subway-section .info-value {
    background: #f8f9ff;
    border-radius: 8px;
    padding: 8px 10px;
    border: 1px solid #e8ecf4;
}

/* ===== 길찾기 버튼 ===== */
.direction-btn {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    min-width: 70px;
    transition: opacity 0.2s;
}
.direction-btn:hover { opacity: 0.85; }

/* ===== 제안 버튼 ===== */
.suggest-btn {
    background: #0088cc;
    color: #fff;
    border: none;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.suggest-btn:hover { background: #006daa; }
.suggest-btn svg { width: 14px; height: 14px; fill: #fff; }

/* ===== 제안 모달 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 360px;
    max-width: 90vw;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.modal-box h3 { color: #3c1e1e; margin-bottom: 12px; font-size: 16px; }
.modal-box textarea {
    width: 100%;
    height: 120px;
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}
.modal-box textarea:focus { outline: none; border-color: #0088cc; }
.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}
.modal-actions button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: none;
}
.modal-send { background: #0088cc; color: #fff; }
.modal-send:hover { background: #006daa; }
.modal-send:disabled { background: #ccc; cursor: not-allowed; }
.modal-cancel { background: #eee; color: #333; }
.modal-cancel:hover { background: #ddd; }

/* ===== 로딩 오버레이 ===== */
.loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    color: #3c1e1e;
    z-index: 999;
}

/* ========================================
   모바일 반응형 (768px 이하)
   ======================================== */
@media (max-width: 768px) {
    /* 헤더 */
    .header-top {
        padding: 6px 10px;
        gap: 8px;
    }
    .header h1 { font-size: 16px; }
    .header-controls {
        gap: 6px;
    }
    .select-group { gap: 2px; }
    .select-label { font-size: 10px; }
    .select-box { padding: 4px 6px; font-size: 11px; }
    .suggest-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
    .suggest-btn span { display: none; }
    .suggest-btn svg { width: 16px; height: 16px; }

    /* 탭 */
    .tab-btn {
        padding: 8px 10px;
        font-size: 13px;
    }

    /* 패널 */
    .panel-inner {
        padding: 6px 10px;
        gap: 8px;
    }
    .dropdown-btn { padding: 6px 12px; font-size: 12px; }
    .current-category { font-size: 12px; padding: 5px 10px; }

    /* 필터 바 */
    .filter-bar { padding: 6px 10px; gap: 5px; }
    .filter-label { font-size: 11px; min-width: 50px; }
    .chip { padding: 4px 10px; font-size: 11px; }
    .cert-info { padding: 2px 10px 0; }
    .cert-info-text { font-size: 10px; padding: 4px 8px; }

    /* 드롭다운: 모바일에서 서브메뉴 아래로 */
    .submenu {
        position: static;
        box-shadow: none;
        border-left: 3px solid #fee500;
        margin-left: 10px;
    }

    /* 지도 + 사이드바 */
    .content {
        flex-direction: column;
    }
    #map {
        flex: 1;
        width: 100%;
    }

    /* 사이드바: 아래에서 올라오는 바텀시트 */
    #sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        height: 0;
        max-height: 60vh;
        border-left: none;
        border-top: 2px solid #fee500;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        transition: height 0.3s ease;
        z-index: 500;
    }
    #sidebar.open {
        height: 60vh;
    }
    .sidebar-content {
        width: 100%;
        padding: 16px;
    }
    .sidebar-header h2 { font-size: 16px; }

    /* 현재 위치 버튼: 모바일에서 fixed로 변경 (100vh 주소창 이슈 방지) */
    .location-btn {
        position: fixed;
        bottom: 24px;
        left: 12px;
        width: 42px;
        height: 42px;
        z-index: 400;
    }
    .location-btn svg { width: 20px; height: 20px; }

    /* 길찾기 버튼 */
    .direction-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 60px;
    }
}

/* ===== 초소형 모바일 (480px 이하) ===== */
@media (max-width: 480px) {
    .header-top {
        flex-wrap: wrap;
        justify-content: space-between;
    }
    .header h1 { font-size: 15px; }
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    .tab-btn { font-size: 12px; padding: 7px 6px; }
    .filter-label { min-width: 40px; font-size: 10px; }
    .chip { padding: 3px 8px; font-size: 10px; }
    .filter-result { font-size: 11px; }

    #sidebar.open { height: 55vh; }
    .sidebar-content { padding: 12px; }
    .sidebar-header h2 { font-size: 15px; }
    .info-label { font-size: 10px; }
    .info-value { font-size: 13px; }
}
