/* PDF 网格布局 */
.primo-pdf-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.primo-pdf-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.primo-pdf-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.primo-pdf-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* 响应式布局 */
@media (max-width: 1024px) {
    .primo-pdf-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .primo-pdf-grid-3,
    .primo-pdf-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .primo-pdf-grid,
    .primo-pdf-grid-2,
    .primo-pdf-grid-3,
    .primo-pdf-grid-4 {
        grid-template-columns: 1fr;
    }
    
    /* 移动端封面图片适配 */
    .primo-pdf-cover {
        width: calc(100% + 30px);
        margin: -15px -15px 15px -15px;
    }
    
    .primo-pdf-card {
        padding: 15px;
    }
}

/* PDF 卡片 */
.primo-pdf-card {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.primo-pdf-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: #007acc;
}

/* 封面图片 */
.primo-pdf-cover {
    width: calc(100% + 40px);
    aspect-ratio: 1/1;
    padding-bottom: 100%;
    height: 0;
    overflow: visible;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -20px -20px 15px -20px;
    border-radius: 8px 8px 0 0;
    position: relative;
}

/* 支持 aspect-ratio 的现代浏览器 */
@supports (aspect-ratio: 1/1) {
    .primo-pdf-cover {
        height: auto;
        padding-bottom: 0;
    }
}

.primo-pdf-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.primo-pdf-card:hover .primo-pdf-cover img {
    transform: scale(1.05);
}

.primo-pdf-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.8;
}

.primo-pdf-title {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    margin: 15px 0 10px 0;
    line-height: 1.4;
}

.primo-pdf-description {
    font-size: 14px;
    color: #666666;
    margin: 0 0 15px 0;
    line-height: 1.5;
    height: 3em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.primo-pdf-meta {
    font-size: 12px;
    color: #999999;
    margin-bottom: 15px;
}

.primo-file-size {
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

/* 下载按钮 */
.primo-download-btn {
    background: #007acc;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin: auto 0 0 0;
    display: block;
}

.primo-download-btn:hover {
    background: #005a99;
    transform: translateY(-1px);
}

.primo-download-btn:active {
    transform: translateY(0);
}

/* 分页 */
.primo-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.primo-page-btn {
    display: inline-block;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    color: #007acc;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.primo-page-btn:hover {
    background: #f8f9fa;
    border-color: #007acc;
    text-decoration: none;
}

.primo-page-btn.primo-active {
    background: #007acc;
    color: #ffffff;
    border-color: #007acc;
}

.primo-prev-btn,
.primo-next-btn {
    padding: 8px 16px;
    min-width: auto;
}

/* 模态框 */
.primo-modal {
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.primo-modal-content {
    background: #ffffff;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

.primo-modal-header {
    padding: 20px 20px 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.primo-modal-header h4 {
    margin: 0;
    font-size: 18px;
    color: #333333;
}

.primo-modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #999999;
    line-height: 1;
    padding: 0;
    background: none;
    border: none;
}

.primo-modal-close:hover {
    color: #666666;
}

.primo-modal-body {
    padding: 20px;
}

.primo-modal-body p {
    margin: 0 0 15px 0;
    color: #666666;
    line-height: 1.5;
}

/* 表单 */
#primo-email-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#primo-email-input,
#primo-phone-input {
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

#primo-email-input:focus,
#primo-phone-input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.primo-submit-btn {
    background: #007acc;
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primo-submit-btn:hover {
    background: #005a99;
}

.primo-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 消息提示 */
.primo-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
}

.primo-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.primo-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.primo-message-loading {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 防止页面滚动 */
body.primo-modal-open {
    overflow: hidden;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 加载状态 */
.primo-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.primo-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007acc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具提示 */
.primo-tooltip {
    position: relative;
    display: inline-block;
}

.primo-tooltip .primo-tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #333333;
    color: #ffffff;
    text-align: center;
    border-radius: 4px;
    padding: 5px 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.primo-tooltip:hover .primo-tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 空状态 */
.primo-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
}

/* 确保网格项目等高 */
.primo-pdf-grid {
    align-items: stretch;
}

/* shortcode 和 category widget 样式统一 */
.primo-category-pdf-widget .primo-pdf-card,
.primo-shortcode .primo-pdf-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.primo-category-pdf-widget .primo-download-btn,
.primo-shortcode .primo-download-btn {
    margin: auto 0 0 0;
}

.primo-empty-state .primo-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.primo-empty-state .primo-empty-text {
    font-size: 16px;
    margin-bottom: 10px;
}

.primo-empty-state .primo-empty-desc {
    font-size: 14px;
    color: #999999;
}