/* ============================================
   건축포털 김반장 - 메인 스타일시트
   당근마켓 스타일 모바일 퍼스트
   ============================================ */

/* 리셋 및 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 당근마켓 색상 */
    --primary-color: #FF6F0F;
    --primary-hover: #E85D00;
    --background: #FFFFFF;
    --surface: #F8F9FA;
    --text-primary: #212529;
    --text-secondary: #868E96;
    --border: #E2E8F0;
    --error: #EF4444;
    --success: #10B981;
    
    /* 간격 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* 그림자 */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    /* 모서리 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 60px; /* 하단 퀵메뉴 공간 */
}

/* ============================================
   상단 헤더
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-main {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    justify-content: space-between;
}

.header-logo {
    flex-shrink: 0;
}

.logo-link {
    display: inline-block;
    text-decoration: none;
}

.logo-img {
    height: 32px;
    width: auto;
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    position: relative;
}

.header-icon-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-primary);
    font-size: 20px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.header-icon-btn:hover,
.header-icon-btn:active {
    opacity: 0.7;
}

.header-icon-btn svg {
    width: 24px;
    height: 24px;
}

.header-icon-btn.chat {
    display:none; /* 모바일용 */
}
.header-icon-btn.profile {
    display:none; /* 모바일용 */
}


/* ============================================
   1차 카테고리 슬라이드
   ============================================ */
.category-slider {
    height: 48px;
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding-left: var(--spacing-sm);
}

.category-slider::-webkit-scrollbar {
    display: none;
}

.category-all-btn {
    flex-shrink: 0;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 var(--spacing-sm);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.category-all-btn:hover {
    background-color: var(--border);
}

.category-all-btn svg {
    width: 18px;
    height: 18px;
}

.category-list {
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    gap: var(--spacing-md);
    height: 100%;
    white-space: nowrap;
    flex: 1;
    overflow-x: auto;
}

.view-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0 var(--spacing-sm);
    flex-shrink: 0;
    background-color: var(--background);
    position: relative;
    z-index: 1;
}

.view-toggle-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    padding: 0;
}

.view-toggle-btn:hover {
    background-color: var(--surface);
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* 뷰/정렬 선택 컨트롤 */
.view-sort-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0 var(--spacing-sm);
    flex-shrink: 0;
    background-color: var(--background);
    position: relative;
    z-index: 10;
}

.control-btn-wrapper {
    position: relative;
}

.control-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    padding: 0;
    gap: 4px;
}

.control-btn:hover {
    background-color: var(--surface);
    border-color: var(--primary-color);
}

.control-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.control-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.control-btn-label {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

/* 정렬 버튼 아이콘 숨기기 */
#sortSelectIcon {
    display: none;
}

/* 정렬 버튼 라벨 항상 표시 */
#sortSelectLabel {
    display: inline-block !important;
}

.control-dropdown {
    position: fixed;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 120px;
    overflow: hidden;
    display: none;
}

.control-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.control-option:last-child {
    border-bottom: none;
}

.control-option:hover {
    background: var(--surface);
}

.control-option.active {
    background: #fff5e6;
    color: var(--primary-color);
    font-weight: 500;
}

.control-option svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sort-order-icon {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
}

.category-item {
    flex-shrink: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    position: relative;
    transition: color 0.2s;
    gap: 4px;
}

.category-item.has-parent-icon::before {
    content: '↑';
    font-size: 12px;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-right: 2px;
    line-height: 1;
}

.category-item.has-parent-icon:hover::before {
    opacity: 1;
}

.category-item:hover,
.category-item.active {
    color: var(--text-primary);
    font-weight: 600;
}


/* ============================================
   상품 목록
   ============================================ */
.main-content {
    padding: var(--spacing-md);
    max-width: 100%;
    margin: 0 auto;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.products-grid[data-view="list"] {
    grid-template-columns: 1fr;
    gap: 0;
}

.products-grid[data-view="list"] .product-card {
    display: none !important;
}

.products-grid[data-view="list"] .product-item {
    display: flex !important;
    margin-bottom: var(--spacing-md);
    width: 100%;
}

.products-grid[data-view="list"] .product-item:last-child {
    margin-bottom: 0;
}

.products-grid[data-view="grid"] .product-item {
    display: none !important;
}

/* 상품 카드 (그리드 뷰) */
.product-card {
    background-color: var(--background);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:active {
    transform: scale(0.98);
}

.product-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 비율 */
    background-color: var(--surface);
    overflow: hidden;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-badges {
    position: absolute;
    top: var(--spacing-xs);
    left: var(--spacing-xs);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    z-index: 2;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.badge-new {
    background-color: var(--primary-color);
    color: white;
}

.badge-discount {
    background-color: var(--error);
    color: white;
}

.product-favorite {
    position: absolute;
    top: var(--spacing-xs);
    right: var(--spacing-xs);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    z-index: 2;
    transition: background-color 0.2s;
}

.product-favorite:hover,
.product-favorite.active {
    background-color: rgba(255, 111, 15, 0.1);
    color: var(--primary-color);
}

.product-info {
    padding: var(--spacing-sm);
}

.product-name {
    font-size: 20px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    /* min-height: 2.8em; */
}

.product-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
    font-size: 12px;
    color: var(--text-secondary);
}

.product-region {
    font-weight: 500;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 2px;
}

.product-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.price-original {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    text-decoration: line-through;
    margin-right: var(--spacing-xs);
}

.price-current {
    color: var(--text-primary);
}

/* 상품 아이템 (리스트 뷰) */
.product-item {
    display: flex;
    background-color: var(--background);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--spacing-md);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.product-item:active {
    transform: scale(0.98);
}

.product-item-image {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    background-color: var(--surface);
    position: relative;
    overflow: hidden;
}

.product-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-item-info {
    flex: 1;
    padding: 0 var(--spacing-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-item-name {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.product-item-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-item-price {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.product-item-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
}

/* ============================================
   하단 퀵메뉴
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--background);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xs);
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s;
    min-height: 60px;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 2px;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

/* ============================================
   플로팅 버튼 (상품추가)
   ============================================ */
.floating-add-btn {
    position: fixed;
    bottom: 80px;
    right: var(--spacing-md);
    width: 56px;
    height: 56px;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.floating-add-btn:hover {
    transform: scale(1.05);
}

.floating-add-btn:active {
    transform: scale(0.95);
}

/* ============================================
   검색 화면
   ============================================ */
.search-header {
    height: 56px;
    /* display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    gap: var(--spacing-sm); */
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
}

.search-header-content {
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    gap: var(--spacing-sm);    
}

.search-back-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
    flex-shrink: 0;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    outline: none;
    background-color: var(--surface);
}

.search-input:focus {
    border-color: var(--primary-color);
    background-color: var(--background);
}

.search-submit-btn,
.search-sort-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-primary);
    color: var(--text-primary);
    flex-shrink: 0;
}

.recent-searches {
    padding: var(--spacing-md);
    background-color: var(--background);
}

.recent-searches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.recent-searches-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.recent-searches-delete-all {
    font-size: 14px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.recent-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.recent-search-item:last-child {
    border-bottom: none;
}

.recent-search-text {
    flex: 1;
    font-size: 15px;
    color: var(--text-primary);
}

.recent-search-delete {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
}

.search-category-bar {
    height: 48px;
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding-left: var(--spacing-xs);
}

.search-category-bar::-webkit-scrollbar {
    display: none;
}

.search-category-list {
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    gap: var(--spacing-sm);
    height: 100%;
    white-space: nowrap;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.search-category-item {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background-color: var(--surface);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.search-category-item.active {
    background-color: var(--primary-color);
    color: white;
}

/* ============================================
   알림 화면
   ============================================ */
.notification-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background-color: var(--background);
    z-index: 1000;
    transition: right 0.3s ease;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.notification-panel.open {
    right: 0;
}

.notification-header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background-color: var(--background);
    z-index: 10;
}

.notification-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-close-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
}

.notification-list {
    padding: var(--spacing-md);
}

.notification-item {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.2s;
}

.notification-item:hover {
    background-color: var(--surface);
}

.notification-item.unread {
    background-color: #FFF9E6;
}

.notification-header-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.notification-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.notification-title-text {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.notification-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item.expanded .notification-content {
    -webkit-line-clamp: unset;
}

.notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.notification-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   전체 카테고리 레이어
   ============================================ */
.category-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.category-overlay.show {
    opacity: 1;
    visibility: visible;
}

.category-panel {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background-color: var(--background);
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.category-panel.open {
    left: 0;
}

.category-panel-header {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background-color: var(--background);
    z-index: 10;
}

.category-panel-close-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
    margin-right: var(--spacing-sm);
}

.category-panel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.category-panel-list {
    padding: var(--spacing-md);
}

.category-panel-item {
    margin-bottom: var(--spacing-sm);
}

.category-panel-level1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background-color: var(--surface);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s;
}

.category-panel-level1:hover {
    background-color: var(--border);
}

.category-panel-level1-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.category-panel-level1-toggle {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.category-panel-level1.collapsed .category-panel-level1-toggle {
    transform: rotate(0deg);
}

.category-panel-level2-wrapper {
    margin-top: var(--spacing-xs);
    padding-left: var(--spacing-md);
}

.category-panel-level2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: var(--radius-sm);
}

.category-panel-level2:hover {
    background-color: var(--surface);
}

.category-panel-level2-text {
    font-size: 15px;
    color: var(--text-primary);
    flex: 1;
}

.category-panel-level2-toggle {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.category-panel-level2.collapsed .category-panel-level2-toggle {
    transform: rotate(0deg);
}

.category-panel-level3-wrapper {
    margin-top: var(--spacing-xs);
    padding-left: var(--spacing-md);
}

.category-panel-level3 {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s, color 0.2s;
}

.category-panel-level3:hover {
    background-color: var(--surface);
    color: var(--text-primary);
}

/* ============================================
   전체 메뉴 화면 (레거시 - 다른 페이지에서 사용 가능)
   ============================================ */
.menu-panel {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background-color: var(--background);
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.menu-panel.open {
    left: 0;
}

.menu-header {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background-color: var(--background);
    z-index: 10;
}

.menu-back-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
    margin-right: var(--spacing-sm);
}

.menu-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.menu-list {
    padding: var(--spacing-md);
}

.menu-category {
    margin-bottom: var(--spacing-sm);
}

.menu-category-level1 {
    padding: var(--spacing-sm) 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-category-level1-text {
    flex: 1;
    cursor: pointer;
}

.menu-category-level1-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.menu-category-level1-toggle::after {
    content: '▼';
    font-size: 12px;
    transition: transform 0.2s;
}

.menu-category-level1.collapsed .menu-category-level1-toggle::after {
    transform: rotate(-90deg);
}


.menu-category-level2 {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-category-level2-text {
    flex: 1;
    cursor: pointer;
}

.menu-category-level2-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.menu-category-level2-toggle::after {
    content: '▶';
    font-size: 10px;
    transition: transform 0.2s;
}

.menu-category-level2.collapsed .menu-category-level2-toggle::after {
    transform: rotate(-90deg);
}

.menu-category-level3 {
    padding: var(--spacing-xs) var(--spacing-lg);
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    display: block;
    transition: color 0.2s;
}

.menu-category-level3:hover {
    color: var(--primary-color);
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.menu-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   상품 상세 화면
   ============================================ */
.product-detail-header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.product-detail-header-left,
.product-detail-header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.product-image-slider {
    width: 100%;
    position: relative;
    background-color: var(--surface);
}

.product-image-slider img {
    width: 100%;
    height: auto;
    display: block;
}

.product-image-indicators {
    position: absolute;
    bottom: var(--spacing-md);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--spacing-xs);
    z-index: 2;
}

.product-image-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transition: background-color 0.2s;
}

.product-image-indicator.active {
    background-color: white;
}

.seller-info {
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    border-bottom: 1px solid var(--border);
}

.seller-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--surface);
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Ccircle cx='24' cy='24' r='24' fill='%23e2e8f0'/%3E%3Ccircle cx='24' cy='19' r='7' fill='%2394a3b8'/%3E%3Cpath d='M12 38 Q12 30 24 30 Q36 30 36 38' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.seller-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: none;
}

.seller-avatar.has-image {
    background-image: none;
}

.seller-avatar.has-image img {
    display: block;
}

.seller-info-text {
    flex: 1;
}

.seller-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.seller-rating {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.product-detail-info {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
}

.product-detail-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
}

.product-detail-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.product-detail-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.product-detail-description {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

.reviews-section {
    padding: var(--spacing-md);
    border-top: 8px solid var(--surface);
}

.reviews-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.review-item {
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border);
}

.review-item:last-child {
    border-bottom: none;
}

.review-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.review-author {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.review-rating {
    font-size: 14px;
    color: var(--text-secondary);
}

.review-date {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: auto;
}

.review-content {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.product-detail-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--background);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    gap: var(--spacing-sm);
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.product-favorite-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 24px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.product-favorite-btn.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.product-chat-btn {
    flex: 1;
    height: 48px;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.product-chat-btn:hover {
    background-color: var(--primary-hover);
}

/* ============================================
   채팅 화면
   ============================================ */
.chat-list {
    /* padding: var(--spacing-md); */
}

.chat-item {
    display: flex;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-item:hover {
    background-color: var(--surface);
}

.chat-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--surface);
    flex-shrink: 0;
    margin-right: var(--spacing-md);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Ccircle cx='28' cy='28' r='28' fill='%23e2e8f0'/%3E%3Ccircle cx='28' cy='22' r='8' fill='%2394a3b8'/%3E%3Cpath d='M14 45 Q14 35 28 35 Q42 35 42 45' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: none;
}

.chat-avatar.has-image {
    background-image: none;
}

.chat-avatar.has-image img {
    display: block;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.chat-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-time {
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.chat-preview {
    font-size: 14px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-unread {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: var(--spacing-sm);
}

/* ============================================
   채팅방 화면 (카카오톡 스타일)
   ============================================ */
.chat-room-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.chat-room-header-content {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-sm);
    gap: var(--spacing-sm);
}

.chat-room-back-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
    flex-shrink: 0;
}

.chat-room-user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-width: 0;
}

.chat-room-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--surface);
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Ccircle cx='20' cy='20' r='20' fill='%23e2e8f0'/%3E%3Ccircle cx='20' cy='16' r='6' fill='%2394a3b8'/%3E%3Cpath d='M10 32 Q10 25 20 25 Q30 25 30 32' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.chat-room-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: none;
}

.chat-room-avatar.has-image {
    background-image: none;
}

.chat-room-avatar.has-image img {
    display: block;
}

.chat-room-user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-room-header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.chat-room-menu-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-primary);
    flex-shrink: 0;
}

.chat-room-messages {
    padding: var(--spacing-md);
    min-height: calc(100vh - 56px - 60px);
    padding-bottom: 0;
    overflow-y: hidden;
    background-color: #F5F5F5;
}

.chat-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: var(--spacing-md) 0;
}

.chat-date-divider span {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
}

.chat-message {
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message-me {
    flex-direction: row-reverse;
}

.chat-message-other {
    flex-direction: row;
}

.chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--surface);
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Ccircle cx='18' cy='18' r='18' fill='%23e2e8f0'/%3E%3Ccircle cx='18' cy='14' r='5' fill='%2394a3b8'/%3E%3Cpath d='M9 29 Q9 22 18 22 Q27 22 27 29' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.chat-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: none;
}

.chat-message-avatar.has-image {
    background-image: none;
}

.chat-message-avatar.has-image img {
    display: block;
}

.chat-message-content {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    gap: 4px;
}

.chat-message-me .chat-message-content {
    align-items: flex-end;
}

.chat-message-other .chat-message-content {
    align-items: flex-start;
}

.chat-message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    /* white-space: pre-wrap; */
}

.chat-message-me .chat-message-bubble {
    background-color: #FFE812;
    color: var(--text-primary);
    border-top-right-radius: 4px;
}

.chat-message-other .chat-message-bubble {
    background-color: white;
    color: var(--text-primary);
    border-top-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-message-time {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 4px;
}

.chat-message-time-me {
    text-align: right;
}

.chat-message-time-other {
    text-align: left;
}

.chat-room-input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--background);
    border-top: 1px solid var(--border);
    padding: var(--spacing-sm);
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.chat-room-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-sm);
    max-width: 100%;
}

.chat-room-mic-btn {
    width: 40px;
    height: 40px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-room-mic-btn:hover {
    background-color: var(--border);
}

.chat-room-mic-btn.active {
    background-color: var(--error);
    border-color: var(--error);
    color: white;
    animation: pulse 1.5s ease-in-out infinite;
}

.chat-room-mic-btn.active .mic-icon {
    transform: scale(1.1);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.chat-room-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    background-color: var(--surface);
    line-height: 1.4;
    overflow-y: auto;
}

.chat-room-input:focus {
    border-color: var(--primary-color);
    background-color: var(--background);
}

.chat-room-send-btn {
    min-width: 60px;
    height: 40px;
    padding: 0 var(--spacing-md);
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
}

.chat-room-send-btn:hover {
    background-color: var(--primary-hover);
}

.chat-room-send-btn:active {
    transform: scale(0.95);
}

.chat-room-send-btn:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.chat-room-recording-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 13px;
    color: var(--error);
    background-color: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-xs);
    animation: fadeIn 0.3s ease-in;
}

.recording-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--error);
    animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* 하단 퀵메뉴가 있을 때 입력 영역 위치 조정 */
body:has(.bottom-nav) .chat-room-input-area {
    bottom: 60px;
}

body:has(.bottom-nav) .chat-room-messages {
    padding-bottom: 200px; /* 하단 퀵메뉴(60px) + 입력 영역 높이 고려 */
}

/* ============================================
   프로필 화면
   ============================================ */
.profile-header {
    padding: var(--spacing-lg) var(--spacing-md);
    background-color: var(--background);
    border-bottom: 1px solid var(--border);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.profile-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--surface);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Ccircle cx='40' cy='40' r='40' fill='%23e2e8f0'/%3E%3Ccircle cx='40' cy='32' r='12' fill='%2394a3b8'/%3E%3Cpath d='M20 65 Q20 50 40 50 Q60 50 60 65' fill='%2394a3b8'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.profile-avatar.has-image {
    background-image: none;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.profile-avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.profile-avatar-upload-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.profile-avatar-upload-btn:active {
    transform: scale(0.95);
}

.profile-avatar-upload-btn svg {
    width: 14px;
    height: 14px;
}

.profile-details {
    flex: 1;
}

.profile-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.profile-email {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-stats {
    display: flex;
    gap: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border);
}

.profile-stat {
    flex: 1;
    text-align: center;
}

.profile-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 2px;
}

.profile-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-menu {
    padding: var(--spacing-md);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.profile-menu-item:hover {
    background-color: var(--surface);
}

.profile-menu-item:last-child {
    border-bottom: none;
}

.profile-menu-label {
    font-size: 15px;
    font-weight: 500;
}

.profile-menu-icon {
    font-size: 18px;
    color: var(--text-secondary);
}

.profile-logout-btn {
    width: 100%;
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
    background-color: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.profile-logout-btn:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

.profile-logout-btn:active {
    transform: translateY(0);
    background-color: #b91c1c;
}

.profile-logout-label {
    display: block;
}

/* ============================================
   유틸리티 클래스
   ============================================ */
.empty-state {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
}

.loading {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* products-grid 내부의 loading은 그리드 전체 영역을 차지하도록 */
.products-grid .loading {
    grid-column: 1 / -1;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: var(--border);
}

/* ============================================
   반응형 디자인
   ============================================ */
@media (min-width: 768px) {
    .main-content {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    /* 태블릿/PC에서 헤더와 카테고리 리스트 최대 너비 제한 */
    .header-main {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .category-list {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .products-grid[data-view="list"] {
        grid-template-columns: 1fr;
    }

    .search-header-content {
        max-width: 1200px;
        margin: 0 auto;
    }

    .header-main, .profile-header, .profile-menu {
        max-width: 1200px;
        margin: 0 auto;
    }

    .view-toggle {
        padding: 0 var(--spacing-md);
    }

    .recent-searches-content {
        max-width: 1100px;
        margin: 0 auto;
    }

    .recent-search-item {
        display: inline;
        border: 1px solid var(--border);
        padding: var(--spacing-sm) var(--spacing-sm);
        border-radius: 10px;
        margin: 0 1rem;
    }

    .recent-search-delete {
        display: inline;
    }

    .bottom-nav {
        display:none;
    }

    #menuBtn {
        display:none;
    }

    
    .header-icon-btn.chat {
        display:inherit; /* 모바일용 */
    }
    .header-icon-btn.profile {
        display:inherit; /* 모바일용 */
    }

}

@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   설정 페이지 스타일
   ============================================ */
.settings-section {
    background-color: var(--background);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.settings-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.settings-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.settings-form {
    margin-top: var(--spacing-md);
}

.settings-form .form-group {
    margin-bottom: var(--spacing-md);
}

.settings-form label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.settings-form input[type="text"],
.settings-form input[type="email"],
.settings-form input[type="password"],
.settings-form input[type="tel"] {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.settings-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 111, 15, 0.1);
}

.settings-form input[readonly] {
    background-color: var(--surface);
    cursor: not-allowed;
}

.required {
    color: var(--error);
}

/* 파일 업로드 영역 */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background-color: var(--surface);
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(255, 111, 15, 0.05);
}

.file-upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(255, 111, 15, 0.1);
}

.file-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
}

.file-upload-placeholder svg {
    color: var(--text-secondary);
}

.file-upload-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.file-upload-preview {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.file-upload-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.file-upload-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    background-color: var(--surface);
    border-radius: var(--radius);
}

.btn-remove-file {
    padding: var(--spacing-xs) var(--spacing-sm);
    background-color: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
}

.btn-remove-file:hover {
    background-color: #dc2626;
}

/* 업로드 진행률 */
.upload-progress {
    margin-top: var(--spacing-sm);
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--surface);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.upload-progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s;
    width: 0%;
}

.upload-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* 주소 입력 그룹 */
.address-input-group {
    display: flex;
    gap: var(--spacing-xs);
}

.address-input-group input {
    flex: 1;
}

.btn-secondary {
    padding: 0.875rem 1rem;
    background-color: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: var(--border);
}

/* 모바일 최적화 */
@media (max-width: 767px) {
    body {
        font-size: 15px;
    }
    
    .header-main {
        padding: 0 var(--spacing-sm);
    }
    
    .main-content {
        padding: var(--spacing-sm);
    }
    
    .products-grid {
        gap: var(--spacing-sm);
    }

    .address-input-group {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }
}

/* 정렬 레이어 스타일 - 기본 (드롭다운) */
.sort-layer {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 200;
    min-width: 120px;
    overflow: hidden;
}

/* search 페이지의 정렬 레이어 위치 조정 */
.search-header-content {
    position: relative;
}

/* 정렬 레이어 - 하단 슬라이드 (index.html 전용) */
.sort-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sort-overlay.show {
    opacity: 1;
    visibility: visible;
}

.sort-layer-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 200;
    max-height: 50vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    opacity: 0;
    visibility: hidden;
    min-width: auto;
    border: none;
    border-radius: 0;
}

.sort-layer-bottom.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.sort-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.sort-option:last-child {
    border-bottom: none;
}

.sort-option:hover {
    background: #f8f9fa;
}

.sort-option.active {
    background: #fff5e6;
    color: #FF6F0F;
}

.sort-option-text {
    font-size: 14px;
}

.sort-option-icon {
    font-size: 12px;
    margin-left: 8px;
}
