/* 爱官网 - 自定义样式 */

/* 全局样式 */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --icon-border-radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
}

/* 卡片样式 */
.category-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.category-card .card-body {
    text-align: center;
    padding: 2rem 1rem;
}

.category-card .icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* 软件卡片 */
.software-card {
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.software-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* 软件卡片简介：最多显示 3 行，超出部分末尾才显示省略号 */
.software-card .desc-wrap {
    min-width: 0; /* flex 子项允许收缩，否则截断不生效 */
}

.software-card .desc-ellipsis {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    min-width: 0;
    overflow: hidden;
    /* 兜底：即使浏览器不支持 line-clamp，也硬性限制为 3 行高度（行高 1.5 × 3） */
    line-height: 1.5;
    max-height: 4.5em;
}

/* 详情页右侧推广位 —— 统一规格：宽高比 3:1（建议上传 1200×400，最小 600×200）
   容器用 padding-top 锁定 3:1 比例（兼容不支持 aspect-ratio 的旧浏览器），高度固定、布局不会跳动；
   图片用 object-fit:contain 整体等比缩放居中显示——不拉伸变形、不裁切，原图多出来的部分留背景色。
   若个别图片比例与 3:1 差异较大，会以背景色补齐留白，建议后台按 3:1 出图以获得最佳效果。 */
/* 推广位标题栏右侧的宣传语链接 */
.promo-card .promo-slogan {
    font-size: 0.85rem;
    font-weight: 500;
    color: #ffc107;
    text-decoration: none;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    transition: color 0.2s ease, background 0.2s ease;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.promo-card .promo-slogan:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.25);
    text-decoration: underline;
}

.promo-card .promo-slogan-plain {
    color: rgba(255, 255, 255, 0.75);
    cursor: default;
}

.promo-card .promo-img-box {
    position: relative;
    width: 100%;
    height: 0;
    padding-top: 33.3333%; /* 3:1 */
    background: #f8f9fa;
    overflow: hidden;
}

.promo-card .promo-img-box a {
    position: absolute;
    inset: 0;
    display: block;
    line-height: 0;
}

.promo-card .promo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* contain：整张图完整等比缩放居中，不变形、不裁切 */
    object-fit: contain;
    object-position: center;
}

.promo-card .promo-img-box.promo-error::after {
    content: "推广图加载失败，请检查图片地址是否可访问（https 页面需使用 https 图片地址）";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    padding: 0 16px;
}

.software-card .software-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    border-radius: var(--icon-border-radius);
}

/* 软件图标图片：固定尺寸并裁切，防止图片过大撑破布局；圆角自适应 */
.software-icon img.software-icon-img,
img.software-icon-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--icon-border-radius);
}

/* 内联小图标（如搜索结果）也限制最大尺寸 */
h5 img.software-icon-img {
    max-width: 32px;
    max-height: 32px;
    border-radius: calc(var(--icon-border-radius) * 0.6);
}

/* 按钮样式 */
.btn-official {
    background-color: var(--success-color);
    color: white;
}

.btn-official:hover {
    background-color: #157347;
    color: white;
}

.btn-history {
    background-color: var(--info-color);
    color: white;
}

.btn-history:hover {
    background-color: #0bb8d3;
    color: white;
}

.btn-green {
    background-color: var(--warning-color);
    color: #212529;
}

.btn-green:hover {
    background-color: #e0a800;
    color: #212529;
}

/* 反馈表单 */
.feedback-form {
    background-color: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* 搜索框 */
#search-input {
    border-radius: 20px;
    padding: 0.5rem 1rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .category-card .icon {
        font-size: 2rem;
    }
    
    .category-card .card-body {
        padding: 1.5rem 0.5rem;
    }
}
