/* ===== 证书查询系统 全局样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a6cf5;
  --primary-dark: #1559cc;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #e5484d;
  --success: #17753a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--primary); }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* 顶栏 */
.topbar { background: #fff; border-bottom: 1px solid var(--border); padding: 14px 0; margin-bottom: 24px; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-size: 20px; font-weight: 700; color: var(--primary); text-decoration: none; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 24px; margin-bottom: 20px; }
.card h2 { font-size: 18px; margin-bottom: 14px; }

/* 表单 */
.search-form { display: flex; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.req { color: var(--danger); }
input[type="text"], input[type="password"], input[type="search"], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; background: #fff; color: var(--text);
  font-family: inherit; resize: vertical;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,108,245,.15); }
.search-input { flex: 1; min-width: 240px; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 4px; }
.hint-text { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* 按钮 */
.btn { display: inline-block; padding: 10px 18px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; text-decoration: none; background: var(--primary); color: #fff; line-height: 1.4; }
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: #eef1f6; color: var(--text); }
.btn-secondary:hover { background: #e2e6ec; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c93c41; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: #f8f9fb; font-weight: 600; white-space: nowrap; }
tbody tr:hover td { background: #fafbfd; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* 提示消息 */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.success { background: #e8f8ee; color: var(--success); border: 1px solid #b8e7c6; }
.flash.error { background: #fdebec; color: #a11f24; border: 1px solid #f6c6c8; }

/* 分页 */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--text); font-size: 13px; background: #fff; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination span { color: var(--muted); }

/* 后台 */
.admin-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.login-box { max-width: 400px; margin: 90px auto; }
.login-box .card { padding: 32px; }
.login-captcha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.login-captcha-q { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }
.login-captcha input[type="text"] { width: 130px; }
.login-captcha-refresh { white-space: nowrap; font-size: 13px; }
.actions { display: flex; gap: 8px; white-space: nowrap; align-items: center; }

/* ===== 前台证书查验页（检测报告在线查验） ===== */
.hero {
  position: relative;
  background: #0b1f3a url("hero-bg.jpg") no-repeat center / cover;
  color: #fff;
  padding: 64px 0 88px;
  text-align: center;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8,20,40,.55), rgba(8,20,40,.28));
}
.hero-logo {
  position: absolute; top: 12px; left: 16px; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px);
  border-radius: 10px; padding: 6px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.hero-logo img { height: 54px; width: auto; display: block; }
.hero-logo-text {
  font-size: 16px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero-inner { position: relative; z-index: 1; }
.hero h1 { font-size: 34px; letter-spacing: 2px; font-weight: 700; }
.hero-form { max-width: 760px; margin: 28px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hero-form input[type="search"] {
  flex: 1; min-width: 0; padding: 14px 18px; font-size: 15px; border: none; border-radius: 8px;
  background: #fff; color: var(--text); box-shadow: 0 4px 18px rgba(0,0,0,.18);
}
.hero-form input[type="search"]:focus { outline: none; box-shadow: 0 0 0 3px rgba(37,163,90,.45), 0 4px 18px rgba(0,0,0,.18); }
.btn-hero {
  padding: 14px 34px; border: none; border-radius: 8px; cursor: pointer;
  background: #25a35a; color: #fff; font-size: 16px; font-weight: 600; letter-spacing: 2px;
  box-shadow: 0 4px 18px rgba(37,163,90,.35);
}
.btn-hero:hover { background: #1f8f4f; }
.hero-slogan { margin-top: 20px; color: rgba(255,255,255,.9); font-size: 14px; letter-spacing: 1px; }

/* 查询结果 */
.prompt-card h3 { margin-bottom: 8px; }
.result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.result-head h2 { margin: 0; font-size: 20px; letter-spacing: .5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot-ok { background: var(--success); }
.dot-error { background: var(--danger); }
.cert-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cert-table th, .cert-table td { padding: 14px 18px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.cert-table th { width: 220px; background: #f6f8fb; font-weight: 600; color: #333; white-space: nowrap; }
.cert-table .field-first { font-weight: 700; color: #0d0d12; }
.cert-table .field-pre { white-space: pre-wrap; word-break: break-word; }

/* 页脚（公司名称与联系方式） */
.site-footer {
  margin-top: 40px; padding: 30px 0;
  background: #0f2038; color: rgba(255,255,255,.85);
  text-align: center; font-size: 14px;
}
.site-footer .footer-name { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.site-footer .footer-contact { line-height: 1.9; }

/* 系统设置页 Logo 预览 */
.logo-preview {
  height: 52px; width: auto; max-width: 320px;
  border: 1px solid var(--border); border-radius: 8px; padding: 6px;
  background: #fff; display: block;
}

/* 系统设置页 页头背景图预览 */
.bg-preview {
  width: 100%; max-width: 640px; height: auto; max-height: 260px;
  object-fit: cover;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; display: block;
}

/* 后台左侧菜单栏布局 */
.admin-body { display: flex; align-items: stretch; min-height: 100vh; }
.admin-sidebar {
  width: 220px; flex: none;
  background: #0f2038; color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { padding: 20px 18px; font-size: 15px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand a { color: #fff; text-decoration: none; }
.sidebar-nav { flex: 1; padding: 14px 0; display: flex; flex-direction: column; overflow-y: auto; }
.sidebar-nav a {
  display: block; padding: 12px 20px;
  color: rgba(255,255,255,.78); text-decoration: none; font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.10); color: #fff; border-left-color: #25a35a; font-weight: 600; }
.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; color: rgba(255,255,255,.7); }
.sidebar-foot a { display: block; margin-top: 10px; color: #fff; text-decoration: none; }
.sidebar-toggle {
  display: none;
  width: 34px; height: 30px; padding: 0;
  border: 1px solid rgba(255,255,255,.25); border-radius: 6px;
  background: rgba(255,255,255,.06);
  cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.sidebar-toggle span { display: block; width: 16px; height: 2px; border-radius: 1px; background: #fff; }
.sidebar-toggle:hover { background: rgba(255,255,255,.14); }
.admin-main { flex: 1; min-width: 0; padding: 24px 16px; }
.admin-main .container { max-width: 1200px; }

/* 证书详情弹窗 */
.modal-mask {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,32,56,.55);
  align-items: center; justify-content: center;
  padding: 16px;
  z-index: 1000;
}
.modal-mask.show { display: flex; }
.modal-box {
  background: #fff; border-radius: 12px;
  max-width: 640px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e8ecf1; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close {
  width: 28px; height: 28px; border: none;
  background: #f2f4f7; border-radius: 6px;
  cursor: pointer; font-size: 16px; line-height: 1; color: #555;
}
.modal-close:hover { background: #e6eaef; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px 16px; text-align: right; border-top: 1px solid #f0f2f5; }
body.modal-open { overflow: hidden; }
table.list-table tbody tr.row-click { cursor: pointer; }

@media (max-width: 720px) {
  .admin-body { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; flex-direction: column; }
  .sidebar-brand { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 14px; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar-nav, .sidebar-foot { display: none; }
  .admin-body.nav-open .sidebar-nav { display: flex; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 8px 10px; }
  .admin-body.nav-open .sidebar-nav a { flex: none; border-left: none; border-bottom: 3px solid transparent; padding: 10px 14px; white-space: nowrap; }
  .admin-body.nav-open .sidebar-nav a.active { border-bottom-color: #25a35a; }
  .admin-body.nav-open .sidebar-foot { display: flex; flex-direction: row; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,.12); padding: 8px 14px; }
  .admin-body.nav-open .sidebar-foot a { margin-top: 0; }
  .admin-main { padding: 14px 10px; }
  /* 证书列表窄屏只保留：证书编号 / 产品名称 / 申请人 / 操作 */
  .list-table .col-id,
  .list-table .col-manu,
  .list-table .col-model,
  .list-table .col-additional,
  .list-table .col-time { display: none; }
}

@media (max-width: 900px) {
  .hero-logo { top: 10px; left: 12px; padding: 5px 12px; }
  .hero-logo img { height: 44px; }
  .hero-logo-text { font-size: 14px; }
}

@media (max-width: 640px) {
  .hero { padding: 44px 0 60px; }
  .hero h1 { font-size: 24px; }
  .hero-form { flex-direction: column; }
  .btn-hero { width: 100%; order: 2; }
  .cert-table th { width: auto; }
  .card { padding: 16px; }
  .hero-logo { top: 8px; left: 10px; max-width: calc(100vw - 20px); padding: 4px 10px; gap: 6px; border-radius: 8px; }
  .hero-logo img { height: 34px; }
  .hero-logo-text { font-size: 12px; }
  th, td { padding: 8px 6px; font-size: 13px; }
  .admin-title { align-items: flex-start; }
  .login-box { margin: 40px 16px; }
  .pagination a, .pagination span { padding: 6px 9px; }
  .cert-table th, .cert-table td { padding: 10px 12px; }
}
