/**
 * 최근본 상품 스타일
 * 
 * MainScreen.tsx의 ProductCard 스타일을 웹 버전으로 구현
 */

:root {
    --primary-color: #C97D7E;
    --primary-hover: #b86d6e;
    --secondary-color: #D4A574;
    --background: #FFFFFF;
    --surface: #F8F9FA;
    --text-primary: #2d2d2d;
    --text-secondary: #666666;
    --border: #E0E0E0;
    --success-color: #4CAF50;
    --error-color: #f44336;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* 본문(col-8) / 우측 사이드바(col-4) 레이아웃 */
.main-content-area {
    margin-bottom: 24px;
}

/* 로그인/비로그인 동일하게 본문과 우측 사이드바 상단 정렬 유지 (padding-top 제거) */
.main-content-inner {
    padding-bottom: 24px;
}

.recent-products-sidebar {
    margin-bottom: 24px;
    padding-left: 0;
    padding-right: 0;
}

@media (min-width: 992px) {
    .recent-products-sidebar {
        position: sticky;
        top: 80px;
    }
}

/* 최근본 상품 섹션 */
.recent-products-section,
.featured-products-section {
    background: var(--background);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 24px;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    box-shadow: none;
}

/* 주목할 제품 섹션: 위쪽 여백 */
.featured-products-section {
    margin-top: 24px;
}

/* 섹션 헤더 */
.recent-products-header,
.featured-products-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.recent-products-header h2,
.featured-products-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

/* 로딩 오버레이 */
#recentProductsLoading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
}

#recentProductsLoading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

#recentProductsLoading .loading-text {
    color: var(--text-secondary);
    font-size: 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 에러 메시지 */
#recentProductsError {
    display: none;
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    margin: 20px 0;
}

#recentProductsError .error-message {
    color: #856404;
    font-size: 14px;
    margin: 0;
}

/* 빈 상태 메시지 */
#recentProductsEmpty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 200px;
    text-align: center;
}

#recentProductsEmpty .empty-icon {
    font-size: 50px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

#recentProductsEmpty .empty-message-text {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-line;
}

/* 대상 없음 안내 */
#recentProductsNoTarget {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 180px;
    text-align: center;
}

#recentProductsNoTarget .empty-icon {
    font-size: 40px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

#recentProductsNoTarget .empty-message-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* 제품 목록 */
#recentProductsList,
#featuredProductsList {
    display: none;
}

/* 공용 카드 스타일 (검색 결과 등) */
.product-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-card:hover {
    border-color: var(--primary-color);
    border-width: 2px;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* 우측 사이드바 카드: 상품별 테두리 제거, 상품 사이 점선 구분, 여백 축소 */
#recentProductsList .product-card,
#featuredProductsList .product-card {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
    padding: 10px;
    gap: 12px;
    border-bottom: 1px dashed var(--border);
}

#recentProductsList .product-card:last-child,
#featuredProductsList .product-card:last-child {
    border-bottom: none;
}

#recentProductsList .product-card:hover,
#featuredProductsList .product-card:hover {
    border-width: 0;
    border-bottom: 1px dashed var(--border);
    background: var(--surface);
    transform: none;
}

#recentProductsList .product-card:last-child:hover,
#featuredProductsList .product-card:last-child:hover {
    border-bottom: none;
}

/* 제품 이미지 컨테이너 (기본: 검색 결과 등) */
.product-image-container {
    position: relative;
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}

/* 우측 사이드바: PC에서 이미지 축소 */
@media (min-width: 992px) {
    #recentProductsList .product-image-container,
    #featuredProductsList .product-image-container {
        width: 52px;
        height: 52px;
        border-radius: 6px;
    }
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.product-image-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--primary-color);
}

.product-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--border);
    font-size: 24px;
}

/* 제품 정보 */
.product-info {
    flex: 1;
    min-width: 0;
}

.product-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.product-status-badge {
    display: inline-block;
    padding: 4px 8px;
    background: #ffebee;
    color: #c62828;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 제품 메타 정보 행 */
.product-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.product-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.product-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 1;
}

/* 최근 분석된 제품·검색 결과·주목할 제품 카드 태그: 연한 핑크 배경 + 붉은 계통 테두리·글자색 */
.recent-products-section .tag-chip,
.featured-products-section .tag-chip,
.product-tags .tag-chip {
    font-size: 12px;
    line-height: 1.2;
    color: var(--primary-color);
    background: rgba(201, 125, 126, 0.08);
    border: 1px solid rgba(201, 125, 126, 0.45);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* 점수 및 만족도 행 */
.product-scores-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.compatibility-score {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.compatibility-score .score-label {
    font-size: 13px;
}

.compatibility-score .fas.fa-star {
    color: #FFD700;
    font-size: 11px;
}

.compatibility-score .score-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.satisfaction-stats {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .recent-products-section,
    .featured-products-section {
        padding: 16px;
    }
    
    .product-card {
        padding: 12px;
        gap: 12px;
    }
    
    .product-image-container {
        width: 60px;
        height: 60px;
    }
    
    .product-name {
        font-size: 14px;
    }
    
    .product-price {
        font-size: 13px;
    }
    
    .product-meta-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .product-tags {
        justify-content: flex-start;
    }
}
