/**
 * Review Module CSS v2.0 - 中央評論模組樣式
 * 
 * 從 index-review.html / review-card.html 提取的所有樣式
 * 無 inline style，全部由 CSS 管理
 */

/* ============================================
   CSS 變數（統一命名）
   ============================================ */
:root {
    --avatar-size: 40px;
    --layout-gap: 12px;
    --breakout-offset: calc(var(--avatar-size) + var(--layout-gap));
}

/* ============================================
   評論卡片（.review-li）
   ============================================ */
.review-li {
    background-color: #ffffff;
    margin-bottom: 12px;
    padding: 15px 20px !important;
    border-radius: 0;
    border-bottom: none !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

/* 電腦版圓角與間距 */
@media (min-width: 962px) {
    .review-li {
        border-radius: 12px;
        margin-bottom: 20px;
    }
}

/* ============================================
   左側：頭像區
   ============================================ */
.review-left {
    flex-shrink: 0;
}

.review-user-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.review-user-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   右側：內容區
   ============================================ */
.review-right {
    flex-grow: 1;
    min-width: 0;
}

/* ============================================
   Header 區塊
   ============================================ */
.review-header-row {
    margin-bottom: 4px;
}

/* 第一行：用戶名與時間 */
.review-header-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.user-name {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    padding-top: 0;
    padding-bottom: 0;
}

.user-verified-badge {
    display: inline-flex;
    line-height: 1;
    flex-shrink: 0;
}

.user-verified-badge svg {
    width: 12px;
    height: 12px;
}

.review-time {
    font-size: 13px;
    color: #999;
}

/* 麵包屑導航 */
.review-breadcrumb {
    font-size: 15px;
    line-height: 1.5;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.review-breadcrumb a {
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
}

.bc-arrow {
    color: #999;
    margin: 0 4px;
    transform: rotate(-90deg);
}

/* ============================================
   評分區
   ============================================ */
.review-rating-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
    font-size: 13px;
}

.rating-score {
    font-weight: bold;
    color: #333;
}

.product-rate {
    color: #ffb400;
    display: flex;
}

.product-rate i {
    font-size: 12px;
}

/* 真實購買徽章 */
.genuine-badge {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 500;
    color: #1a9661;
    background-color: #e3f9e9;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #c8f0d3;
    margin-left: 2px;
    height: 18px;
    line-height: 1;
}

.genuine-badge i {
    font-size: 10px;
    margin-right: 3px;
}

/* ============================================
   分項評分（方案 B：div + flex）
   ============================================ */

.dimension-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    margin: 4px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
}

.dimension-list:active {
    cursor: grabbing;
}

.dimension-list::-webkit-scrollbar {
    display: none;
}

.dimension-item {
    flex-shrink: 0;          /* 關鍵：防止壓縮 */
    display: flex;
    align-items: center;
    padding: 3px 8px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

/* ============================================
   評論內容
   ============================================ */
.review-content-box {
    margin: 8px 0;
}

.review-content {
    font-size: 15px !important;
    line-height: 1.6 !important;
    color: #1a1a1a !important;
    font-weight: 400 !important;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
    text-align: justify;
    text-justify: inter-ideograph;
}

/* 手機版摺疊 */
.review-content.mobile-collapse {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 6.4em;
    transition: max-height 0.3s ease;
}

.review-content.mobile-collapse.expanded {
    -webkit-line-clamp: unset;
    max-height: none;
    overflow: visible;
}

.read-more-btn {
    font-size: 14px;
    color: #888;
    margin-top: 5px;
    cursor: pointer;
    font-weight: 500;
    display: none;
}

.read-more-btn:active {
    color: #333;
}

/* 電腦版：預設展開，隱藏摺疊效果 */
@media (min-width: 769px) {
    .review-content.mobile-collapse {
        display: block !important;
        -webkit-line-clamp: unset !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .read-more-btn {
        display: none !important;
    }
}

/* ============================================
   圖片區域
   ============================================ */
.review-gallery-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #f0f0f0;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    background-color: #f9f9f9;
}

.review-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.review-gallery-item:hover img {
    transform: scale(1.05);
}

/* 隱形佔位符（手機版用） */
.gallery-spacer {
    display: none;
    flex-shrink: 0;
}

/* =========================================
   電腦版樣式 (Desktop)
   ========================================= */
@media (min-width: 769px) {
    .review-images {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 0;
        margin-bottom: 0;
    }

    .review-gallery-item {
        width: 120px;
        height: 120px;
    }
}

/* =========================================
   手機版樣式 (Mobile)
   ========================================= */
@media (max-width: 768px) {
    .review-images {
        display: flex;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        gap: 0;
        justify-content: flex-start !important;
        margin-left: calc(-1 * var(--breakout-offset)) !important;
        width: calc(100% + var(--breakout-offset)) !important;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 5px;
        margin-top: 10px;
        margin-bottom: 5px;
        padding-right: 20px;
    }

    .review-images::-webkit-scrollbar {
        display: none;
    }

    /* 啟用隱形佔位符 */
    .gallery-spacer {
        display: block !important;
        width: var(--breakout-offset) !important;
        min-width: var(--breakout-offset) !important;
        flex-shrink: 0 !important;
        height: 1px;
        scroll-snap-align: start;
        scroll-margin-left: 0;
    }

    .review-gallery-item {
        scroll-snap-align: start;
        margin-right: 8px;
        width: 150px;
        height: 200px;
    }
}

/* ============================================
   底部操作區
   ============================================ */
.review-action {
    display: flex;
    gap: 20px;
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

.review-action .icon,
.review-action a {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.review-action .icon i {
    font-size: 16px;
}

.review-action .icon.active {
    color: var(--theme-color);
}

/* 分享選單 */
.product-share-icon {
    position: relative;
}

.open-share {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 10px;
    min-width: 150px;
    z-index: 100;
}

.open-share.active {
    display: block;
}

.modal2-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.modal2-btn:hover {
    background: #f5f5f5;
}

.modal2-close {
    text-align: center;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid #eee;
}

/* 回覆按鈕 */
.post_a_review {
    margin-left: auto;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid #ddd;
    cursor: pointer;
}

.post_a_review:hover {
    border-color: var(--theme-color);
}

/* 評論連結 */
.review-comment-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}