/* ============================================================
   红木审核单查询系统 — 样式表
   ============================================================ */

/* --- 1. Custom Properties --- */
:root {
  --primary: #1a5276;
  --primary-dark: #143e5a;
  --primary-light: #2e7aa8;
  --primary-surface: #f0f5fa;
  --primary-border: #a0bfd4;

  --bg: #eef1f5;
  --card-bg: #FFFFFF;
  --text-primary: #1a2530;
  --text-secondary: #3d4f63;
  --text-muted: #6b8299;
  --border: #d2dae3;
  --border-light: #e8ecf2;

  --error: #CF1322;
  --error-bg: #FFF2F0;
  --seal-red: #a04040;
  --gold: #7eb8da;

  --font-sans: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(26, 82, 118, 0.06);
  --shadow-md: 0 4px 18px rgba(26, 82, 118, 0.08);
  --shadow-lg: 0 8px 30px rgba(26, 82, 118, 0.10);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* --- 2. Base & Body --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(26, 82, 118, 0.025) 1px, transparent 1px);
  background-size: 30px 30px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: 40px 16px;
  -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: 700px; }
.container-wide { max-width: 860px; }

/* --- 3. Typography --- */
h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  position: relative;
  padding-bottom: 16px;
  margin-bottom: 28px;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--gold), var(--primary));
  border-radius: 2px;
}

/* --- 4. Card --- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  position: relative;
  animation: cardFadeIn 0.4s ease both;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 36px;
  right: 36px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--gold), var(--primary));
  border-radius: 0 0 3px 3px;
}

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

/* --- 5. Form Inputs --- */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--card-bg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.12);
}

/* --- 6. Captcha --- */
.captcha-group .captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.captcha-group img {
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  cursor: pointer;
}

.captcha-group input {
  flex: 1;
  min-width: 100px;
  max-width: 140px;
}

.btn-refresh {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.btn-refresh:hover {
  background: var(--primary-surface);
  border-color: var(--primary-border);
  color: var(--primary);
}

/* --- 7. Buttons --- */
.btn-submit {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: all var(--transition-normal);
}

.btn-submit:hover {
  background: linear-gradient(135deg, var(--primary-dark), #0d2333);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(26, 82, 118, 0.22);
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: none;
}

/* --- 8. Alerts --- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.9rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error {
  background: var(--error-bg);
  border: 1px solid #ffccc7;
  color: var(--error);
}

.alert-error::before {
  content: '!';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.field-error {
  color: var(--error);
  font-size: 0.8rem;
  display: block;
  margin-top: 4px;
}

/* --- 9. Search Footer --- */
.search-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- 10. Result Card --- */
.result-card {
  max-width: 860px;
  overflow: hidden;
}

.result-card::after {
  content: '\5BA1\6838\4E13\7528';
  position: absolute;
  top: 30px;
  right: 28px;
  width: 80px;
  height: 80px;
  border: 3px solid var(--seal-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--seal-red);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-serif);
  opacity: 0.22;
  transform: rotate(-15deg);
  pointer-events: none;
  user-select: none;
}

/* --- 11. Cert Header --- */
.cert-header {
  text-align: center;
  margin-bottom: 28px;
}

.cert-id {
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 600;
  font-family: var(--font-serif);
  letter-spacing: 0.03em;
  background: var(--primary-surface);
  display: inline-block;
  padding: 6px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary-border);
}

/* --- 12. Section Headers --- */
.section {
  margin-bottom: 28px;
  padding: 0 4px;
}

.section h2 {
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
  position: relative;
}

.section h2::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

/* --- 13. Info Tables --- */
.info-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.info-table td {
  padding: 10px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.6;
}

.info-table tr:last-child td { border-bottom: none; }

.info-table td.label {
  width: 120px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  background: #f4f7fa;
  vertical-align: top;
}

.info-table tr:nth-child(even) td:not(.label) {
  background: #f7f9fc;
}

/* --- 14. Photo Grid --- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.photo-item {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  cursor: pointer;
}

.photo-item:hover {
  transform: scale(1.025);
  box-shadow: var(--shadow-sm);
}

.no-photo {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 24px;
  text-align: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

/* --- 15. Signature Section --- */
.signature-table td.label {
  width: 75px;
  background: transparent;
}

.signature-table td {
  padding: 8px 14px;
  font-size: 0.9rem;
}

/* --- 16. Navigation --- */
.nav-back {
  margin-top: 28px;
  text-align: center;
}

.nav-back a {
  display: inline-block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 10px 24px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-back a:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-surface);
}

/* --- 17. Error Pages --- */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.error-card {
  text-align: center;
  max-width: 440px;
  width: 100%;
}

.error-code {
  font-size: clamp(4rem, 12vw, 6rem);
  font-weight: 800;
  color: var(--primary);
  font-family: var(--font-serif);
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}

.error-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  border-radius: 2px;
  margin: 16px auto;
}

.error-message {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.error-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.error-action {
  display: inline-block;
  padding: 11px 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all var(--transition-normal);
}

.error-action:hover {
  background: linear-gradient(135deg, var(--primary-dark), #0d2333);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 82, 118, 0.20);
}

/* --- 18. Animations & Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --- 19. Responsive: 768px --- */
@media (max-width: 768px) {
  .card {
    padding: 28px 24px;
  }

  .card::before {
    left: 24px;
    right: 24px;
  }

  .info-table td.label { width: 100px; }

  .result-card::after {
    width: 64px;
    height: 64px;
    font-size: 12px;
    top: 22px;
    right: 18px;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* --- 20. Responsive: 600px --- */
@media (max-width: 600px) {
  body { padding: 20px 12px; }

  .card {
    padding: 24px 18px;
    border-radius: var(--radius-md);
  }

  .card::before {
    left: 18px;
    right: 18px;
  }

  h1 { font-size: 1.15rem; }

  .form-group input[type="text"],
  .form-group input[type="password"] {
    font-size: 16px;
    padding: 12px;
  }

  .info-table td {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .info-table td.label {
    width: 85px;
    font-size: 0.8rem;
  }

  .photo-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .photo-item {
    height: auto;
    max-height: 250px;
    aspect-ratio: 4/3;
  }

  .captcha-group .captcha-row { gap: 6px; }
  .captcha-group input { min-width: 80px; }

  .cert-id {
    font-size: 0.95rem;
    padding: 5px 14px;
  }

  .result-card::after {
    width: 54px;
    height: 54px;
    font-size: 10px;
    border-width: 2px;
    top: 16px;
    right: 12px;
  }
}

/* --- 21. Responsive: 400px --- */
@media (max-width: 400px) {
  .card {
    padding: 18px 14px;
  }

  .card::before {
    left: 14px;
    right: 14px;
  }

  /* Stack label above value on narrowest screens */
  .info-table td.label {
    display: block;
    width: 100%;
    padding-bottom: 0;
  }

  .info-table td:not(.label) {
    display: block;
    padding-top: 2px;
    padding-bottom: 10px;
    background: transparent !important;
  }

  .info-table tr {
    display: block;
    border-bottom: 1px solid var(--border-light);
  }

  .info-table tr:last-child { border-bottom: none; }

  /* Keep signature section as a proper table */
  .signature-table td.label {
    display: table-cell;
    width: 60px;
    padding-bottom: 8px;
  }

  .signature-table td:not(.label) {
    display: table-cell;
    padding-bottom: 8px;
  }

  .signature-table tr {
    display: table-row;
    border-bottom: none;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }
}

/* --- 22. Print --- */
@media print {
  body {
    background: #fff;
    padding: 0;
    color: #000;
  }

  .card {
    box-shadow: none;
    border-radius: 0;
    border: none;
    padding: 0;
    animation: none;
  }

  .card::before { display: none; }

  .result-card::after { opacity: 0.12; }

  h1::after { background: #333; }
  h1, .section h2, .cert-id { color: #000; }
  .section h2 { border-bottom-color: #333; }
  .section h2::after { display: none; }

  .info-table { border: 1px solid #ddd; }
  .info-table td { border-bottom-color: #ddd; }
  .info-table td.label { background: #f5f5f5; color: #333; }
  .info-table tr:nth-child(even) td:not(.label) { background: transparent; }

  .nav-back, .btn-submit, .btn-refresh { display: none; }

  .photo-item {
    break-inside: avoid;
    max-height: 180px;
  }

  .cert-id {
    border: 1px solid #999;
    background: transparent;
  }
}
