/* ========================================
   모바일 하단 메뉴 리뉴얼
   adminmode=1 전용, 기존 gnb-tab 대체
   ======================================== */

/* 기존 gnb-tab 제거됨 (백업: v3/inc_gnb_tab_backup.php) */
.gnb-tab-wrap {
    display: none !important;
}

#wrap {
    padding-bottom: 60px !important;
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #wrap {
        padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
    }
}

/* 데스크탑에서 새 메뉴 숨김 */
@media (min-width: 769px) {
    .btm-nav,
    .btm-panel,
    .btm-overlay {
        display: none !important;
    }
    #wrap {
        padding-bottom: 0 !important;
    }
}

/* --- Overlay --- */
.btm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.btm-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Bottom Navigation Bar --- */
.btm-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    height: 60px;
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
    box-shadow: 0 -1px 12px rgba(0, 0, 0, 0.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@supports (height: env(safe-area-inset-bottom)) {
    .btm-nav {
        height: calc(60px + env(safe-area-inset-bottom));
    }
}

.btm-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    max-width: 480px;
    margin: 0 auto;
}

.btm-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 0;
    min-width: 56px;
    color: #4b5563;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.01em;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    outline: none;
}

.btm-tab.active {
    font-weight: 700;
}

.btm-tab.panel-open {
    font-weight: 700;
}

/* 아이콘 토글: outline ↔ filled */
.btm-tab .btm-icon-filled { display: none; }
.btm-tab.active .btm-icon-filled,
.btm-tab.panel-open .btm-icon-filled { display: block; }
.btm-tab.active .btm-icon-outline,
.btm-tab.panel-open .btm-icon-outline { display: none; }

/* 패널 열림 시 현재 페이지 active 아이콘을 outline으로 되돌림 */
.btm-nav.panel-active .btm-tab.active:not(.panel-open) .btm-icon-filled { display: none; }
.btm-nav.panel-active .btm-tab.active:not(.panel-open) .btm-icon-outline { display: block; }


.btm-tab:active {
    transform: scale(0.92);
    transition: transform 0.1s;
}

/* --- Slide-up Panel --- */
.btm-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 60px;
    z-index: 3000;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    max-height: calc(100vh - 116px);
    overscroll-behavior-y: contain;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@supports (bottom: env(safe-area-inset-bottom)) {
    .btm-panel {
        bottom: calc(60px + env(safe-area-inset-bottom));
        max-height: calc(100svh - 116px);
    }
}

.btm-panel.active {
    transform: translateY(0);
}

/* 포인트 메뉴 패널만 높이 축소 */
.btm-panel.btm-panel--point {
    max-height: calc(100vh - 200px);
}
@supports (bottom: env(safe-area-inset-bottom)) {
    .btm-panel.btm-panel--point {
        max-height: calc(100svh - 200px);
    }
}

/* 상단바: 아래로 드래그 시 닫기, 터치 스크롤 방지 */
.btm-panel-handle {
    touch-action: none;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* 포인트 패널: 전체 내용 스크롤 */
#panelPoint.btm-panel-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
#panelPoint.btm-panel-section > div {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* --- Submenu Grid Items --- */
.btm-submenu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 4px 10px;
    border-radius: 14px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btm-submenu-item:active {
    background-color: #f5f5f5;
}

.btm-icon-wrap {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
    background-color: #f3f4f6 !important;
}

.btm-submenu-item:active .btm-icon-wrap {
    transform: scale(0.93);
}

/* --- 포인트 패널 --- */
.btm-point-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0 6px;
}

.btm-point-total-center {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.btm-point-coin-icon-lg {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.4);
}

.btm-point-val-lg {
    font-size: 22px;
    font-weight: 800;
    color: #1f2937;
    letter-spacing: -0.02em;
}

.btm-point-quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 10px 0 12px;
    border-bottom: 1px solid #f3f4f6;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.btm-pq-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6 !important;
}

.btm-point-quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    color: #374151;
    font-size: 12px;
    font-weight: 500;
}

.btm-point-quick-item:active > div {
    opacity: 0.7;
}

.btm-point-scroll {
    padding-top: 2px;
}

/* --- 스크롤바 공통 스타일 --- */
#panelPoint.btm-panel-section > div,
#panelMore .overflow-y-auto {
    scrollbar-width: none;
}
#panelMore .overflow-y-auto {
    overscroll-behavior-y: contain;
}

#panelPoint.btm-panel-section > div::-webkit-scrollbar,
#panelMore .overflow-y-auto::-webkit-scrollbar {
    display: none;
}

.btm-point-section {
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.btm-point-section--last {
    margin-bottom: 0;
}

.btm-section-hd {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 10px 0 4px;
}

.btm-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
}

.btm-section-sub {
    display: none;
}

.btm-point-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 7px 5px;
    border-radius: 10px;
    text-decoration: none;
    color: #374151;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease;
}

.btm-point-item:active {
    background-color: #f5f5f5;
}

.btm-point-item--disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.btm-point-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6 !important;
}

.btm-point-icon svg {
    width: 18px !important;
    height: 18px !important;
}

.btm-point-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.btm-point-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
}

.btm-point-desc {
    display: none;
}

.btm-badge {
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    line-height: 1.4;
}

#panelPoint .btm-badge {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
}

/* --- 현재 페이지 하이라이트 (슬라이드 팝업 내 메뉴) --- */
.btm-submenu-item.btm-active .btm-icon-wrap {
    background-color: #9ca3af !important;
}
.btm-submenu-item.btm-active .btm-icon-wrap svg,
.btm-submenu-item.btm-active .btm-icon-wrap i {
    color: #fff !important;
}
.btm-submenu-item.btm-active span {
    font-weight: 700;
}

.btm-accordion-link.btm-active {
    color: #374151;
    font-weight: 700;
}

.btm-point-item.btm-active .btm-point-icon {
    background-color: #9ca3af !important;
}
.btm-point-item.btm-active .btm-point-icon svg,
.btm-point-item.btm-active .btm-point-icon i {
    color: #fff !important;
}
.btm-point-item.btm-active .btm-point-name {
    font-weight: 700;
}

.btm-point-quick-item.btm-active .btm-pq-icon {
    background-color: #9ca3af !important;
}
.btm-point-quick-item.btm-active .btm-pq-icon svg,
.btm-point-quick-item.btm-active .btm-pq-icon i {
    color: #fff !important;
}
.btm-point-quick-item.btm-active span {
    font-weight: 700;
}

/* --- Accordion (더보기 패널) --- */
.btm-accordion {
    border-bottom: 1px solid #f3f4f6;
}

.btm-accordion:last-child {
    border-bottom: none;
}

.btm-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 4px;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.btm-accordion-header:active {
    opacity: 0.7;
}

.btm-chevron {
    transition: transform 0.25s ease;
}

.btm-accordion.open .btm-chevron {
    transform: rotate(180deg);
}

.btm-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.btm-accordion.open .btm-accordion-body {
    max-height: 400px;
}

.btm-accordion-link {
    display: block;
    padding: 11px 16px 11px 48px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btm-accordion-link:active {
    background-color: #f3f4f6;
    color: #374151;
}

/* --- 쇼핑몰 구경하기 슬라이드 패널 --- */
.btm-mall-panel {
    position: absolute;
    inset: 0;
    background: #ffffff;
    border-radius: inherit;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 10;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.btm-mall-panel.active {
    transform: translateX(0);
}

.btm-mall-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}

.btm-mall-back {
    background: none;
    border: none;
    padding: 2px;
    display: flex;
    align-items: center;
    color: #374151;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: 6px;
    margin-right: 2px;
}

.btm-mall-back:active {
    background: #f3f4f6;
}

.btm-mall-title {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.01em;
}

.btm-mall-badge {
    font-size: 11px;
    font-weight: 600;
    background: #f3e8ff;
    color: #7c3aed;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 2px;
}

.btm-mall-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 8px 16px;
}

.btm-mall-content::-webkit-scrollbar {
    display: none;
}

.btm-mall-content {
    scrollbar-width: none;
}

/* --- 플로팅 버튼 위치: 새 하단메뉴(60px) 바로 위로 조정 --- */
/* 모바일: 챗봇 플로팅 버튼·상담소·AI챗봇 모두 하단 메뉴 슬라이드팝업(3000) 뒤에 표시 */
@media (max-width: 768px) {
    #chatbot {
        position: relative;
        z-index: 2990;
    }
    /* 애드픽 AI상담 팝업도 메뉴 뒤로 */
    #aichatbox.aichatbox,
    .faq-search .aichatbox {
        z-index: 2990 !important;
    }
    .faq-search:has(#aichatbox[style*="display: block"]),
    .faq-search:has(#aichatbox[style*="display:block"]) {
        position: relative;
        z-index: 2990 !important;
    }
}
.chatbot-faq .chatbot {
    bottom: 72px !important;
}
.chatbot-faq .chatbot::before {
    bottom: 137px !important;
}
.chatbot-faq .chatbot::after {
    bottom: 115px !important;
}
.chatbot-faq .chatbot.bottom {
    bottom: 72px !important;
}
.chatbot-faq .chatbot.bottom::before {
    bottom: 137px !important;
}
.chatbot-faq .chatbot.bottom::after {
    bottom: 115px !important;
}

.body-page-bbs .btn-write {
    bottom: 72px !important;
}
.icon-link {
    bottom: 72px !important;
}
.body-page-bbs .chatbot-faq.withwrite .chatbot {
    bottom: 132px !important;
}
.body-page-bbs .chatbot-faq.withwrite .chatbot::before {
    bottom: 197px !important;
}
.body-page-bbs .chatbot-faq.withwrite .chatbot::after {
    bottom: 175px !important;
}

@supports (bottom: env(safe-area-inset-bottom)) {
    .chatbot-faq .chatbot,
    .chatbot-faq .chatbot.bottom {
        bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    }
    .body-page-bbs .btn-write,
    .icon-link {
        bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    }
    .body-page-bbs .chatbot-faq.withwrite .chatbot {
        bottom: calc(132px + env(safe-area-inset-bottom)) !important;
    }
}
