/**
 * 证书查询系统 - 前端样式
 * 响应式设计，支持PC和移动端
 */

/* 基础样式重置 */
.certificate-query-container * {
    box-sizing: border-box;
}

.certificate-query-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* 标题样式 */
.certificate-query-title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
    border-bottom: 3px solid #3498db;
    padding-bottom: 15px;
}

/* 表单样式 */
.certificate-query-form {
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e8ed;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 16px;
}

.required {
    color: #e74c3c;
    margin-left: 3px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #fafbfc;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group input[type="text"]:invalid {
    border-color: #e74c3c;
}

/* 错误信息样式 */
.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

/* 按钮样式 */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, #1f618d);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.btn-download {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
    margin-top: 20px;
}

.btn-download:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

/* 加载指示器 */
.loading-indicator {
    text-align: center;
    padding: 20px;
    display: none;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

/* 查询结果样式 */
.query-results {
    margin-top: 30px;
    animation: fadeIn 0.5s ease-in;
}

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

/* 证书详情样式 */
.certificate-detail {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e1e8ed;
}

.certificate-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.certificate-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.certificate-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-valid {
    background: #27ae60;
    color: white;
}

.status-expired {
    background: #e74c3c;
    color: white;
}

.status-disabled {
    background: #95a5a6;
    color: white;
}

.status-pending {
    background: #f39c12;
    color: white;
}

.certificate-content {
    padding: 30px;
}

.certificate-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item span {
    font-size: 16px;
    color: #34495e;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
}

.info-item .name {
    font-weight: 700;
    font-size: 18px;
    color: #2c3e50;
}

.info-item .certificate-no {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* 证书图片样式 */
.certificate-image {
    margin: 30px 0;
}

.certificate-image label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 16px;
}

.image-container {
    text-align: center;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.cert-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.cert-image:hover {
    transform: scale(1.02);
}

/* 图片模态框 */
.image-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

.close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.close:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* 证书操作按钮 */
.certificate-actions {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ecf0f1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .certificate-query-container {
        padding: 15px;
    }
    
    .certificate-query-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .certificate-query-form {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
    }
    
    .certificate-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .certificate-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .certificate-content {
        padding: 20px;
    }
    
    .image-container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .certificate-query-container {
        padding: 10px;
    }
    
    .certificate-query-form {
        padding: 15px;
    }
    
    .certificate-content {
        padding: 15px;
    }
    
    .form-group input[type="text"] {
        font-size: 16px; /* 防止iOS缩放 */
    }
}

/* 错误状态样式 */
.form-group.error input[type="text"] {
    border-color: #e74c3c;
    background-color: #fdf2f2;
}

.form-group.error .error-message {
    display: block;
}

/* 成功状态样式 */
.form-group.success input[type="text"] {
    border-color: #27ae60;
    background-color: #f0f9f0;
}

/* 动画效果 */
.certificate-query-container {
    animation: slideIn 0.6s ease-out;
}

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

/* 打印样式 */
@media print {
    .certificate-query-container {
        box-shadow: none;
        border: none;
    }
    
    .form-actions,
    .btn {
        display: none;
    }
    
    .certificate-detail {
        box-shadow: none;
        border: 1px solid #000;
    }
}
