/**
 * Yi主题 - PDF下载功能样式
 * 为WooCommerce产品的PDF下载功能提供美观的样式
 */

/* =================================================================
   PDF下载区域 - 单产品页面
   ================================================================= */

.yi-pdf-downloads-section {
    margin: 30px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.yi-pdf-downloads-title {
    margin: 0 0 20px 0;
    color: #1e3c72;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #007cba;
}

.yi-pdf-downloads-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.yi-pdf-download-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.yi-pdf-download-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.yi-pdf-download-item.preview-pdf {
    border-left-color: #28a745;
}

.yi-pdf-download-item.full-pdf {
    border-left-color: #007cba;
}

.yi-pdf-download-item .pdf-icon {
    font-size: 40px;
    margin-right: 15px;
    flex-shrink: 0;
}

.yi-pdf-download-item .pdf-info {
    flex: 1;
}

.yi-pdf-download-item .pdf-title {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.yi-pdf-download-item .pdf-description {
    margin: 0 0 15px 0;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.4;
}

.yi-pdf-download-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #007cba 0%, #00a0d2 100%);
    color: white !important;
    text-decoration: none !important;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.yi-pdf-download-btn:hover {
    background: linear-gradient(135deg, #005a8b 0%, #007cba 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.4);
    color: white !important;
}

.yi-pdf-download-btn.preview-btn {
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.yi-pdf-download-btn.preview-btn:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #28a745 100%);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.yi-pdf-download-btn .btn-icon {
    margin-right: 8px;
    font-size: 16px;
}

.purchase-required {
    padding: 10px 15px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
}

.purchase-msg {
    color: #856404;
    font-size: 14px;
    font-weight: 500;
}

.login-required {
    text-align: center;
    padding: 10px;
}

.login-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #6c757d;
    color: white !important;
    text-decoration: none !important;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.login-link:hover {
    background: #5a6268;
    color: white !important;
}

/* =================================================================
   用户账户页面的PDF下载区域
   ================================================================= */

.yi-account-pdf-downloads {
    margin: 30px 0;
    padding: 25px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.yi-account-pdf-downloads h3 {
    margin: 0 0 20px 0;
    color: #1e3c72;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
}

.pdf-downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.account-pdf-item {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #007cba;
}

.account-pdf-item .product-info h4 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.account-pdf-item .purchase-date {
    margin: 0 0 15px 0;
    color: #6c757d;
    font-size: 12px;
}

.pdf-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pdf-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
    background: white;
    color: #007cba !important;
    text-decoration: none !important;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #007cba;
    transition: all 0.3s ease;
}

.pdf-link:hover {
    background: #007cba;
    color: white !important;
}

.pdf-link.preview {
    border-color: #28a745;
    color: #28a745 !important;
}

.pdf-link.preview:hover {
    background: #28a745;
    color: white !important;
}

/* =================================================================
   书籍列表页面的PDF预览链接
   ================================================================= */

.book-preview-pdf {
    margin: 10px 0;
    text-align: center;
}

.preview-pdf-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #28a745;
    color: white !important;
    text-decoration: none !important;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.preview-pdf-link:hover {
    background: #1e7e34;
    color: white !important;
    transform: translateY(-1px);
}

.preview-pdf-link .pdf-icon {
    margin-right: 5px;
}

/* =================================================================
   响应式设计
   ================================================================= */

@media (max-width: 768px) {
    .yi-pdf-downloads-section {
        margin: 20px 0;
        padding: 20px 15px;
    }
    
    .yi-pdf-downloads-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .yi-pdf-download-item {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .yi-pdf-download-item .pdf-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .pdf-downloads-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .account-pdf-item {
        padding: 15px;
    }
    
    .pdf-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .yi-pdf-downloads-title {
        font-size: 20px;
    }
    
    .yi-pdf-download-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .yi-pdf-download-item .pdf-title {
        font-size: 16px;
    }
    
    .yi-account-pdf-downloads {
        padding: 15px;
    }
}

/* =================================================================
   管理后台的PDF上传界面美化
   ================================================================= */

#before-purchase-pdf-section,
#after-purchase-pdf-section {
    background: #f9f9f9;
    transition: all 0.3s ease;
}

#before-purchase-pdf-section:hover,
#after-purchase-pdf-section:hover {
    background: #f1f8ff;
    border-color: #007cba !important;
}

#before-purchase-pdf-section h4,
#after-purchase-pdf-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
}

#upload-preview-pdf,
#upload-full-pdf {
    background: linear-gradient(135deg, #007cba 0%, #00a0d2 100%) !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 5px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
}

#upload-preview-pdf:hover,
#upload-full-pdf:hover {
    background: linear-gradient(135deg, #005a8b 0%, #007cba 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3) !important;
}

#preview-pdf-status,
#full-pdf-status {
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(0, 124, 186, 0.1);
}

/* =================================================================
   PDF下载成功状态指示
   ================================================================= */

.pdf-download-success {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    text-align: center;
    max-width: 400px;
}

.pdf-download-success h3 {
    color: #28a745;
    margin-bottom: 15px;
    font-size: 20px;
}

.pdf-download-success p {
    color: #6c757d;
    margin-bottom: 20px;
}

.pdf-download-success .close-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
}

.pdf-download-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
}

/* =================================================================
   加载状态动画
   ================================================================= */

.pdf-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pdf-loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

