/* ============================================
   Customer Reviews 樣式（完整修正版）
   ============================================ */

/* ⭐ 確保評論容器有完整寬度 */
#review-summary,
#reviews-list {
    width: 100%;
    box-sizing: border-box;
}

.review-summary-container {
    display: flex;
    gap: 40px;
    margin-bottom: 10px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    width: 100%; /* ⭐ 繼承父容器完整寬度 */
    box-sizing: border-box; /* ⭐ padding 不影響總寬度 */
}

.average-rating {
    text-align: center;
    min-width: 150px;
}

.rating-number {
    font-size: 48px;
    font-weight: bold;
    color: #ff6b6b;
    margin-bottom: 8px;
}

/* ⭐ 星星橫向顯示 */
.rating-stars-horizontal,
.review-rating-horizontal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 20px;
    color: #ffc107;
    margin-bottom: 8px;
}

.review-rating-horizontal {
    justify-content: flex-start;
    font-size: 16px;
    margin-bottom: 10px;
}

.rating-stars-horizontal ion-icon,
.review-rating-horizontal ion-icon {
    display: inline-block;
}

.rating-count {
    font-size: 14px;
    color: #666;
}

.rating-breakdown {
    flex: 1;
    min-width: 0; /* ⭐ 加這行，讓 flex 子元素正確計算 */
}

.rating-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.rating-label {
    width: 50px;
    font-size: 13px;
    color: #666;
}

/* ⭐ 進度條容器 */
.rating-bar {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    min-width: 0; /* ⭐ 加這行 */
}

/* ⭐ 進度條填充（帶動畫） */
.rating-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffc107 0%, #ff9800 100%);
    border-radius: 4px;
    transition: width 1s ease-out;
    width: 0; /* 初始為 0，由 JS 動態設定 */
}

.rating-bar-fill.animate {
    /* 由 JS 動態設定 width */
}

.rating-percentage {
    width: 40px;
    text-align: right;
    font-size: 13px;
    color: #666;
}

/* ⭐ 評論列表：固定顯示 3 格，多出可捲動 */
#reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(200px * 3 + 40px); /* 3 個評論的高度 + 間距 */
    overflow-y: auto;
    padding-right: 10px;
}

/* 自定義捲軸樣式 */
#reviews-list::-webkit-scrollbar {
    width: 8px;
}

#reviews-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#reviews-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#reviews-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.review-item {
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    min-height: 160px;
    flex-shrink: 0;
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.reviewer-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reviewer-name {
    font-weight: 600;
    color: #333;
}

.verified-badge {
    font-size: 12px;
    color: #4caf50;
    background: #e8f5e9;
    padding: 2px 8px;
    border-radius: 12px;
}

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

/* ⭐ 評論文字 */
.review-text {
    line-height: 1.6;
    color: #555;
    word-wrap: break-word;
}

.no-reviews {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 響應式 */
@media (max-width: 768px) {
    .review-summary-container {
        flex-direction: column;
        gap: 20px;
        padding: 15px;
    }
    
    /* 手機版調整平均分區塊 */
    .average-rating {
        min-width: auto;
    }
    
    .rating-number {
        font-size: 36px;
    }
    
    .rating-stars-horizontal {
        font-size: 18px;
    }
    
    .rating-count {
        font-size: 13px;
    }
    
    /* 手機版進度條區塊 */
    .rating-bar-row {
        gap: 8px;
        margin-bottom: 6px;
    }
    
    .rating-label {
        width: 45px;
        font-size: 12px;
    }
    
    .rating-bar {
        height: 6px;
    }
    
    .rating-percentage {
        width: 35px;
        font-size: 12px;
    }
    
    /* 手機版評論列表 */
    #reviews-list {
        max-height: calc(180px * 3 + 40px);
        padding-right: 5px;
        gap: 15px;
    }
    
    .review-item {
        min-height: 140px;
        padding: 15px;
    }
    
    .review-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        margin-bottom: 8px;
    }
    
    .reviewer-name {
        font-size: 14px;
    }
    
    .verified-badge {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .review-date {
        font-size: 12px;
    }
    
    .review-rating-horizontal {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .review-text {
        font-size: 14px;
        line-height: 1.5;
    }
}

/* 極小螢幕 */
@media (max-width: 480px) {
    .review-summary-container {
        padding: 10px;
        gap: 15px;
    }
    
    .rating-number {
        font-size: 32px;
    }
    
    .rating-stars-horizontal {
        font-size: 16px;
    }
    
    #reviews-list {
        max-height: calc(160px * 3 + 30px);
    }
    
    .review-item {
        min-height: 120px;
        padding: 12px;
    }
    
    .review-text {
        font-size: 13px;
    }
}