/* ============================================================================
   我的证书 - 卡片墙样式（certificate.css，certificate_list 页面专属）
   ----------------------------------------------------------------------------
   grid 布局纵向卡片：证书图为卡片主体（A4 横版比例），
   文字信息叠于图片底部半透明渐变遮罩上（名称/编号/机构/发证时间 + 操作按钮）。
   全部规则以宿主 #certificate 作用域隔离（jy-cert-* 前缀），不影响其他页面。
   宿主页需在 #certificate 容器内渲染 jy-cert-grid 结构并引入本文件。
   ============================================================================ */

/* ==================== 网格容器 ==================== */
/* 固定 3 列等宽（平板 2 列、手机 1 列见底部响应式），卡片间距 20px */
#certificate .jy-cert-grid {
    padding-top: 20px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ==================== 卡片 ==================== */
/* 白底圆角 + 细边框，hover 抬升加深阴影（与记录卡片风格一致） */
#certificate .jy-cert-card {
    border: 1px solid #e8ebf2;
    border-radius: 14px;
    background-color: #f0f2f5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

#certificate .jy-cert-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 123, 182, 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* 封面：证书图 750×1064 竖版比例占位（padding-top = 1064/750 ≈ 140.67%），图片铺满裁切 */
#certificate .jy-cert-cover {
    position: relative;
    width: 100%;
    padding-top: 140.67%;
    cursor: zoom-in;
}

#certificate .jy-cert-cover img {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==================== 底部信息遮罩 ==================== */
/* 绝对定位于图片底部，上透下深的渐变半透明底，白字 */
#certificate .jy-cert-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 40px 14px 12px;
    background: linear-gradient(180deg, rgba(31, 36, 48, 0) 0%, rgba(31, 36, 48, 0.65) 38%, rgba(31, 36, 48, 0.95) 100%);
    color: #fff;
}

/* 证书名称：单行加粗省略 */
#certificate .jy-cert-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 编号/机构元信息行：小字半透明白，超长单行省略 */
#certificate .jy-cert-meta {
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#certificate .jy-cert-meta span {
    color: rgba(255, 255, 255, 0.6);
}

/* 底行：左发证时间、右操作按钮，两端对齐 */
#certificate .jy-cert-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.25);
}

/* 发证时间：小标签 + 等宽数字日期 */
#certificate .jy-cert-date {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

#certificate .jy-cert-date__label {
    font-size: 11px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
}

#certificate .jy-cert-date__value {
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== 操作按钮 ==================== */
/* 右侧纵排两枚小胶囊按钮：半透明白底描边，hover 变主题色 */
#certificate .jy-cert-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 10px;
}

#certificate .jy-cert-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
    color: #fff;
    font-size: 12px;
    letter-spacing: 1px;
    white-space: nowrap;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

#certificate .jy-cert-btn:hover {
    background-color: #007BB6;
    box-shadow: inset 0 0 0 1px #007BB6;
    color: #fff;
}

/* ==================== 文件失效占位 ==================== */
/* 证书物理文件丢失（后端 file_exists=false）的降级展示：灰底禁用态，无查看/下载入口 */
#certificate .jy-cert-missing {
    position: relative;
    width: 100%;
    padding-top: 140.67%; /* 与封面同比例占位，卡片高度一致不跳动 */
    background: #f7f8fa;
    cursor: default;
}

/* 图标：居中偏上（仅 left:50% + 反向位移，right 会拉伸盒宽导致偏左） */
#certificate .jy-cert-missing i {
    position: absolute;
    top: 36%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 34px;
    color: #c9ced8;
}

/* 证书名称：保持可读，单行省略 */
#certificate .jy-cert-missing__title {
    position: absolute;
    top: 49%;
    left: 14px;
    right: 14px;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* 提示文案 */
#certificate .jy-cert-missing__text {
    position: absolute;
    top: 56%;
    left: 14px;
    right: 14px;
    font-size: 12px;
    color: #9aa3b2;
    text-align: center;
}

/* ==================== 响应式 ==================== */
/* 平板（≤991.98px）：3 列改 2 列，避免卡片过窄 */
@media screen and (max-width: 991.98px) {
    #certificate .jy-cert-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手机（<768px）：单列，间距收紧 */
@media screen and (max-width: 767.98px) {
    #certificate .jy-cert-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}
