/**
 * Projects Grid Widget Styles
 * 项目列表网格样式
 *
 * @package Siwei_Custom_Widgets
 * @since 3.0.0
 */

/* ========================================
   基础布局
   ======================================== */

.siwei-projects-grid {
    width: 100%;
    margin: 0 auto;
}

.projects-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 默认 3 列，由小部件控制 */
    gap: 30px; /* 由小部件控制 */
}

/* ========================================
   项目卡片
   ======================================== */

.project-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

/* ========================================
   缩略图 (4:3 比例)
   ======================================== */

.project-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 = 3/4 = 75% */
    overflow: hidden;
    background: #f5f5f5;
}

.project-thumbnail a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.project-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-card:hover .project-thumbnail img {
    transform: scale(1.05);
}

/* ========================================
   内容区域
   ======================================== */

.project-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 标题 */
.project-title {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
}

.project-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.project-title a:hover {
    color: #5470c6;
}

/* 元信息 */
.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #666;
}

.project-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.project-meta .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* 客户类型徽章 */
.project-client-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.client-type-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #5470c6;
    color: #fff;
    font-size: 12px;
    border-radius: 12px;
    font-weight: 500;
}

/* 项目标签 */
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.project-tag {
    display: inline-block;
    padding: 4px 12px;
    background: #e3f2fd;
    color: #2196f3;
    font-size: 12px;
    border-radius: 12px;
    font-weight: 500;
}

/* 关键词标签 */
.project-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.keyword-tag {
    display: inline-block;
    padding: 3px 10px;
    background: #f5f5f5;
    color: #666;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

/* 摘要 */
.project-excerpt {
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    flex: 1;
}

/* 按钮 */
.project-button {
    display: inline-block;
    align-self: flex-start;
    padding: 10px 24px;
    background: #5470c6;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: auto;
}

.project-button:hover {
    background: #3b5999;
    transform: translateX(2px);
}

/* ========================================
   分页
   ======================================== */

.projects-pagination {
    margin-top: 40px;
    text-align: center;
}

.projects-pagination .page-numbers {
    display: inline-flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 8px;
}

.projects-pagination .page-numbers li {
    display: inline-block;
}

.projects-pagination a,
.projects-pagination span {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
}

.projects-pagination a:hover {
    background: #5470c6;
    color: #fff;
    border-color: #5470c6;
}

.projects-pagination .current {
    background: #5470c6;
    color: #fff;
    border-color: #5470c6;
}

.projects-pagination .prev,
.projects-pagination .next {
    font-weight: 500;
}

/* ========================================
   暂无项目
   ======================================== */

.projects-not-found {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    color: #999;
    font-size: 16px;
}

/* ========================================
   响应式设计
   ======================================== */

/* 平板 (768px - 1024px) */
@media (max-width: 1024px) {
    .projects-grid-container {
        grid-template-columns: repeat(2, 1fr); /* 2 列 */
        gap: 24px;
    }

    .project-title {
        font-size: 18px;
    }

    .project-content {
        padding: 16px;
    }
}

/* 手机 (< 768px) */
@media (max-width: 768px) {
    .projects-grid-container {
        grid-template-columns: 1fr; /* 1 列 */
        gap: 20px;
    }

    .project-title {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .project-meta {
        font-size: 13px;
        gap: 12px;
    }

    .project-content {
        padding: 16px;
    }

    .project-excerpt {
        font-size: 13px;
    }

    .project-button {
        width: 100%;
        text-align: center;
    }
}

/* 小手机 (< 480px) */
@media (max-width: 480px) {
    .project-card {
        border-radius: 6px;
    }

    .project-title {
        font-size: 16px;
    }

    .project-meta {
        flex-direction: column;
        gap: 8px;
    }

    .project-content {
        padding: 14px;
    }

    .client-type-badge,
    .project-tag,
    .keyword-tag {
        font-size: 11px;
    }

    .projects-pagination a,
    .projects-pagination span {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ========================================
   无障碍支持
   ======================================== */

.project-card:focus-within {
    outline: 2px solid #5470c6;
    outline-offset: 2px;
}

.project-button:focus {
    outline: 2px solid #5470c6;
    outline-offset: 2px;
}

/* ========================================
   打印样式
   ======================================== */

@media print {
    .siwei-projects-grid {
        background: #fff;
    }

    .project-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
        margin-bottom: 20px;
    }

    .project-card:hover {
        transform: none;
        box-shadow: none;
    }

    .project-button,
    .projects-pagination {
        display: none;
    }
}

/* ========================================
   加载状态（可选）
   ======================================== */

.siwei-projects-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

.siwei-projects-grid.loading::after {
    content: '加载中...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 40px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 16px;
    color: #666;
}
