/* ========================================
   Vendor Search V2 - 새로운 레이아웃
   PC: 좌측 목록 + 우측 지도 (항상 표시)
   모바일: 기존 토글 방식 유지
======================================== */


/* ========================================
   레이아웃 기본 구조
======================================== */

body.page-template-vendor-search-v2 {
    max-width: 100% !important;
}

body.page-template-vendor-search-v2 footer,
body.page-template-vendor-search-v2 .bottom-nav {
    display: none;
}

body.page-template-vendor-search-v2 .fw-page-container {
    min-height: calc(100vh - 65px);
    padding-bottom: 0px;
    padding-top: 65px;
}

.custom-header-container {
    max-width: 100%;
}

.vendor-search-layout {
    width: 100%;
    height: calc(100vh - 65px);
    /* 헤더 높이 제외 */
    position: relative;
    background: #fff;
    overflow: hidden;
}


/* ========================================
   좌측 사이드바 (검색 + 목록)
======================================== */

.vendor-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 450px;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}


/* 검색 영역 */

.search-wrap {
    flex-shrink: 0;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

.search-basic {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.search-basic select {
    width: 120px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.search-basic select:focus {
    border-color: #007bff;
}

.search-basic input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-basic input:focus {
    border-color: #007bff;
}

.search-basic input::placeholder {
    color: #999;
}

.btn-toggle-options {
    width: 100%;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    margin-bottom: 0;
}

.btn-toggle-options:hover {
    background: #e9ecef;
}

.btn-toggle-options.active {
    background: #e9ecef;
    border-color: #007bff;
}

.btn-toggle-options img {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}

.btn-toggle-options.active img {
    transform: rotate(180deg);
}

.search-options-container {
    margin-top: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-group label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.option-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.option-group select:focus {
    border-color: #007bff;
}

.sub-category-select {
    display: none;
    margin-top: 8px;
}

.sub-category-select.show {
    display: block;
}

.category-hierarchy {
    margin-top: 8px;
    display: none;
}

.category-path {
    background-color: #fff;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #495057;
    border: 1px solid #dee2e6;
}

.category-path .separator {
    margin: 0 6px;
    color: #999;
}

.search-btn-wrap {
    margin-top: 15px;
}

.search-btn-wrap button {
    width: 100%;
    padding: 14px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.search-btn-wrap button:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.search-btn-wrap button:active {
    transform: translateY(0);
}


/* 목록 영역 */

.vendor_list {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #fff;
    overflow: hidden;
    /* 전체 스크롤 방지 */
}

.sort-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-shrink: 0;
    /* 고정 영역 */
}

.sort-btn {
    padding: 6px 13px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 30px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.sort-btn:hover {
    background: #e9ecef;
}

.sort-btn.active {
    background: #007bff0a;
    color: #007bff;
    border-color: #007bff;
    font-weight: 600;
}

.vendor-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    /* gap 제거해서 border-bottom이 연결되도록 */
    flex: 1;
    /* 남은 공간 모두 사용 */
    overflow-y: auto;
    /* 스크롤 활성화 */
    padding-right: 4px;
    /* 스크롤바 여백 */
}


/* ========================================
   페이지네이션 스타일
======================================== */

.pagination-container {
    margin-top: 15px;
    flex-shrink: 0;
    /* 고정 영역 */
    background: #fff;
    /* 배경 고정 */
}

.pagination-info {
    text-align: center;
    margin-bottom: 15px;
    font-size: 13px;
    color: #666;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 3px 6px;
    background: #fff;
    border: 0;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    min-width: 28px;
    text-align: center;
}

.page-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.page-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
    font-weight: 600;
}

.page-btn.prev,
.page-btn.next {
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn.prev i,
.page-btn.next i {
    font-size: 13px;
    color: #555;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.dots {
    padding: 8px 4px;
    color: #999;
    font-size: 14px;
}


/* ========================================
   우측 지도 영역
======================================== */

.vendor-map-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f8f9fa;
}

#map {
    width: 100%;
    height: 100%;
}

#zoom_controller {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 50;
    /* 사이드바보다 아래, 토글 버튼보다 아래 */
}

#zoom_controller>div {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    color: #333;
}

#zoom_controller>div:hover {
    background: #f8f9fa;
}

#zoom_controller hr {
    margin: 0;
    border: none;
    border-top: 1px solid #e0e0e0;
    height: 1px;
}


/* ========================================
   사이드바 토글 버튼 (PC용)
======================================== */

.sidebar-toggle-btn {
    position: absolute;
    top: 0;
    left: 100%;
    width: 31px;
    height: 52px;
    background: #fff;
    border: none;
    border-radius: 0 9px 9px 0;
    cursor: pointer;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: #5c5c5c;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    outline: none;
    padding: 0;
}

.sidebar-toggle-btn i {
    transition: all 0.3s ease;
}


/* 사이드바가 숨겨졌을 때 버튼 위치와 스타일 */


/* PC에서 사이드바 fade out left 애니메이션 */

.vendor-search-layout.sidebar-hidden .vendor-sidebar {
    transform: translateX(-100%);
}

.vendor-search-layout.sidebar-hidden .vendor-map-area {
    width: 100%;
    flex: 1;
}


/* 사이드바 토글 애니메이션 */

.vendor-sidebar {
    transition: all 0.3s ease;
}

.vendor-map-area {
    transition: all 0.3s ease;
}


/* 모바일 전용 목록 보기 버튼 */

.view-list-button.mobile-only {
    display: none;
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 9px 21px 9px 19px;
    background: #404040;
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    /* box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3); */
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    outline: none;
}

.view-list-button.mobile-only:hover {
    background: #0056b3;
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
    transform: translateX(-50%) translateY(-2px);
}

.view-list-button.mobile-only:active {
    transform: translateX(-50%) translateY(0);
}

.view-list-button.mobile-only i {
    font-size: 12px;
}

.mobile-handle {
    display: none;
}


/* ========================================
   모바일 반응형 (768px 이하)
======================================== */

@media (max-width: 768px) {
    .vendor-search-layout {
        height: calc(100vh - 60px);
    }
    /* 모바일에서는 기존 방식 유지 */
    .vendor-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        border-right: none;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }
    .vendor-sidebar.mobile-active {
        transform: translateY(0);
    }
    /* 모바일 핸들 표시 */
    .mobile-handle {
        display: block;
        width: 60px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 15px auto 0;
        flex-shrink: 0;
        cursor: pointer;
    }
    /* 검색 영역 조정 */
    .search-wrap {
        padding: 15px;
    }
    .search-basic {
        flex-direction: column;
        gap: 10px;
    }
    .search-basic select {
        width: 100%;
    }
    /* 목록 영역 조정 */
    .vendor_list {
        padding: 15px;
    }
    /* 모바일에서 vendor-grid 패딩 조정 */
    .vendor-grid {
        padding-right: 2px;
    }
    /* 지도 영역을 전체로 */
    .vendor-map-area {
        width: 100%;
        height: 100%;
        flex: 1;
    }
    /* PC 사이드바 토글 버튼 숨기기 */
    .sidebar-toggle-btn {
        display: none !important;
    }
    /* 모바일 버튼 표시 */
    .view-list-button.mobile-only {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
    }
    /* 페이지네이션 모바일 최적화 */
    .pagination {
        gap: 2px;
    }
    .page-btn {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 36px;
    }
    .pagination-info {
        font-size: 12px;
    }
    /* 줌 컨트롤러 위치 조정 */
    #zoom_controller {
        top: 15px;
        right: 15px;
    }
    #zoom_controller>div {
        width: 36px;
        height: 36px;
    }
}


/* ========================================
   태블릿 반응형 (769px ~ 1024px)
======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    .vendor-sidebar {
        width: 380px;
    }
    /* 토글 버튼은 right: -22px로 고정되어 있으므로 별도 조정 불필요 */
    .search-wrap {
        padding: 18px;
    }
    .vendor_list {
        padding: 18px;
    }
    /* 태블릿에서 vendor-grid 패딩 조정 */
    .vendor-grid {
        padding-right: 3px;
    }
    .search-basic {
        gap: 6px;
    }
    .search-basic select {
        width: 110px;
    }
}


/* ========================================
   대형 화면 (1440px 이상)
======================================== */

@media (min-width: 1440px) {
    .vendor-sidebar {
        width: 500px;
    }
    /* 토글 버튼은 right: -22px로 고정되어 있으므로 별도 조정 불필요 */
    .search-wrap {
        padding: 20px;
    }
    .vendor_list {
        padding: 20px;
    }
    /* 대형 화면에서 vendor-grid 패딩 조정 */
    .vendor-grid {
        padding-right: 6px;
    }
    .search-basic select {
        width: 130px;
    }
}


/* ========================================
   에러 메시지
======================================== */

.error-message {
    padding: 20px;
    text-align: center;
    color: #e74c3c;
    font-size: 14px;
    background-color: #fdf2f2;
    border-radius: 8px;
    margin: 15px;
    border: 1px solid #f5c6cb;
}


/* ========================================
   스크롤바 스타일링
======================================== */

.vendor-grid::-webkit-scrollbar {
    width: 4px;
}

.vendor-grid::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.vendor-grid::-webkit-scrollbar-thumb {
    background: #d8d8d8;
    border-radius: 3px;
    transition: background 0.2s;
}

.vendor-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}


/* ========================================
   로딩 상태 및 애니메이션
======================================== */

.vendor-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}


/* ========================================
   접근성 및 포커스 스타일
======================================== */

.search-basic select:focus,
.search-basic input:focus,
.option-group select:focus,
.search-btn-wrap button:focus,
.sort-btn:focus,
#loadMoreBtn:focus,
.view-list-button:focus {
    /* box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25); */
}


/* ========================================
   업체 목록 아이템 스타일
======================================== */

.vendor-item {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    align-items: center;
    transition: background-color 0.2s;
}

.vendor-item:hover {
    background-color: #f8f9fa;
}

.vendor-item:last-child {
    border-bottom: none;
}

.vendor-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f5;
}

.vendor-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vendor-info {
    flex: 1;
    padding-left: 15px;
    position: relative;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.vendor-info h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 5px;
    color: #333;
    line-height: 1.3;
}

.vendor-info .category-badge {
    display: inline-block;
    font-size: 12px;
    color: #666;
    padding: 2px 0px;
    border-radius: 4px;
    margin-bottom: 2px;
    font-weight: 500;
}

.vendor-info .addr {
    font-size: 13px;
    color: #666;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.vendor-info .stats {
    position: absolute;
    right: 0;
    bottom: 0;
    font-size: 12px;
}

.vendor-info .stats .likes {
    color: #ff5252;
    display: flex;
    align-items: center;
    gap: 3px;
}

.vendor-info .stats .likes i {
    font-size: 11px;
}


/* ========================================
   빈 결과 및 로딩 상태
======================================== */

.empty-wrap {
    padding: 40px 20px;
    text-align: center;
}

.empty-wrap img {
    width: 60px;
    margin-bottom: 15px;
    opacity: 0.6;
}

.empty-wrap p {
    font-size: 15px;
    color: #888;
    line-height: 1.5;
    margin: 0;
}

.loading-indicator {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.loading-indicator i {
    margin-right: 5px;
    animation: spin 1s linear infinite;
}


/* ========================================
   개선된 마커 스타일
======================================== */

.marker {
    width: 26px;
    height: 26px;
    background: #3f9bfe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.marker:hover {
    transform: scale(1.1);
    z-index: 10;
}

.marker.liked {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.marker.liked:hover {
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.6);
}

.marker.active {
    transform: scale(1.2);
    z-index: 15;
}

.marker.small {
    width: 24px;
    height: 24px;
    font-size: 10px;
    transform: scale(0.8);
}

.marker.large {
    width: 30px;
    height: 30px;
    font-size: 16px;
    transform: scale(1.1);
}

.marker.small:hover {
    transform: scale(0.9);
}

.marker.large:hover {
    transform: scale(1.2);
}