/* 企業文藝風格 - 產品區塊共用樣式 */
.product-sections-common {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

.product-sections-common::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 115, 85, 0.05) 0%, transparent 70%);
    border-radius: 50%;
}

/* 左側裝飾元素 */
.product-sections-common.left-decoration::before {
    right: auto;
    left: -10%;
}

.product-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 標題設計 */
.section-header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.section-title {
    font-size: 36px;
    color: #2c3e50;
    font-weight: 300;
    letter-spacing: 3px;
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #8b7355, #a08568);
}

.section-subtitle {
    color: #7f8c8d;
    font-size: 16px;
    margin-top: 20px;
    letter-spacing: 1px;
}

.view-more-link {
    display: inline-block;
    margin-top: 20px;
    color: #8b7355;
    text-decoration: none;
    font-size: 14px;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    position: relative;
    padding-bottom: 3px;
}

.view-more-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: #8b7355;
    transition: width 0.3s ease;
}

.view-more-link:hover::after {
    width: 100%;
}

.view-more-link:hover {
    color: #a08568;
    text-decoration: none;
}

/* 產品網格容器 */
.products-grid-wrapper {
    position: relative;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    padding: 20px 0;
    transition: max-height 0.6s ease-in-out;
    position: relative;
}

/* 展開/收合控制 */
.products-grid.collapsed {
    max-height: 500px;
    overflow: hidden;
}

.products-grid.expanded {
    max-height: none;
}

/* 漸變遮罩效果 */
.products-grid.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, transparent, rgba(245, 247, 250, 0.9), #f5f7fa);
    pointer-events: none;
    z-index: 1;
}

/* 展開按鈕 */
.expand-button-wrapper {
    text-align: center;
    margin-top: 30px;
    position: relative;
    z-index: 2;
}

.expand-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    color: #8b7355;
    padding: 15px 40px;
    border: 2px solid #8b7355;
    border-radius: 50px;
    font-size: 15px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 115, 85, 0.1);
    position: relative;
    overflow: hidden;
}

.expand-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: linear-gradient(135deg, #8b7355, #a08568);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.5s ease;
    z-index: -1;
}

.expand-button:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 115, 85, 0.2);
}

.expand-button:hover::before {
    width: 300px;
    height: 300px;
}

.expand-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.expand-button.expanded .expand-icon {
    transform: rotate(180deg);
}

.expand-text {
    font-weight: 500;
}

.product-count-hint {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 10px;
    background: rgba(139, 115, 85, 0.1);
    border-radius: 15px;
    font-size: 13px;
    color: #8b7355;
}

/* 產品卡片 */
.product-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 15px rgba(44, 62, 80, 0.08);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(44, 62, 80, 0.15);
}

.product-card.hidden-initially {
    opacity: 0;
    transform: translateY(20px);
}

.products-grid.expanded .product-card.hidden-initially {
    animation: fadeInUp 0.5s ease forwards;
}

/* 產品圖片區域 */
.product-image-wrapper {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
    aspect-ratio: 1 / 1;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

/* 產品標籤 */
.product-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #ffffff;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 12px;
    letter-spacing: 1px;
    font-weight: 500;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* 不同類型的標籤顏色 */
.product-badge.new {
    background: linear-gradient(135deg, #8b7355, #a08568);
    box-shadow: 0 3px 10px rgba(139, 115, 85, 0.3);
}

.product-badge.promotion {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.3);
}

.product-badge.sales {
    background: linear-gradient(135deg, #8b7355, #a08568);
    box-shadow: 0 3px 10px rgba(139, 115, 85, 0.3);
}

/* 快速檢視按鈕 */
.quick-view-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 62, 80, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .quick-view-overlay {
    opacity: 1;
}

.quick-view-btn {
    background: #ffffff;
    color: #2c3e50;
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 14px;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    transform: translateY(10px);
}

.product-card:hover .quick-view-btn {
    transform: translateY(0);
}

.quick-view-btn:hover {
    background: #8b7355;
    color: #ffffff;
    text-decoration: none;
}

/* 產品資訊區域 */
.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 16px;
    color: #34495e;
    margin-bottom: 10px;
    font-weight: 400;
    line-height: 1.4;
    min-height: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.product-name a:hover {
    color: #8b7355;
}

/* 銷售數據 */
.product-sales {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    color: #7f8c8d;
    font-size: 13px;
}

.sales-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* 不同類型的銷售圖標顏色 */
.sales-icon.new {
    fill: #8b7355;
}

.sales-icon.promotion {
    fill: #e74c3c;
}

.sales-icon.sales {
    fill: #8b7355;
}

/* 價格與購買區域 */
.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    margin-top: auto;
}

.product-price {
    font-size: 22px;
    color: #8b7355;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.buy-button {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(44, 62, 80, 0.2);
}

.buy-button:hover {
    background: linear-gradient(135deg, #8b7355, #a08568);
    transform: rotate(10deg) scale(1.1);
    box-shadow: 0 5px 15px rgba(139, 115, 85, 0.3);
}

.cart-icon {
    width: 18px;
    height: 18px;
    fill: #ffffff;
}

/* 響應式設計 */
@media (max-width: 1400px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
}

@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .product-sections-common {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 28px;
        letter-spacing: 2px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-name {
        font-size: 14px;
        min-height: 38px;
    }
    
    .product-price {
        font-size: 16px;
    }
    
    .product-sales {
        font-size: 11px;
        gap: 4px;
    }
    
    .sales-icon {
        width: 14px;
        height: 14px;
    }
    
    .expand-button {
        padding: 12px 30px;
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .product-container {
        padding: 0 10px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .product-badge {
        font-size: 10px;
        padding: 3px 8px;
        top: 8px;
        right: 8px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 12px;
        min-height: 32px;
        margin-bottom: 6px;
    }
    
    .product-sales {
        display: none;
    }
    
    .product-footer {
        padding-top: 10px;
    }
    
    .product-price {
        font-size: 14px;
    }
    
    .buy-button {
        width: 30px;
        height: 30px;
    }
    
    .cart-icon {
        width: 14px;
        height: 14px;
    }
    
    .expand-button-wrapper {
        margin-top: 20px;
    }
    
    .expand-button {
        padding: 10px 25px;
        font-size: 13px;
    }
    
    .expand-icon {
        width: 16px;
        height: 16px;
    }
    
    .product-count-hint {
        font-size: 11px;
        padding: 2px 8px;
    }
}

@media (max-width: 480px) {
    .product-sections-common {
        padding: 30px 0;
    }
    
    .section-header {
        margin-bottom: 25px;
    }
    
    .section-title {
        font-size: 24px;
        letter-spacing: 1px;
    }
    
    .section-subtitle {
        font-size: 14px;
    }
    
    .view-more-link {
        font-size: 12px;
        margin-top: 15px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .product-card {
        border-radius: 6px;
    }
    
    .product-badge {
        font-size: 9px;
        padding: 2px 6px;
        top: 5px;
        right: 5px;
    }
    
    .product-info {
        padding: 8px;
    }
    
    .product-name {
        font-size: 11px;
        min-height: 28px;
        margin-bottom: 5px;
        -webkit-line-clamp: 1;
    }
    
    .product-footer {
        padding-top: 8px;
    }
    
    .product-price {
        font-size: 13px;
        font-weight: 500;
    }
    
    .buy-button {
        width: 28px;
        height: 28px;
    }
    
    .cart-icon {
        width: 13px;
        height: 13px;
    }
    
    .quick-view-btn {
        padding: 8px 15px;
        font-size: 11px;
    }
}

@media (max-width: 360px) {
    .product-container {
        padding: 0 8px;
    }
    
    .products-grid {
        gap: 6px;
    }
    
    .product-info {
        padding: 6px;
    }
    
    .product-name {
        font-size: 10px;
        min-height: 24px;
    }
    
    .product-price {
        font-size: 12px;
    }
    
    .buy-button {
        width: 26px;
        height: 26px;
    }
    
    .cart-icon {
        width: 12px;
        height: 12px;
    }
}

/* 載入動畫 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

/* 動畫延遲 */
.product-card:nth-child(1) { animation-delay: 0.05s; }
.product-card:nth-child(2) { animation-delay: 0.1s; }
.product-card:nth-child(3) { animation-delay: 0.15s; }
.product-card:nth-child(4) { animation-delay: 0.2s; }
.product-card:nth-child(5) { animation-delay: 0.25s; }
.product-card:nth-child(6) { animation-delay: 0.3s; }
.product-card:nth-child(7) { animation-delay: 0.35s; }
.product-card:nth-child(8) { animation-delay: 0.4s; }
.product-card:nth-child(n+9) { animation-delay: 0.45s; }

.products-grid.expanded .product-card.hidden-initially {
    animation-delay: 0.1s;
}