/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    color: #333;
    line-height: 1.6;
    background: #f5f5f5;
    min-height: 100vh;
}

a { color: #c4a34a; text-decoration: none; }
a:hover { color: #a88a2e; }

/* ===== 容器 ===== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ===== 首页 ===== */
.home-bg {
    background: linear-gradient(135deg, #faf8f2 0%, #f0ebe0 50%, #e8e0cc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.home-card {
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.08);
    border: 1px solid rgba(196,163,74,0.2);
    text-align: center;
    max-width: 480px;
    width: 100%;
}

.home-header { margin-bottom: 36px; }

.logo-icon { margin-bottom: 16px; }

.home-header h1 {
    font-size: 32px;
    color: #1a1a2e;
    margin-bottom: 6px;
    letter-spacing: 4px;
}

.subtitle {
    font-size: 15px;
    color: #888;
    letter-spacing: 2px;
}

/* ===== 表单 ===== */
.search-form { text-align: left; }

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    color: #333;
    background: #fafafa;
    transition: all 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #c4a34a;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(196,163,74,0.1);
}

.form-group small {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.required { color: #e74c3c; }

/* ===== 按钮 ===== */
.btn-primary, .btn-secondary, .btn-large {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #c4a34a, #b8943a);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #b8943a, #a8832e);
    color: #fff;
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e5e5e5;
    color: #333;
}

.btn-large {
    width: 100%;
    padding: 14px;
    font-size: 17px;
    letter-spacing: 4px;
}

.btn-block { width: 100%; }

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 16px;
    background: transparent;
    transition: all 0.2s;
}

.btn-icon:hover { background: #f0f0f0; }
.btn-icon.delete:hover { background: #fde8e8; }

.readonly-input {
    background: #f5f5f5 !important;
    color: #888 !important;
    cursor: not-allowed;
}

/* ===== 查询结果 ===== */
.result-card {
    background: #fff;
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.breadcrumb { margin-bottom: 20px; }
.breadcrumb a { color: #888; font-size: 14px; }
.breadcrumb a:hover { color: #333; }

.error-box {
    text-align: center;
    padding: 48px 20px;
}

.error-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: #fde8e8;
    color: #e74c3c;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: bold;
    margin: 0 auto 16px;
}

.success-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: #e6f7ee;
    color: #27ae60;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
}

.cert-found { text-align: center; }

.cert-found h2 {
    font-size: 24px;
    color: #27ae60;
    margin-bottom: 8px;
}

.cert-meta {
    color: #888;
    font-size: 14px;
    margin-bottom: 24px;
}

.cert-preview-wrapper {
    background: #faf8f2;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #eee;
    margin-bottom: 20px;
}

.cert-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.action-bar {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
}

.cert-info-table {
    text-align: left;
    background: #fafafa;
    border-radius: 12px;
    padding: 20px;
}

.cert-info-table h3 {
    font-size: 16px;
    color: #555;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.cert-info-table table {
    width: 100%;
    border-collapse: collapse;
}

.cert-info-table td {
    padding: 8px 12px;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.cert-info-table td:first-child {
    width: 120px;
    color: #888;
    font-weight: 500;
}

/* ===== 首页脚注 ===== */
.home-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.admin-link {
    font-size: 13px;
    color: #bbb;
}

.admin-link:hover { color: #c4a34a; }

/* ===== 登录页 ===== */
.login-bg {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    width: 380px;
    max-width: 100%;
}

.login-card h1 {
    text-align: center;
    font-size: 22px;
    color: #1a1a2e;
    margin-bottom: 28px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.login-footer a {
    color: #888;
    font-size: 13px;
}

/* ===== 告警 ===== */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 20px;
}

.alert-success {
    background: #e6f7ee;
    color: #1a7a42;
    border: 1px solid #b8e6cc;
}

.alert-error {
    background: #fde8e8;
    color: #b03a3a;
    border: 1px solid #f5c6c6;
}

/* ===== 管理后台表单 ===== */
.form-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.admin-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-divider {
    text-align: center;
    color: #ccc;
    margin: 16px 0;
    position: relative;
}

.form-divider::before,
.form-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #eee;
}

.form-divider::before { left: 0; }
.form-divider::after { right: 0; }
.form-divider span { background: #fff; padding: 0 12px; font-size: 13px; }

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* ===== 列表页 ===== */
.list-toolbar { margin-bottom: 16px; }

.search-bar {
    display: flex;
    gap: 8px;
}

.search-bar input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.search-bar input:focus {
    border-color: #c4a34a;
}

.table-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
}

.table-wrapper { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    background: #fafafa;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f5f5f5;
    color: #444;
}

.data-table tr:hover {
    background: #fefcf5;
}

.data-table code {
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 12px;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
}

.action-cell {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px;
    justify-content: center;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 14px;
    color: #555;
    background: #f5f5f5;
    transition: all 0.2s;
}

.page-link:hover {
    background: #e8e4d8;
    color: #333;
}

.page-link.active {
    background: #c4a34a;
    color: #fff;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* ===== 搜索结果详情 ===== */
.search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

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

.result-actions { display: flex; gap: 8px; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0;
}

.detail-item {
    display: flex;
    padding: 14px 20px;
    border-bottom: 1px solid #f5f5f5;
}

.detail-item:nth-child(odd) {
    border-right: 1px solid #f5f5f5;
}

.detail-item label {
    min-width: 100px;
    color: #888;
    font-size: 13px;
}

.detail-item span {
    color: #333;
    font-size: 14px;
}

/* ===== 打印样式 ===== */
@media print {
    .action-bar, .breadcrumb, .cert-info-table, .admin-link {
        display: none !important;
    }
    .result-card { box-shadow: none; padding: 0; }
    .cert-image { max-width: 100%; }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .container { padding: 20px 12px; }
    .home-card { padding: 32px 24px; }
    .result-card { padding: 20px; }
    
    .admin-form .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .action-bar { flex-direction: column; }
    
    .stats-grid { grid-template-columns: 1fr; }
    .action-grid { grid-template-columns: 1fr; }
    
    .admin-main { margin-left: 0; padding: 16px; }
    .admin-sidebar { display: none; }
    
    .detail-grid { grid-template-columns: 1fr; }
    .detail-item:nth-child(odd) { border-right: none; }
}

.total-badge {
    font-size: 14px;
    color: #888;
    background: #f0f0f0;
    padding: 6px 14px;
    border-radius: 20px;
}
