/* ============ 全局重置与基础样式 ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --warning: #e67e22;
  --warning-dark: #c96a1a;
  --danger: #e74c3c;
  --danger-dark: #c0392b;
  --success: #27ae60;
  --success-dark: #1e8449;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --border: #dcdfe6;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --text-muted: #95a5a6;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: 0.25s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============ 弹窗遮罩 ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ============ 通用弹窗 ============ */
.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.35s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
}
.modal-header .modal-icon {
  font-size: 28px;
}

.modal-body {
  padding: 20px 28px;
}

.modal-footer {
  padding: 16px 28px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-light);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}
.btn-close:hover { background: #f0f0f0; color: var(--text); }

/* ============ 免责弹窗 ============ */
.disclaimer-modal {
  max-width: 620px;
}
.disclaimer-content {
  font-size: 14px;
  line-height: 1.9;
  margin-bottom: 20px;
}
.disclaimer-content h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--primary);
  text-align: center;
}
.disclaimer-content ol {
  padding-left: 20px;
  margin: 12px 0;
}
.disclaimer-content ol li {
  margin-bottom: 8px;
}
.disclaimer-warn {
  color: var(--danger);
  font-weight: 600;
  font-size: 13px;
  margin-top: 16px;
  padding: 12px;
  background: #fff5f5;
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--danger);
}

/* 同意勾选 */
.agree-section {
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
}
.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 10px;
}
.checkbox-label input[type="checkbox"] {
  display: none;
}
.checkmark {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.checkbox-label input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}
.checkbox-label input:checked + .checkmark::after {
  content: '✓';
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.agree-text {
  font-size: 14px;
  font-weight: 500;
}

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,115,232,0.35);
}
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--primary-light);
  transform: translateY(-1px);
}
.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover:not(:disabled) {
  background: var(--warning-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(230,126,34,0.35);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-dark);
}
.btn-block {
  width: 100%;
}
.btn-lg {
  padding: 16px 28px;
  font-size: 16px;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.btn-lg small {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.85;
}
.btn-lg .btn-icon {
  font-size: 24px;
}
.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

/* ============ 主页面布局 ============ */
.main-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 40px;
  animation: fadeIn 0.5s ease;
}

/* 顶部导航 */
.header {
  background: linear-gradient(135deg, #1a3a5c 0%, #1a5276 50%, #1a73e8 100%);
  color: #fff;
  padding: 18px 0;
  margin-bottom: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon { font-size: 28px; }
.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}
.header-badge {
  background: rgba(255,255,255,0.2);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

/* 卡片 */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}
.card-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.card-header h2 {
  font-size: 19px;
  font-weight: 700;
}
.card-subtitle {
  color: var(--text-light);
  font-size: 13px;
  margin-top: 4px;
}
.card-body {
  padding: 24px 28px;
}

/* 保险规则 */
.insurance-rules {
  margin-bottom: 24px;
}
.insurance-rules h4 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--primary);
}
.insurance-rules ul {
  list-style: none;
  padding: 0;
}
.insurance-rules ul li {
  padding: 8px 0 8px 28px;
  position: relative;
  font-size: 14px;
  border-bottom: 1px dashed #eee;
}
.insurance-rules ul li::before {
  content: '●';
  position: absolute;
  left: 8px;
  color: var(--primary);
  font-size: 8px;
  top: 13px;
}
.insurance-rules ul li strong {
  color: var(--text);
}

/* 操作按钮组 */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .action-buttons { grid-template-columns: 1fr; }
}

/* 上传区域 */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: #fafbfc;
}
.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-area.small {
  padding: 24px 16px;
}
.upload-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}
.upload-placeholder p {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.upload-placeholder small {
  color: var(--text-muted);
  font-size: 12px;
}
.upload-preview video {
  width: 100%;
  max-height: 280px;
  border-radius: var(--radius-xs);
  background: #000;
}
.preview-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 8px 12px;
  background: #f7f8fa;
  border-radius: var(--radius-xs);
  font-size: 13px;
}

/* 视频需求列表 */
.video-requirements {
  background: #fffef5;
  border: 1px solid #ffeaa7;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}
.video-requirements h4 {
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--warning-dark);
}
.video-requirements ul {
  list-style: none;
  padding: 0;
}
.video-requirements ul li {
  padding: 4px 0 4px 20px;
  position: relative;
  font-size: 13px;
}
.video-requirements ul li::before {
  content: '▸';
  position: absolute;
  left: 4px;
  color: var(--warning);
}

/* 底部 */
.footer {
  text-align: center;
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.admin-link {
  display: inline-block;
  margin-top: 8px;
  color: #ccc;
  text-decoration: none;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.admin-link:hover { color: var(--primary); }

/* ============ 表单 ============ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}
.form-input[readonly] {
  background: #f5f5f5;
  color: var(--text-light);
}
.form-hint {
  text-align: center;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ============ 步骤条 ============ */
.steps {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
  padding: 0 4px;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  cursor: default;
}
.step::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.step:last-child::after { display: none; }
.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  z-index: 1;
  transition: var(--transition);
}
.step span {
  font-size: 11px;
  color: #999;
  margin-top: 6px;
  transition: var(--transition);
}
.step.active .step-number {
  background: var(--primary);
  color: #fff;
}
.step.active span {
  color: var(--primary);
  font-weight: 600;
}
.step.completed .step-number {
  background: var(--success);
  color: #fff;
}
.step.completed span {
  color: var(--success);
}

/* 步骤内容 */
.step-content h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--primary);
}
.step-content > p {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 16px;
}
.step-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* 激活码展示 */
.code-result {
  margin-top: 16px;
  padding: 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
}
.code-display {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}
.code-label {
  color: var(--text-light);
  font-weight: 500;
}
.code-value {
  color: var(--success-dark);
  font-size: 20px;
  letter-spacing: 2px;
  background: #fff;
  padding: 4px 16px;
  border-radius: 4px;
  border: 1px dashed var(--success);
  margin-left: 4px;
}
.code-warn {
  color: var(--warning);
  font-size: 12px;
  text-align: center;
}

/* ============ 结果弹窗 ============ */
.result-modal {
  max-width: 440px;
  text-align: center;
}
.result-modal.success .modal-header h2 { color: var(--success); }
.result-modal.warning .modal-header h2 { color: var(--warning); }
.result-modal .modal-body {
  font-size: 14px;
  line-height: 2;
}

/* ============ 滚动条美化 ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #c0c4cc;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: #a0a4ac; }

/* ============ 表单辅助 ============ */
.label-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}
.input-hint {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ============ 管理员面板 ============ */
.admin-modal {
  max-width: 680px;
}
.admin-body {
  max-height: 60vh;
  overflow-y: auto;
}
.admin-section {
  margin-bottom: 28px;
}
.admin-section h4 {
  font-size: 15px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  color: var(--primary);
}
.admin-generate {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.admin-generate .form-group {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
}
.admin-generate .btn {
  flex-shrink: 0;
  margin-bottom: 0;
}

/* 生成的激活码展示 */
.generated-codes {
  margin-top: 16px;
  padding: 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
}
.generated-codes h5 {
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--success-dark);
}
.code-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.code-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fff;
  border: 1px dashed var(--success);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--success-dark);
}
.code-item .btn {
  font-size: 11px;
  padding: 4px 10px;
}

/* 管理员标签切换 */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}
.admin-tab {
  padding: 8px 18px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-light);
}
.admin-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.admin-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 激活码表格 */
.code-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.code-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.code-table th {
  background: #f8f9fa;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
}
.code-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
}
.code-table td.empty-tip {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}
.code-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.code-badge.unused {
  background: #d1fae5;
  color: #065f46;
}
.code-badge.used {
  background: #fee2e2;
  color: #991b1b;
}

/* ============ 响应式 ============ */
@media (max-width: 600px) {
  .modal { max-width: 95%; }
  .modal-header { padding: 18px 18px 0; }
  .modal-body { padding: 14px 18px; }
  .modal-footer { padding: 12px 18px 18px; }
  .card-header { padding: 18px 18px 12px; }
  .card-body { padding: 18px; }
  .header-inner { flex-direction: column; gap: 8px; }
  .steps { gap: 4px; }
  .step span { font-size: 10px; }
  .admin-generate { flex-direction: column; }
}
