/**
 * 产品卡片共享样式
 * 用于产品列表页、首页、搜索页的统一产品卡片展示
 * Feature: product-page-redesign
 */

/* ========================================
   CSS 变量定义 - 已由 gaming-hero.css 提供
   ======================================== */

/* ========================================
   淡入动画 - 已由 gaming-hero.css 提供
   ======================================== */

/* ========================================
   产品卡片基础样式 - Gaming Glass Card
   ======================================== */
.product-card {
    background: var(--gaming-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--gaming-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    height: 100%; /* 恢复为 100%，确保同排卡片高度一致 */
    display: flex;
    flex-direction: column;
    box-shadow: var(--gaming-card-shadow);
}

/* 悬停效果 */
.product-card:hover {
    transform: translateY(-10px);
    border-color: var(--gaming-blue);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 25px var(--gaming-glow);
}

/* ========================================
   卡片图片区域
   ======================================== */
.card-img-link {
    display: block;
    width: 100%;
    border-radius: 20px 20px 0 0; /* 同步卡片顶部圆角 */
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03); /* 增加极淡背景，使图片区与文字区有微弱区分 */
    position: relative;
    z-index: 2;
}

.card-img-wrapper {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center; /* 垂直居中，确保宽图上下留白但不被裁切 */
    justify-content: center;
    padding: 0;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, var(--gaming-glow) 0%, transparent 70%);
}

.img-container {
    width: 100%;
    height: auto; /* 高度随图片比例 */
    display: block;
    z-index: 2;
    transition: transform 0.5s ease;
}

.main-img {
    width: 100% !important; /* 强制宽度 100% 贴边 */
    height: auto !important; /* 高度等比例缩放，不裁切 */
    display: block;
    object-fit: contain; /* 配合宽度 100% 确保内容完整 */
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.4));
}

.product-card:hover .img-container {
    transform: scale(1.1) rotate(2deg);
}

/* 装饰光效 */
.card-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, var(--gaming-glow) 0%, transparent 60%);
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0.5;
    transition: opacity 0.4s ease;
}

.product-card:hover .card-glow {
    opacity: 1;
}

/* ========================================
   产品徽章
   ======================================== */
.card-badges {
    position: absolute;
    top: 12px; /* 稍微上移一点 */
    left: 12px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap; /* 强制单排显示，避免错位 */
    align-items: flex-start; /* 关键：所有角标置顶对齐 */
    gap: 6px;
    z-index: 10;
}

.card-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    height: 22px; /* 固定高度确保对齐一致 */
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid var(--gaming-border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    line-height: 1;
}

.badge-nvidia { background: var(--brand-nvidia); color: white; border-color: var(--gaming-border); }
.badge-amd { background: var(--brand-amd); color: white; border-color: var(--gaming-border); }
.badge-intel { background: var(--brand-intel); color: white; border-color: var(--gaming-border); }
.badge-new { background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%); color: white; border-color: rgba(255, 255, 255, 0.2); } /* 青蓝色渐变 */
.badge-hot { background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); color: white; border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); } /* 橙红色渐变 */
.badge-historical { background: var(--gaming-glass); color: rgba(255, 255, 255, 0.5); font-size: 9px; }

/* ========================================
   卡片内容
   ========================================/* 卡片内容 */
.card-content {
    padding: 15px 20px 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.4);
}

.card-header-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-series {
    color: var(--gaming-blue);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.card-title {
    font-size: 1.0rem; /* 稍微缩小字体 */
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.4;
}

.card-title a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-card:hover .card-title a {
    background: var(--gaming-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-specs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.spec-tag {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    background: var(--gaming-glass);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--gaming-border);
}

/* ========================================
   卡片按钮
   ======================================== */
.card-actions {
    margin-top: auto; /* 恢复为 auto，将按钮推至卡片底部以实现对齐 */
    display: flex;
    gap: 10px;
}

.btn-card {
    flex: 1;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
}

.btn-detail {
    background: var(--gaming-glass);
    border: 1px solid var(--gaming-border);
    color: white;
}

.btn-detail:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--gaming-blue);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.btn-tmall {
    background: var(--brand-tmall);
    color: white;
}

.btn-jd {
    background: var(--brand-jd);
    color: white;
}

.btn-tmall:hover, .btn-jd:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

/* ========================================
   响应式调整
   ======================================== */
@media (max-width: 767px) {
    .product-card {
        overflow: hidden !important; 
        background: #0a0a0f !important;
        border: none !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
        height: auto !important;
        margin-bottom: 15px !important;
        transform: none !important; 
        transition: none !important; 
        z-index: 1;
        position: relative;
        display: flex;
        flex-direction: column;
        border-radius: 12px;
        padding: 0 !important; /* 彻底移除卡片外层内边距，确保内容贴边 */
    }

    .card-img-link {
        width: 100% !important; 
        margin: 0 !important; 
        /* 移除白色背景，改为半透明或透明 */
        background: rgba(255, 255, 255, 0.05) !important; 
        border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* 增加微弱底部分割线 */
        position: relative;
        z-index: 2;
        display: block !important;
        box-sizing: border-box !important;
        overflow: hidden; 
        border-radius: 12px 12px 0 0; /* 保持顶部圆角，下方直角 */
    }

    .card-img-wrapper { 
        width: 100%;
        aspect-ratio: 4 / 3;
        background: transparent !important;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 !important;
        overflow: hidden !important; 
    }
    
    .img-container {
        width: 100%;
        height: auto;
        display: block;
        transform: none !important;
    }

    .main-img {
        width: 100% !important; 
        height: auto !important; 
        object-fit: contain !important; /* 强制贴边且不裁切 */
        transform: none !important; 
        filter: none !important;
    }

    /* 徽章位置调整 */
    .card-badges {
        top: 6px;
        left: 6px !important;
        gap: 3px;
        z-index: 25;
        flex-wrap: nowrap !important; /* 强制不换行，防止错位 */
    }

    /* 文字内容区：严格与图片同宽并贴边 */
    .card-content { 
        width: 100% !important; 
        margin: 0 !important; 
        background: #0a0a0f !important; 
        padding: 12px 10px 18px !important; 
        position: relative;
        z-index: 1;
        display: block !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .card-title { 
        font-size: 16px !important; /* 按照最新要求改为 16px */
        margin-bottom: 10px;
        line-height: 1.4;
        font-weight: 700;
        color: #fff;
        display: block !important; 
        -webkit-line-clamp: unset !important; 
        overflow: visible !important; 
        text-align: left;
    }
    
    .card-badge {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        height: 18px !important; /* 固定高度确保对齐 */
        font-size: 9px !important; 
        padding: 0 6px !important;
        font-weight: 800;
        border-radius: 3px;
        letter-spacing: 0.2px !important;
        line-height: 1 !important;
    }

    .card-badge i {
        margin-right: 2px !important; /* 缩小图标间距 */
        font-size: 9px !important;
    }

    .card-specs {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 15px;
    }
    
    .spec-tag {
        font-size: 11px;
        padding: 4px 10px;
        font-weight: 600;
        background: rgba(255,255,255,0.05);
        color: rgba(255,255,255,0.7);
        border: 1px solid rgba(255,255,255,0.1);
    }

    .btn-card {
        font-size: 13px;
        padding: 12px 0;
        min-height: 44px;
        font-weight: 700;
        border-radius: 6px;
    }
}

/* ========================================
   微小屏幕特殊优化 (iPhone SE 等)
   ======================================== */
@media (max-width: 375px) {
    .card-title {
        font-size: 13px;
    }
    .btn-card {
        font-size: 12px;
    }
}
