/* ================================
   產品圖片展示 - 垂直卡片布局
   優化手機端體驗，清楚展示每張圖片說明
   ================================ */

/* 主容器 */
.product-gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 產品頭部信息 */
.product-header-info {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.product-breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #6c757d;
}

.category-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.separator {
    color: #adb5bd;
}

.product-count {
    font-weight: 500;
}

.main-product-title {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin: 0;
    line-height: 1.3;
    background: linear-gradient(135deg, #333 0%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 圖片卡片列表 */
.gallery-cards {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 單張圖片卡片 */
.image-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(30px);
}

.image-card.animate-in {
    animation: slideInUp 0.8s ease-out forwards;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* 奇數卡片反向布局 */
.image-card:nth-child(even) {
    grid-template-columns: 1fr 1fr;
}

.image-card:nth-child(even) .image-section {
    order: 2;
}

.image-card:nth-child(even) .content-section {
    order: 1;
}

/* 圖片區域 - 16:9比例統一顯示 */
.image-section {
    position: relative;
    background: #f8f9fa;
    overflow: hidden;
}

.image-wrapper {
    position: relative;
    width: 100%;
    /* 16:9 比例 = (9/16) * 100% = 56.25% */
    padding-bottom: 56.25%;
    overflow: hidden;
    border-radius: 12px;
    margin: 20px;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

/* 只針對產品展示頁面的圖片 */
.product-gallery-container .product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* 改為 cover 來填滿 16:9 容器 */
    object-position: center; /* 居中顯示 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.product-gallery-container .product-image:hover {
    transform: scale(1.02);
}

/* 圖片縮放提示 */
.image-zoom-hint {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.image-wrapper:hover .image-zoom-hint {
    opacity: 1;
}

/* 只針對產品展示頁面的燈箱觸發 */
.product-gallery-container .lightbox-trigger {
    cursor: zoom-in;
}

/* 其他頁面的燈箱觸發保持原有cursor */
.lightbox-trigger {
    cursor: zoom-in;
}

/* 燈箱樣式 */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-container {
    position: relative;
    width: 80%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    animation: lightboxZoomIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-overlay.active .lightbox-container {
    animation: lightboxZoomIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100% - 60px); /* 留空間給標題 */
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    cursor: zoom-out;
}

.lightbox-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-top: 20px;
    padding: 0 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* 燈箱動畫 */
@keyframes lightboxZoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* 燈箱響應式設計 */
@media (max-width: 768px) {
    .lightbox-container {
        width: 95%;
        height: 90%;
    }
    
    .lightbox-close {
        top: -40px;
        right: -10px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-title {
        font-size: 16px;
        margin-top: 15px;
    }
    
    .image-zoom-hint {
        width: 35px;
        height: 35px;
        top: 10px;
        right: 10px;
    }
    
    .image-zoom-hint svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .lightbox-container {
        width: 98%;
        height: 85%;
    }
    
    .lightbox-image {
        max-height: calc(100% - 50px);
    }
    
    .lightbox-title {
        font-size: 14px;
        margin-top: 10px;
    }
    
    .lightbox-close {
        top: -35px;
        right: 0;
        width: 35px;
        height: 35px;
    }
    
    .lightbox-close svg {
        width: 20px;
        height: 20px;
    }
}

/* 內容區域 */
.content-section {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.content-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 圖片標題 */
.image-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 20px 0;
    line-height: 1.3;
    background: linear-gradient(135deg, #333 0%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 圖片說明 */
.image-description {
    margin-bottom: 25px;
}

.image-description p {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin: 0;
}

/* 標籤區域 */
.image-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag.main-image {
    background: linear-gradient(135deg, #C41E3A 0%, #8B0000 100%);
    color: white;
}

.tag.detail-image {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* 聯絡我們區域 */
.gallery-footer {
    margin-top: 50px;
}

.contact-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    color: white;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.contact-content h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.contact-content p {
    font-size: 16px;
    margin: 0 0 25px 0;
    opacity: 0.9;
}

.contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.contact-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.6s;
}

.contact-btn:hover::before {
    left: 100%;
}

.contact-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    color: white;
}

/* 動畫效果 */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 響應式設計 - 平板 */
@media (max-width: 1024px) {
    .product-gallery-container {
        padding: 15px;
    }
    
    .image-card {
        gap: 20px;
    }
    
    .content-section {
        padding: 30px;
    }
    
    .image-section {
        /* 平板維持16:9比例 */
    }
    
    .main-product-title {
        font-size: 28px;
    }
    
    .image-title {
        font-size: 20px;
    }
}

/* 響應式設計 - 手機 */
@media (max-width: 768px) {
    .image-card {
        grid-template-columns: 1fr !important;
        gap: 0;
    }
    
    .image-card:nth-child(even) .image-section {
        order: 1;
    }
    
    .image-card:nth-child(even) .content-section {
        order: 2;
    }
    
    .image-section {
        /* 手機版維持16:9比例 */
    }
    
    .content-section {
        padding: 25px 20px;
    }
    
    .product-header-info {
        padding: 25px 15px;
        margin-bottom: 30px;
    }
    
    .main-product-title {
        font-size: 24px;
    }
    
    .image-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .image-description p {
        font-size: 15px;
    }
    
    .gallery-cards {
        gap: 20px;
    }
    
    .contact-card {
        padding: 30px 20px;
    }
    
    .contact-content h3 {
        font-size: 20px;
    }
    
    .contact-content p {
        font-size: 14px;
    }
    
    .contact-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .product-breadcrumb {
        flex-direction: column;
        gap: 8px;
    }
    
    .category-tag {
        font-size: 11px;
    }
}

/* 極小螢幕優化 */
@media (max-width: 480px) {
    .product-gallery-container {
        padding: 10px;
    }
    
    .image-section {
        /* 極小螢幕維持16:9比例 */
    }
    
    .image-wrapper {
        margin: 15px; /* 調整邊距 */
    }
    
    .content-section {
        padding: 20px 15px;
    }
    
    .main-product-title {
        font-size: 20px;
    }
    
    .image-title {
        font-size: 16px;
    }
    
    .image-description p {
        font-size: 14px;
        line-height: 1.5;
    }
    
    
    .tag {
        padding: 4px 8px;
        font-size: 10px;
    }
}

/* 備用顯示樣式 - 當沒有圖片時 */
.no-carousel-fallback {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.fallback-image {
    position: relative;
    background: #f8f9fa;
    overflow: hidden;
    border-radius: 12px;
}

.fallback-image::before {
    content: '';
    display: block;
    /* 16:9 比例 */
    padding-bottom: 56.25%;
}

.fallback-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.fallback-image {
    position: relative;
}

/* 備用顯示和產品列表頁面的統一圖片縮放提示樣式 */

.fallback-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
}

.fallback-info .product-category {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.fallback-info .category-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.fallback-info .category-name {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    font-size: 16px;
}

.fallback-info h1 {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.3;
    background: linear-gradient(135deg, #333 0%, #667eea 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.fallback-info .product-description {
    margin-bottom: 30px;
}

.fallback-info .product-description p {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin: 0;
}

.fallback-info .contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: fit-content;
}

.fallback-info .contact-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
}

/* 備用顯示響應式 */
@media (max-width: 768px) {
    .no-carousel-fallback {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 20px;
    }
    
    .fallback-info {
        padding: 25px 0 0 0;
    }
    
    .fallback-info h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .fallback-info .product-description p {
        font-size: 15px;
    }
    
    .fallback-info .contact-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
}

/* 暗色主題支持（可選） */
@media (prefers-color-scheme: dark) {
    .product-header-info {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        color: #f7fafc;
    }
    
    .main-product-title {
        background: linear-gradient(135deg, #f7fafc 0%, #667eea 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .image-card {
        background: #2d3748;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .content-section {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    }
    
    .image-title {
        background: linear-gradient(135deg, #f7fafc 0%, #667eea 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .image-description p {
        color: #e2e8f0;
    }
}
