/* * File: assets/css/components/card-product.css
 * Description: 產品卡片元件 (RWD Fixed: Mobile Equal Height)
 */

/* --- Product Card Core --- */
.se-product-card {
    flex-shrink: 0;
    width: 11rem; /* [Mobile] Fixed Width */
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    
    /* [Equal Height Fix] 
       1. 不設定 height: 100% (避免 Safari 異常)
       2. 依賴父容器 (.se-scroll-container) 的 align-items: stretch
       3. 自身設為 flex column 以便撐開內容
    */
    display: flex;
    flex-direction: column;
}

.se-product-card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.se-product-card.se-size-small { width: 100%; }

/* Image Area */
.se-card-img-wrap {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: #f0f0f0;
    flex-shrink: 0; 
}
.se-card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* --- Shared Components --- */
.se-card-actions-overlay {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 20;
    opacity: 1; 
    transition: opacity 0.2s, transform 0.2s;
}

.se-action-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: #4b5563;
    transition: all 0.2s;
}
.se-action-btn:hover {
    background: #dc2626;
    color: #fff;
    transform: scale(1.1);
}

.se-card-tags {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 20;
}
.se-tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #1f2937;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.se-tag-discount { background-color: #fca5a5; color: #7f1d1d; }
.se-tag-gift { background-color: #86efac; color: #14532d; }
.se-tag-limit { background-color: #fde047; color: #854d0e; }

.se-countdown {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    text-align: center;
    padding: 4px 0;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(2px);
    z-index: 10;
}

/* --- Card Body --- */
.se-card-body {
    padding: 1rem;
    flex: 1; /* 推動 footer 到底部 (如果有) */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px; 
}

.se-card-body > * {
    margin: 0 !important;
    flex-shrink: 0; 
}

.se-card-brand {
    font-size: 0.7rem; 
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1.2;
}

.se-card-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.4;
    white-space: normal !important;
    overflow: visible !important;
    
    /* [Equal Height Visual Trick] 
       設定最小高度為 2.8em (約兩行高)，
       這樣即使一行標題的卡片，也會佔用相同的標題空間，
       減少卡片底部空白處的劇烈落差感。
    */
    min-height: 2.8em; 
}

.se-price-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    line-height: 1.2;
    margin-top: auto; /* [Optional] 將價格推到底部對齊 */
}

.se-discount-badge {
    display: inline-block;
    width: fit-content;
    background-color: #fee2e2;
    color: #dc2626;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

/* =========================================
   Desktop RWD Enhancements (>= 1024px)
   ========================================= */
@media (min-width: 1024px) {
    
    .se-product-card {
        width: auto; 
    }

    /* Hover Reveal */
    .se-card-actions-overlay {
        opacity: 0;
        top: 1rem;
        right: 1rem;
    }
    
    .se-product-card:hover .se-card-actions-overlay {
        opacity: 1;
        transform: translateY(-2px);
    }

    /* Micro-interactions */
    .se-product-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        border-color: #d1d5db;
        z-index: 5;
    }

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

    /* Typography Upgrade */
    .se-card-title {
        font-size: 1rem;
        min-height: 3em; /* Desktop 字較大，增加高度 */
    }
    
    .se-action-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.2rem;
    }
}