/* 
 * 统一产品卡片样式 - 适用于所有页面和设备 
 * 版本: 1.0
 * 日期: 2025-03-21
 */

/* ---------- 基础卡片结构 ---------- */
.product-card {
    position: relative;
    max-width: 100%; /* 在较小屏幕上确保响应式 */
    background-color: #ccc;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.36);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.product-card__container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    background: #fff;
}

/* Info box for product details */
.product-card__info-box {
    padding: 20px !important;
    box-sizing: border-box;
}

.product-card__footer-stock-status {
    position: absolute;
    top: 10px;
    left: 16px;
    z-index: 2;
}

/* 產品卡片文字截斷樣式 */
.product-card__producer {
    padding-right: 16px;
    display: block;
}

.product-card__name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    max-width: 100%;
    padding-right: 16px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    min-height: 2.6em; /* 2行 */
}

/* ---------- 图片区域 ---------- */
.product-card__image-side {
    position: relative;
    text-align: center;
    width: 100%;
    height: 240px; /* 使用全部高度 */
    padding-top: 20px;
    padding-bottom: 0px; /* 底部留出一些空间 */
}

.product-card__image {
    width: 100%;
    height: calc(100% - 10px); /* 减去底部留出的空间 */
    object-fit: contain;
    object-position: center;
    max-width: 200px;
    max-height: 300px; /* 增加最大高度 */
    transition: transform 0.3s ease;
}

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

/* ---------- 标签和徽章 ---------- */
.product-card__sold-out,
.product-card__pre-order,
.product-card__discount-badge {
    position: absolute;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1;
}

.product-card__sold-out {
    top: 10px;
    right: 10px;
    background-color: #f44336;
    color: white;
}

.product-card__pre-order {
    top: 10px;
    right: 10px;
    background-color: #FF9800;
    color: white;
}

.product-card__max-rating {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 600;
    z-index: 3;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 图片左侧底部的库存状态 */
.product-card__image-stock-status {
    position: absolute;
    top:-10px;
    left: 25px;
    z-index: 2;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-card__image-stock-status .stock-status-text {
    padding: 4px 8px;
}

.product-card__image-stock-status .stock-status-text.in-stock {
    color: #4CAF50;
}

.product-card__image-stock-status .stock-status-text.pre-order {
    color: #FF9800;
}

.product-card__image-stock-status .stock-status-text.low-stock {
    color: #FFC107;
}

.product-card__image-stock-status .stock-status-text.sold-out {
    background: #d32f2f;
    color: #fff;
    border-radius: 4px;
    font-weight: bold;
}

/* ---------- 内容区域 ---------- */
.product-card__content-side {
    width: 100%;
    height: 100%;
    position: relative;
}

.product-card__details { 
    width: 100%;
}

/* ---------- 标题和基本信息 ---------- */
.product-card__producer-link,
.product-card__name-link {
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.product-card__producer-link:hover .product-card__producer,
.product-card__name-link:hover .product-card__name {
    color: var(--accent-color);
}

.product-card__producer {
    font-size: 16px;
    color: #444;
    margin: 0 0 5px 0;
    font-weight: 500;
}

.product-card__name {
    margin: 0;
    font-size: 16px;
    color: #444;
    font-weight: 600;
    line-height: 1.2;
    height: 80px;
}

.product-card__name--small {
    font-size: 14px;
}

/* ---------- 产品信息 ---------- */
.product-card__info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.product-card__region-row,
.product-card__type-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.product-card__region,
.product-card__type {
    font-size: 14px;
    color: #666;
}

.product-card__country-flag,
.product-card__grape-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* ---------- 评级和认证 ---------- */
.product-card__ratings {
    margin-top: 15px;
}

.product-card__rating-stars {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
}

.product-card__rating-stars .fa-star {
    color: #ccc;
    font-size: 16px;
}

.product-card__rating-stars .fa-star.active {
    color: #ffc107;
}

.product-card__rating-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.product-card__rating-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #666;
    padding: 2px 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.product-card__certifications {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.product-card__cert-icon {
    height: 30px;
    width: auto;
    object-fit: contain;
}

/* 内容区域的瓶子尺寸 */
.product-card__content-bottle-size {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #555;
    background-color: #f8f8f8;
    padding: 4px 10px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.product-card__content-bottle-size .bottle-size-text {
    font-size: 16px;
    font-weight: 600;
}

/* ---------- 底部区域 ---------- */
.product-card__footer {
    position: absolute; /* 使用绝对定位固定在底部 */
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 15px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f9f9f9;
    height: 60px; /* 固定底部区域的高度 */
    padding: 20px 20px 20px 40px; /* 視設計調整 */
}

.product-card__footer-left {
    display: flex;
    align-items: center;
    flex: 1 1 0%;
    min-width: 0;
}

.product-card__stock-status {
    font-size: 12px;
    margin-bottom: 2px;
}

.product-card__stock-status.in-stock {
    color: #4CAF50;
}

.product-card__stock-status.pre-order {
    color: #FF9800;
}

.product-card__stock-status.low-stock {
    color: #FFC107;
}

.product-card__stock-status.out-of-stock {
    color: #f44336;
}

.product-card__price {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.product-card__special-price {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
    margin-right: 5px;
}

.product-card__discount {
    font-size: 12px;
    color: #4CAF50;
    font-weight: 500;
    margin-left: 5px;
}

.product-card__footer-right {
    display: flex;
    flex-direction: column;
}

.product-card__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.product-card__quantity {
    display: flex;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.product-card__quantity-input {
    width: 40px;
    height: 28px;
    text-align: center;
    border: none;
    background-color: #f0f0f0;
    font-size: 14px;
    font-weight: 500;
    /* 隱藏輸入框的上下箭頭（適用於不同瀏覽器） */
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield; 
}

/* 隱藏Chrome、Safari、Edge、Opera的上下箭頭 */
.product-card__quantity-input::-webkit-outer-spin-button,
.product-card__quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none; 
    margin: 0;
}

/* 隱藏Firefox的上下箭頭 */
.product-card__quantity-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield; 
}

.product-card__quantity-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e0e0e0;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.product-card__quantity-btn:hover {
    background-color: #d0d0d0;
}

.product-card__add-btn {
    width: 48px; /* 更大尺寸 - 从40px增加到48px */
    height: 48px; /* 更大尺寸 - 从40px增加到48px */
    border-radius: 50%;
    background-color: var(--primary-color, #1e3a8a); /* 使用网站根蓝色 */
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 20px; /* 放大图标尺寸 */
}

.product-card__add-btn:hover {
    background-color: var(--accent-color, #c7ad77); /* 悬停时使用根金色 */
}

.product-card__add-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* 修复网格模式显示 */
.product-card--grid {
    height: 600px;
}

/* 紧凑模式 - 相似产品 */
.product-card--compact {
    height: 370px;
}

.product-card--compact .product-card__image-side,
.product-card--compact .product-card__content-side {
    height: 100%;
}

.product-card--compact .product-card__ratings,
.product-card--compact .product-card__certifications {
    display: none;
}

.product-card--compact .product-card__name {
    font-size: 16px;
    line-clamp: 1;
}
