:root {
  --theme: #4153ff;
  --radius-1: 4px;
  --radius-2: 6px;
  --bg-color: #f6f6f6;
  --text-color: #222222;
  --text-light: #707070;
  --border-color: #e9e9e9;
  --success-color: #11d55c;
  --error-color: #fc4d4d;
  --warning-color: #ff9800;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

button {
  border-radius: var(--radius-1);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

body {
  position: relative;
  background-color: var(--bg-color);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px;
}

/* Container */
.container {
  max-width: 940px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.header {
  margin-top: 50px;
  text-align: center;
  padding: 40px 0;
  background: linear-gradient(135deg, var(--theme) 0%, #5a6bff 100%);
  color: white;
  border-radius: var(--radius-2);
  margin-bottom: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.header h1 {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.header p {
  font-size: 14px;
  opacity: 0.9;
}

/* Query Section */
.query-section {
  background: white;
  padding: 40px;
  border-radius: var(--radius-2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  margin-bottom: 30px;
  width: 100%;
}

.query-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 200px;
  margin-bottom: 20px;
}

.form-group label {
  display: inline-block;
  margin-bottom: 8px;
  margin-right: 0;
  font-weight: 600;
  color: var(--text-color);
  font-size: 14px;
  min-width: 55px;
}

.form-group input {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-1);
  font-size: 14px;
  transition: all 0.3s ease;
  background-color: white;
}

.form-group input:focus {
  outline: none;
  border-color: var(--theme);
  box-shadow: 0 0 0 2px rgba(65, 83, 255, 0.2);
}

/* Captcha Section */
.captcha-group {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.captcha-group input {
  flex: 1;
}

.captcha-img {
  width: 120px;
  height: 40px;
  border-radius: var(--radius-1);
  cursor: pointer;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  color: var(--theme);
  letter-spacing: 4px;
  user-select: none;
  border: 1px solid var(--border-color);
}

/* Button */
.btn {
  width: 100%;
  padding: 10px;
  background-color: var(--theme);
  color: white;
  border: none;
  border-radius: var(--radius-1);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(65, 83, 255, 0.3);
}

.btn:hover {
  background-color: #3a47e0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(65, 83, 255, 0.4);
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Status Messages */
.status {
  text-align: center;
  padding: 16px;
  margin-bottom: 30px;
  border-radius: var(--radius-1);
  font-size: 14px;
  display: none;
  width: 100%;
}

.status.show {
  display: block;
}

.loading {
  background-color: #e3f2fd;
  color: #1976d2;
  border: 1px solid #bbdefb;
}

.error {
  background-color: #ffebee;
  color: var(--error-color);
  border: 1px solid #ffcdd2;
}

.loading::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 10px;
  border: 2px solid #1976d2;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Certificate Result Section */
.certificate-container {
  display: none;
  margin-bottom: 30px;
  width: 100%;
}

.certificate-container.show {
  display: block;
}

.certificate-title {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  padding: 20px;
}

.certificate-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 16px;
}

.btn-print,
.btn-preview {
  padding: 7px 20px;
  border-radius: var(--radius-1);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--theme);
}

.btn-print {
  background-color: var(--theme);
  color: white;
}

.btn-print:hover {
  background-color: #3a47e0;
}

.btn-preview {
  background-color: white;
  color: var(--theme);
}

.btn-preview:hover {
  background-color: #f6f9ff;
}

.certificate-title h2 {
  color: var(--theme);
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 10px;
}

/* Certificate Card */
.certificate-card {
  position: relative;
  padding: 40px 90px;
  min-height: 1060px; /* 增加高度以完全显示背景图片 */
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

/* Certificate Header */
.certificate-header {
  text-align: center;
  margin-top: 170px;
  margin-bottom: 30px;
  padding: 0 20px;
}

.certificate-header h3 {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 15px;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.9);
  line-height: 1.2;
}

.certificate-header p {
  font-size: 18px;
  color: var(--text-light);
  margin-bottom: 12px;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.responsive-padding {
  padding-top: 350px;
}

/* Certificate Content */
.certificate-content {
  margin-bottom: 40px;
}

.certificate-info {
  padding: 20px 80px;
  max-width: 600px;
  margin: 0 auto;
}

.info-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 15px;
  margin-bottom: 6px;
}

.info-label {
  font-size: 18px;
  color: var(--text-light);
  margin-right: 10px;
  min-width: 150px;
  text-align: right;
}

.info-value {
  font-size: 18px;
  color: var(--text-color);
  font-weight: 600;
}

/* Certificate Footer */
.certificate-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: var(--radius-1);
  backdrop-filter: blur(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.certificate-date {
  font-size: 13px;
  color: var(--text-light);
}

.certificate-qr {
  width: 100px;
  height: 100px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-1);
  padding: 10px;
}

.certificate-qr img {
  width: 100%;
  height: 100%;
}

/* Footer */
footer {
  font-size: 12px;
  margin-bottom: 20px;
  margin-top: 20px;
  color: var(--text-light);
  font-weight: 400;
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    width: 100%;
  }
  .certificate-header {
    margin-top: 80px;
  }
  .certificate-header h3 {
    font-size: 18px;
  }

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

  .query-section {
    padding: 20px;
  }

  .form-row {
    flex-direction: column;
  }

  .form-group label {
    text-align: left;
    margin-right: 0;
  }

  .certificate-container {
    padding: 10px;
    margin-bottom: 0;
  }

  .certificate-card {
    padding: 40px;
    min-height: 520px;
  }

  .responsive-padding {
    padding-top: 180px;
  }

  .certificate-info {
    padding: 10px;
  }

  .info-item {
    align-items: center;
    text-align: center;
    padding: 0;
  }

  .info-label {
    min-width: 110px;
    margin-right: 0;
    margin-bottom: 4px;
    font-size: 14px;
  }

  .info-value {
    font-size: 14px;
  }

  .certificate-footer {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .certificate-header h3 {
    font-size: 24px;
  }

  .certificate-header p {
    font-size: 14px;
  }

  .certificate-actions {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .btn-print,
  .btn-preview {
    width: 100%;
    max-width: 200px;
    text-align: center;
  }
}

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

.header,
.query-section,
.certificate-container {
  animation: fadeIn 0.5s ease-out;
}
