/* ================================
   設計大師級產品展示樣式
   靈感來源：Apple, Behance, Dribbble
   設計理念：極簡主義 + 新型態主義 + 玻璃質感
   ================================ */

/* 產品網格容器 - 現代化布局 */
.products-page .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 40px;
    padding: 40px 0;
}

/* 產品卡片 - 設計大師風格 - 更高優先級 */
.products-page .products-grid .product-card {
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.products-page .product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.05) 50%, 
        rgba(0, 0, 0, 0.02) 100%);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

.product-card:hover {
    transform: translateY(-12px) rotateX(5deg);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.5);
}

.products-page .product-card:hover::before {
    opacity: 1;
}

/* 圖片容器 - 重新設計 - 高優先級 */
.products-page .products-grid .product-card .product-image {
    position: relative;
    overflow: hidden;
    /* 調整為 4:3 比例，更適合產品展示 */
    padding-bottom: 75% !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-radius: 20px 20px 0 0 !important;
}

.product-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        transparent 0%, 
        rgba(0, 0, 0, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
}

.product-card:hover .product-image::after {
    opacity: 1;
}

/* 確保圖片正確顯示 - 最高優先級 - 只影響產品列表頁面 */
.products-page .products-grid .product-card .product-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1) !important;
    filter: brightness(1) contrast(1.02) saturate(1.1) !important;
    z-index: 1 !important;
    display: block !important;
}

/* 確保產品詳情頁面的圖片不受影響 */
.product-gallery-container .product-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    display: block !important;
    z-index: 1 !important;
}

.product-card:hover .product-image img {
    transform: scale(1.08);
    filter: brightness(1.05) contrast(1.05) saturate(1.15);
}

/* 圖片標籤 - 設計師風格 */
.product-image .category-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 3;
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.product-card:hover .category-badge {
    transform: translateY(0);
    opacity: 1;
}

/* 放大鏡圖標 - 重新設計 */
.image-zoom-hint {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    opacity: 0;
    transform: scale(0.8) translateY(-10px);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-card:hover .image-zoom-hint {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.image-zoom-hint:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1) translateY(0);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* 內容區域 - 精心設計 */
.product-content {
    padding: 32px 28px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    position: relative;
}

.product-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(102, 126, 234, 0.3) 50%, 
        transparent 100%);
    border-radius: 2px;
}

.product-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #1a1a1a;
    line-height: 1.3;
    background: linear-gradient(135deg, #1a1a1a 0%, #4a5568 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.product-content h3 a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.product-card:hover .product-content h3 {
    transform: translateY(-2px);
}

.product-content p {
    font-size: 14px;
    line-height: 1.6;
    color: #64748b;
    margin: 0 0 20px 0;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.product-card:hover .product-content p {
    color: #475569;
    opacity: 1;
}

/* 行動按鈕 - 現代設計 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent);
    transition: left 0.6s;
}

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

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: white;
}

.btn:active {
    transform: translateY(0);
}

/* 產品標籤系統 */
.product-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.product-tag {
    padding: 4px 10px;
    background: rgba(102, 126, 234, 0.1);
    color: #4c51bf;
    font-size: 11px;
    font-weight: 500;
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
}

.product-card:hover .product-tag {
    background: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}

/* 特色產品標記 */
.product-card.featured {
    background: rgba(255, 247, 230, 0.9);
    border-color: rgba(251, 191, 36, 0.3);
}

.product-card.featured::after {
    content: '✨ 精選';
    position: absolute;
    top: -1px;
    right: 20px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 4px 12px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

/* Loading 狀態 */
.product-card.loading {
    pointer-events: none;
}

.product-card.loading .product-image {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 強制覆蓋舊樣式 - 解決衝突 - 只針對產品列表頁面 */
.products-page .product-image {
    height: auto !important;
    min-height: 0 !important;
}

/* 確保產品詳情頁面樣式不受影響 */
.product-gallery-container .image-wrapper {
    position: relative !important;
    width: 100% !important;
    padding-bottom: 56.25% !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    margin: 20px !important;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15) !important;
}

/* 確保舊的CSS不會影響新設計 */
.products-page .products-grid .product-card .product-image {
    padding-bottom: 75% !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
}

/* 確保圖片在容器中正確顯示 */
.products-page .products-grid .product-card .product-image a {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .products-page .products-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 20px 0;
    }
    
    .product-card {
        border-radius: 20px;
        margin: 0 4px;
    }
    
    .product-card:hover {
        transform: translateY(-6px);
    }
    
    .product-content {
        padding: 24px 20px;
    }
    
    .product-content h3 {
        font-size: 18px;
    }
    
    .image-zoom-hint {
        width: 40px;
        height: 40px;
        top: 12px;
        right: 12px;
    }
    
    .category-badge {
        top: 12px;
        left: 12px;
        font-size: 10px;
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        gap: 20px;
    }
    
    .product-content {
        padding: 20px 16px;
    }
    
    .product-content h3 {
        font-size: 16px;
    }
    
    .product-content p {
        font-size: 13px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* 進階視覺效果 */
@supports (backdrop-filter: blur(20px)) {
    .product-card {
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(20px) saturate(180%);
    }
    
    .product-content {
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(10px);
    }
}

/* 篩選按鈕現代化設計 */
.category-filter {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.filter-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 50px;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: left 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: -1;
}

.filter-btn:hover,
.filter-btn.active {
    color: white;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.filter-btn:hover::before,
.filter-btn.active::before {
    left: 0;
}

.filter-btn:active {
    transform: translateY(0);
}

/* 響應式篩選按鈕 */
@media (max-width: 768px) {
    .filter-buttons {
        gap: 8px;
    }
    
    .filter-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .category-filter {
        padding: 16px;
        margin-bottom: 30px;
    }
}

/* 暗色主題支援 */
@media (prefers-color-scheme: dark) {
    .product-card {
        background: rgba(45, 55, 72, 0.8);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .product-content {
        background: rgba(26, 32, 44, 0.9);
    }
    
    .product-content h3 {
        background: linear-gradient(135deg, #f7fafc 0%, #e2e8f0 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .product-content p {
        color: #a0aec0;
    }
    
    .category-filter {
        background: rgba(45, 55, 72, 0.8);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .filter-btn {
        background: rgba(26, 32, 44, 0.7);
        color: #e2e8f0;
        border-color: rgba(255, 255, 255, 0.2);
    }
}
