/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --admin-primary: #0d6efd;
    --admin-primary-dark: #0a58ca;
    --admin-accent: #17a2b8;
    --admin-success: #22c55e;
    --admin-surface: #ffffff;
    --admin-bg: #f1f4fb;
    --admin-muted: #6b7280;
    --admin-border: #e2e8f0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--admin-bg);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    color: #1f2933;
}

/* 为查询页面单独设置居中样式 */
body.certificate-query {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 容器 */
.container {
    max-width: 900px;
    margin: 0 auto;
}

/* 查询页面容器 */
body.certificate-query .container {
    width: 100%;
}

/* 头部样式 */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(13, 110, 253, 0.3);
}

.header h1 {
    font-size: 48px;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 18px;
    opacity: 0.95;
}

/* 搜索卡片 */
.search-card {
    background: var(--admin-surface);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid var(--admin-border);
}

/* 表单组 */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 15px;
}

.label-icon {
    margin-right: 8px;
    font-size: 18px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--admin-border);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: #f8fafc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
    background: white;
}

/* 按钮样式 */
.btn-search {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

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

.btn-download {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 30px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-download:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

/* 结果卡片 */
.result-card {
    background: var(--admin-surface);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid var(--admin-border);
}

.result-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--admin-border);
}

.success-icon,
.error-icon {
    font-size: 60px;
    display: block;
    margin-bottom: 15px;
}

.result-header h2 {
    color: #333;
    font-size: 28px;
}

/* 证书信息网格 */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-item {
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid var(--admin-primary);
    transition: transform 0.3s ease;
}

.info-item:hover {
    transform: translateX(5px);
}

.info-label {
    font-weight: 600;
    color: var(--admin-muted);
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 18px;
    color: #1f2933;
    font-weight: 600;
}

/* 证书图片 */
.certificate-image {
    margin-top: 30px;
    text-align: center;
}

.certificate-image h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

/* 预览元素字体 */
#pv_name, #pv_idcard, #pv_certname, #pv_certnum, #pv_level, #pv_examscore, #pv_issuedate,
.draggable-item {
    font-family: 'Microsoft YaHei', 'SimHei', sans-serif !important;
}

.certificate-image img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--admin-border);
}

/* 禁用证书图片的所有交互功能 */
.certificate-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
    pointer-events: none; /* 禁用所有鼠标事件 */
    -webkit-user-select: none; /* 禁用文本选择 */
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    overflow: hidden;
    border-radius: 12px;
}

.certificate-preview img {
    max-width: 100%;
    height: auto;
    display: block;
    -webkit-user-drag: none; /* 禁用拖拽 */
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--admin-border);
    /* 防止图片被浏览器默认行为放大 */
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
    cursor: default; /* 显示默认光标 */
    /* 防止图片被缩放 */
    transform: scale(1);
    transform-origin: center center;
    transition: none !important;
}

.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 禁用水印的交互 */
    opacity: 0.3;
    /* 确保水印始终在最上层 */
    z-index: 10;
    /* 防止水印被意外缩放或移动 */
    transform: scale(1);
    transform-origin: center center;
    transition: none !important;
}

/* 增强防止图片放大的措施 */
.certificate-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

/* 禁用所有可能的交互 */
.certificate-preview * {
    pointer-events: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    -khtml-user-drag: none !important;
    -moz-user-drag: none !important;
    -o-user-drag: none !important;
    user-drag: none !important;
    -webkit-touch-callout: none !important;
    -webkit-tap-highlight-color: transparent !important;
    cursor: default !important;
}

/* 错误消息 */
.error-message {
    text-align: center;
    color: #e74c3c;
    font-size: 16px;
    margin-top: 20px;
    padding: 20px;
    background: #fdf2f2;
    border-radius: 10px;
    border-left: 4px solid #e74c3c;
}

.result-card.error {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    border-left: 4px solid #e74c3c;
}

.result-card.success {
    background: var(--admin-surface);
    border-left: 4px solid var(--admin-success);
}

/* 页脚 */
.footer {
    text-align: center;
    color: var(--admin-muted);
    padding: 30px 20px;
    margin-top: 40px;
    font-size: 14px;
}

.footer p {
    opacity: 0.9;
}

.footer a {
    color: var(--admin-primary);
    text-decoration: underline;
    font-weight: 600;
}

.footer a:hover {
    opacity: 0.8;
}

/* 响应式设计 - 平板 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 36px;
    }

    .subtitle {
        font-size: 16px;
    }

    .search-card,
    .result-card {
        padding: 25px;
        border-radius: 15px;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .form-group input,
    .form-group select {
        font-size: 16px;
    }
    
    .info-item {
        padding: 15px;
    }
    
    .info-value {
        font-size: 16px;
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 20px 10px;
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 14px;
    }

    .search-card,
    .result-card {
        padding: 20px;
        border-radius: 12px;
    }

    .btn-search {
        padding: 14px;
        font-size: 16px;
    }

    .result-header h2 {
        font-size: 22px;
    }

    .success-icon,
    .error-icon {
        font-size: 48px;
    }

    .certificate-image h3 {
        font-size: 18px;
    }

    .info-item {
        padding: 12px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 平滑过渡 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* 输入验证样式 */
input:invalid {
    border-color: var(--admin-border);
}

input:valid {
    border-color: var(--admin-success);
}

/* 辅助文本 */
small {
    display: block;
    margin-top: 5px;
    color: var(--admin-muted);
    font-size: 13px;
}

/* 表格样式（用于管理后台） */
table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

table tr:hover {
    background: #f8f9fa;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination a {
    padding: 10px 15px;
    background: var(--admin-surface);
    color: var(--admin-primary);
    text-decoration: none;
    border-radius: 8px;
    border: 2px solid var(--admin-primary);
    transition: all 0.3s ease;
}

.pagination a:hover,
.pagination a.active {
    background: var(--admin-primary);
    color: white;
}

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

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #333;
    color: white;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 12px;
    z-index: 1000;
}