/**
 * @name: product.css
 * @description: 產品展示頁面樣式
 * @version: 1.0.0
 * @author: Baiya Wang
 * @date: 2025-01-31
 */

/* ============================
   產品頁面主容器
   ============================ */
.product-page {
    max-width: 1200px;
}

/* 取消產品頁面卡片的懸停晃動效果 */
.product-page .card-custom:hover {
    transform: none;
}

/* ============================
   語系標籤 (業務/管理者可見)
   ============================ */
.product-languages {
    font-size: 0.75rem;
}

.product-lang-badge {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.2rem 0.4rem;
    min-width: 28px;
    text-align: center;
    transition: all 0.2s ease;
}

.product-lang-badge.clickable {
    cursor: pointer;
}

.product-lang-badge.clickable:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.product-lang-badge.bg-secondary {
    opacity: 0.5;
    cursor: not-allowed;
}

.product-lang-badge.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* 語系指示器 */
.lang-indicator {
    font-size: 0.6rem !important;
    vertical-align: middle;
}

/* ============================
   標題區
   ============================ */
.product-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-color);
}

.product-model {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ============================
   產品圖片區
   ============================ */
.product-gallery {
    position: sticky;
    top: 1rem;
}

.product-main-image {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-main-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-main-image:hover img {
    transform: scale(1.02);
}

/* 縮圖列表 */
.product-thumbnails {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.product-thumb-item {
    width: 70px;
    height: 70px;
    border: 2px solid var(--border-color);
    border-radius: 0.375rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: var(--card-bg);
}

.product-thumb-item:hover {
    border-color: var(--primary-color);
}

.product-thumb-item.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.25);
}

.product-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ============================
   產品資訊區
   ============================ */
.product-info {
    padding: 0 1rem;
}

.product-tags .badge {
    font-weight: 400;
    border: 1px solid var(--border-color);
}

.product-basic-specs th {
    color: var(--text-muted);
    font-weight: 500;
    vertical-align: middle;
}

.product-basic-specs td {
    vertical-align: middle;
}

.product-summary h5,
.product-summary h6,
.product-documents h5,
.product-documents h6 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

/* 產品簡介內容 (支援 HTML) */
.product-summary-content {
    line-height: 1.7;
    color: var(--text-color);
}

.product-summary-content p {
    margin-bottom: 0.5rem;
}

.product-summary-content p:last-child {
    margin-bottom: 0;
}

.product-summary-content ul,
.product-summary-content ol {
    padding-left: 1.25rem;
    margin-bottom: 0.5rem;
}

.product-summary-content a {
    color: var(--primary-color);
}

.product-summary-content a:hover {
    text-decoration: underline;
}

/* ============================
   下載區塊
   ============================ */
.product-downloads h6 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

/* 下載頁籤樣式 */
.nav-tabs-downloads {
    border-bottom: 1px solid var(--border-color);
    gap: 0;
}

.nav-tabs-downloads .nav-link {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-tabs-downloads .nav-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--border-color);
}

.nav-tabs-downloads .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: none;
}

.nav-tabs-downloads .nav-link i {
    font-size: 1rem;
}

.nav-tabs-downloads .nav-link .badge {
    font-size: 0.65rem;
    padding: 0.15em 0.45em;
    font-weight: 500;
    opacity: 0.7;
}

/* 下載列表樣式 */
.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0;
}

.download-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 0.375rem;
    transition: all 0.15s ease;
}

.download-item:hover {
    background-color: var(--hover-bg, rgba(0, 0, 0, 0.04));
    color: var(--primary-color);
}

.download-item-icon {
    font-size: 1.25rem;
    color: var(--primary-color);
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}

.download-item-title {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.download-item-action {
    font-size: 0.875rem;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.download-item:hover .download-item-action {
    opacity: 1;
}

/* 影片列表 */
.video-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 0;
}

/* 影片內嵌播放器卡片 */
.video-embed-card {
    width: 280px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.video-embed-card:hover {
    border-color: #ff0000;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.1);
}

/* 影片預覽 (點擊前) */
.video-embed-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    cursor: pointer;
    overflow: hidden;
}

.video-embed-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-embed-preview:hover img {
    transform: scale(1.05);
}

.video-embed-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
    pointer-events: none;
}

.video-embed-preview:hover .video-embed-play {
    color: #ff0000;
    transform: translate(-50%, -50%) scale(1.1);
}

/* 影片播放中 (iframe) */
.video-embed-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
}

.video-embed-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* 影片資訊列 */
.video-embed-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.video-embed-title {
    flex: 1;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-embed-info .download-count {
    font-size: 0.7rem;
    margin-left: auto;
}

/* 品牌型號區 */
.product-brand-model {
    font-size: 1rem;
}

/* 價格庫存區 */
.product-price-stock {
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
}

/* 操作按鈕 */
.product-actions .btn {
    min-width: 140px;
}

/* 關注按鈕 */
#btnAddToWishlist {
    min-width: auto;
    padding: 0.5rem 1rem;
}

#btnAddToWishlist:hover .bi-heart,
#btnAddToWishlist.active .bi-heart {
    color: #dc3545;
}

#btnAddToWishlist.active .bi-heart::before {
    content: "\f415";
}

/* ============================
   規格表格
   ============================ */
.product-spec-table {
    margin-bottom: 0;
    color: var(--text-secondary);
}

.product-spec-table th {
    width: 40%;
    font-weight: 700;
    color: #212529;
    background-color: rgba(0, 0, 0, 0.02);
    vertical-align: middle;
    white-space: nowrap;
    border-color: var(--border-color);
}

.product-spec-table td {
    vertical-align: middle;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

/* 黑夜模式表格樣式 */
[data-theme="dark"] .product-spec-table {
    color: var(--text-secondary);
}

[data-theme="dark"] .product-spec-table th {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    font-weight: 700;
}

[data-theme="dark"] .product-spec-table td {
    color: var(--text-secondary);
}

/* 條紋表格黑夜模式 */
[data-theme="dark"] .product-spec-table.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

/* ============================
   產品描述區
   ============================ */
.product-description {
    line-height: 1.8;
    color: var(--text-color);
}

.product-description p {
    margin-bottom: 1rem;
}

.product-description ul,
.product-description ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.product-description li {
    margin-bottom: 0.5rem;
}

/* ============================
   迷你產品卡片 (同類/推薦)
   ============================ */
.product-card-mini {
    display: block;
    text-decoration: none;
    color: var(--text-color);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.product-card-mini:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    color: var(--text-color);
}

.product-card-mini-image {
    width: 100%;
    height: 120px;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-card-mini-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-card-mini-info {
    padding: 0.5rem;
    text-align: center;
}

.product-card-mini-model {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    margin: 0;
}

/* ============================
   推薦產品輪播
   ============================ */
.product-carousel {
    position: relative;
    user-select: none;
}

.product-carousel-viewport {
    overflow: hidden;
    border-radius: 0.375rem;
}

.product-carousel-track {
    display: flex;
    will-change: transform;
}

.product-carousel-track.animating {
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.product-carousel-item {
    flex: 0 0 25%;
    min-width: 0;
    padding: 0.375rem;
    box-sizing: border-box;
}

.product-carousel-item .product-card-mini {
    height: 100%;
}

/* ============================
   響應式調整
   ============================ */
@media (max-width: 1199.98px) {
    .product-carousel-item {
        flex: 0 0 33.333%;
    }
}

@media (max-width: 991.98px) {
    .product-gallery {
        position: static;
        margin-bottom: 2rem;
    }

    .product-info {
        padding: 0;
    }

    .product-title {
        font-size: 1.5rem;
    }

    .product-carousel-item {
        flex: 0 0 33.333%;
    }
}

@media (max-width: 767.98px) {
    .product-title {
        font-size: 1.25rem;
    }

    .product-actions .btn {
        width: 100%;
        min-width: auto;
    }

    .product-thumb-item {
        width: 60px;
        height: 60px;
    }

    .product-spec-table th {
        width: 35%;
        font-size: 0.875rem;
    }

    .product-spec-table td {
        font-size: 0.875rem;
    }

    .product-carousel-item {
        flex: 0 0 50%;
    }
}

@media (max-width: 479.98px) {
    .product-carousel-item {
        flex: 0 0 50%;
    }
}

/* ============================
   列印樣式
   ============================ */
@media print {
    .product-gallery {
        position: static;
    }

    .product-actions,
    .product-thumbnails {
        display: none;
    }

    .product-main-image {
        border: none;
        page-break-inside: avoid;
    }

    .card-custom {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}
