/* results.html 專屬樣式 */

/* 頁面佈局 */
.results-container {
    padding: 24px 16px calc(60px + max(8px, env(safe-area-inset-bottom)));
    margin: 0 auto;
    max-width: 1200px;
    width: 100%;
}

.product-section {
    margin-bottom: 32px;
}

.product-section h2 {
    font-size: 24px;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.section-description {
    color: var(--text-secondary);
    margin: 0;
    font-size: 14px;
}

.products-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin: 24px 0;
    width: 100%;
}

/* 產品卡片優化樣式 */
.product-card {
    display: flex;
    flex-direction: row;
    border-radius: var(--radius-lg);
    background-color: white;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    width: 100%;
    min-height: 240px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.product-card:hover {
    box-shadow: var(--shadow-md);
}

.product-card img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    background: transparent;
    border: none;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.product-card img:hover {
    transform: scale(1.05);
}

.product-info {
    padding: 32px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 16px;
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 0;
}

.product-title-section {
    flex: 1;
    min-width: 0;
}

.product-price-section {
    flex-shrink: 0;
    text-align: right;
    min-width: 100px;
}

.product-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
}

.product-brand {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

.product-price {
    color: var(--primary);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

.product-rating {
    color: #FFB800;
    font-size: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 2px;
    margin-top: 4px;
}

.product-description {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.product-action {
    margin-top: auto;
    padding-top: 16px;
}

/* 聯盟行銷購買按鈕優化樣式 */
.product-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 16px;
}

.purchase-button-container {
    flex: 1;
}

.promo-info {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 4px;
    font-weight: 500;
}

.promo-info i {
    margin-right: 4px;
}

.btn-outline {
    background: #FFC04B;
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(255, 192, 75, 0.2);
    width: 100%;
    gap: 8px;
    height: 48px;
}

.btn-outline i {
    font-size: 18px;
}

.btn-outline:hover {
    background: #ffb52e;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 192, 75, 0.3);
}

.btn-outline:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(255, 192, 75, 0.2);
}

/* 產品詳情彈窗中的購買區域 */
.detail-purchase-section {
    margin: 16px 0;
}

.detail-purchase-section .purchase-button-container {
    margin-bottom: 8px;
}

.detail-purchase-section .promo-info {
    font-size: 14px;
    background: #fff5f5;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid #e74c3c;
}

/* 為固定底部導航留出空間 */
body {
    margin: 0;
    min-height: 100vh;
}

/* 確保主要內容不被遮擋 */
.results-container {
    padding: 0 16px 20px;
    margin: 0 auto;
    max-width: 1200px;
    width: 100%;
}

/* 產品按鈕對齊樣式 */
.product-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.button-row {
    width: 100%;
}

.button-row .purchase-button-container,
.button-row .btn-outline {
    width: 100%;
    display: block;
    text-align: center;
}

.button-row .purchase-button-container a {
    width: 100%;
    display: block;
}

/* 產品圖片樣式優化 */
.product-image img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: transparent;
    transition: transform 0.2s ease;
}

.product-image img:hover {
    transform: scale(1.05);
}

/* 產品詳情圖片樣式 */
.product-detail-image {
    width: 100%;
    max-width: 300px;
    height: 300px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: transparent;
}

/* 時間軸和注意事項樣式修復 */
.timeline-container, .cautions-container {
    padding: 0 20px;
    margin-bottom: 30px;
}

.time-point {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.time-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.time-header i {
    font-size: 20px;
    color: var(--primary);
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.time-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.time-info .time {
    margin: 0;
    font-size: 12px;
    color: var(--text-light);
}

.time-products {
    margin-top: 8px;
}

.time-products p {
    margin: 0;
    font-size: 14px;
    color: var(--text-medium);
    line-height: 1.4;
}

.caution-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.caution-item i {
    font-size: 18px;
    color: #e74c3c;
    margin-right: 12px;
    margin-top: 2px;
    flex-shrink: 0;
}

.caution-item div h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.caution-item div p {
    margin: 0;
    font-size: 13px;
    color: var(--text-medium);
    line-height: 1.4;
}

/* 模態框樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* 防止背景滾動 - 修正版本，不影響 fixed 定位 */
body.modal-open {
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: none;
}

/* 確保模態框開啟時，tab-bar 仍然保持固定 */
body.modal-open .tab-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1002 !important;
}

.modal-content {
    background-color: white;
    margin: 2% auto 2% auto;
    padding: 0;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: none;
    min-height: 200px;
    overflow: visible;
    position: relative;
    display: block;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    background: rgba(255,255,255,0.9);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: background-color 0.2s ease;
}

.close-modal:hover {
    background: rgba(255,255,255,1);
}

.modal-body {
    padding: 20px;
    overflow: visible;
}

/* 產品詳情樣式 */
.product-detail-header {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.product-detail-image {
    width: 150px;
    height: 150px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: transparent;
    flex-shrink: 0;
}

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

.product-detail-info h2 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.detail-brand {
    margin: 0 0 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.detail-rating {
    margin: 0 0 8px 0;
    color: #FFB800;
}

.detail-price {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.product-detail-description {
    margin-bottom: 20px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.detail-section p {
    margin: 0;
    line-height: 1.5;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.detail-section ul {
    margin: 0;
    padding-left: 20px;
}

.detail-section li {
    margin-bottom: 4px;
    line-height: 1.4;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* 確保cautions相關樣式 */
.cautions-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}
    
.cautions-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #F5B17B;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    color: white;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(245, 177, 123, 0.3);
}
    
.cautions-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}
    
.cautions-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
    
.cautions-card {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease;
}
    
.cautions-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
    
.cautions-card-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
}
    
.cautions-card-header i {
    margin-right: 8px;
    color: var(--primary);
    font-size: 16px;
}
    
.cautions-card-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.special-note {
    padding: 12px 16px;
    background-color: #f7f8fc;
}

.special-note i {
    color: #7B91D3;
    margin-right: 8px;
    margin-top: 3px;
    flex-shrink: 0;
}

/* 確保interactions-cautions和專業背書與免責聲明之間有足夠間距 */
.cautions-card.interactions-cautions {
    margin-bottom: 20px;
}



/* 響應式設計 - 手機版 */
@media (max-width: 767px) {
    .product-actions {
        gap: 12px;
    }
    
    .button-row {
        width: 100%;
    }
    
    body {
        padding-bottom: calc(60px + max(8px, env(safe-area-inset-bottom))) !important; /* 與其他頁面一致 */
    }
    
    .timeline-container, .cautions-container {
        padding: 0 16px;
    }
    
    .time-point, .caution-item {
        padding: 12px;
        margin-bottom: 12px;
    }

    .product-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }
    
    .product-detail-image {
        width: 120px;
        height: 120px;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto 5% auto;
        max-height: none;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .product-detail-info h2 {
        font-size: 16px;
    }
}

/* 平板和桌面版排版 */
@media (min-width: 768px) {
    .product-card {
        flex-direction: row;
    }
    
    .product-card img {
        width: 200px;
        height: 200px;
        border: none;
    }
    
    .product-info {
        flex: 1;
        width: calc(100% - 200px);
    }
    
    .product-actions {
        flex-direction: row;
        gap: 12px;
    }
    
    .button-row {
        flex: 1;
    }
}