/**
 * 白皮书留资弹窗样式
 * 设计语言对齐 .planning/04-visual-ux.md（暗底 + 橙蓝双色 + 卡片圆角 12）
 */

:root {
  --wpr-orange: #f04d1e;
  --wpr-blue: #009ace;
  --wpr-cyan: #00e5ff;
  --wpr-bg-1: #0d1117;
  --wpr-bg-2: #161b22;
  --wpr-bg-3: #21262d;
  --wpr-border: #30363d;
  --wpr-text: #f0f6fc;
  --wpr-text-2: #8b949e;
  --wpr-error: #f85149;
  --wpr-success: #3fb950;
}

/* 遮罩层 */
.wpr-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms cubic-bezier(.4,0,.2,1);
}

.wpr-mask.wpr-open {
  opacity: 1;
  pointer-events: auto;
}

/* 弹窗主体 */
.wpr-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -45%) scale(0.96);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  background: var(--wpr-bg-1);
  border: 1px solid var(--wpr-border);
  border-radius: 16px;
  box-shadow: 0 0 64px rgba(240, 77, 30, 0.18), 0 16px 48px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 250ms cubic-bezier(.4,0,.2,1), opacity 250ms;
  color: var(--wpr-text);
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
}

.wpr-modal.wpr-open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* 头部 */
.wpr-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--wpr-border);
  background: linear-gradient(135deg, rgba(240,77,30,0.08), rgba(0,154,206,0.05));
}

.wpr-header h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.3;
}

.wpr-header .wpr-sub {
  font-size: 13px;
  color: var(--wpr-text-2);
  margin: 0;
  line-height: 1.5;
}

.wpr-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--wpr-border);
  background: var(--wpr-bg-2);
  color: var(--wpr-text);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease-out;
  line-height: 1;
}

.wpr-close:hover {
  border-color: var(--wpr-orange);
  color: var(--wpr-orange);
}

/* 表单区 */
.wpr-body {
  padding: 24px 28px;
  overflow-y: auto;
}

.wpr-row {
  margin-bottom: 16px;
}

.wpr-row.wpr-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wpr-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--wpr-text);
}

.wpr-label .wpr-required {
  color: var(--wpr-orange);
  margin-left: 2px;
}

.wpr-input,
.wpr-select,
.wpr-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--wpr-bg-2);
  border: 1px solid var(--wpr-border);
  border-radius: 8px;
  color: var(--wpr-text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 150ms;
  box-sizing: border-box;
}

.wpr-input:focus,
.wpr-select:focus,
.wpr-textarea:focus {
  outline: none;
  border-color: var(--wpr-blue);
  box-shadow: 0 0 0 3px rgba(0, 154, 206, 0.15);
}

.wpr-input.wpr-error,
.wpr-select.wpr-error {
  border-color: var(--wpr-error);
}

.wpr-input::placeholder,
.wpr-textarea::placeholder {
  color: var(--wpr-text-2);
  opacity: 0.7;
}

.wpr-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b949e' viewBox='0 0 16 16'%3e%3cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* 复选框组 */
.wpr-checkbox-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.wpr-checkbox-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--wpr-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  background: var(--wpr-bg-2);
  transition: all 150ms;
  user-select: none;
}

.wpr-checkbox-item:hover {
  border-color: var(--wpr-blue);
}

.wpr-checkbox-item input {
  margin-right: 8px;
  cursor: pointer;
  accent-color: var(--wpr-orange);
}

.wpr-checkbox-item.wpr-checked {
  border-color: var(--wpr-orange);
  background: rgba(240, 77, 30, 0.08);
}

/* 错误提示 */
.wpr-field-error {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--wpr-error);
  min-height: 16px;
}

/* 隐私协议 */
.wpr-privacy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--wpr-text-2);
  line-height: 1.5;
}

.wpr-privacy input {
  margin-top: 3px;
  accent-color: var(--wpr-orange);
  cursor: pointer;
}

.wpr-privacy a {
  color: var(--wpr-blue);
  text-decoration: none;
}

.wpr-privacy a:hover {
  text-decoration: underline;
}

/* 底部按钮 */
.wpr-footer {
  padding: 16px 28px 24px;
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--wpr-border);
  background: var(--wpr-bg-1);
}

.wpr-btn {
  flex: 1;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 150ms ease-out;
  font-family: inherit;
}

.wpr-btn-primary {
  background: var(--wpr-orange);
  color: #fff;
  border-color: var(--wpr-orange);
}

.wpr-btn-primary:hover {
  box-shadow: 0 0 24px rgba(240, 77, 30, 0.35);
  transform: translateY(-1px);
}

.wpr-btn-primary:disabled {
  background: var(--wpr-bg-3);
  border-color: var(--wpr-border);
  color: var(--wpr-text-2);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.wpr-btn-secondary {
  background: transparent;
  color: var(--wpr-text);
  border-color: var(--wpr-border);
}

.wpr-btn-secondary:hover {
  border-color: var(--wpr-blue);
  color: var(--wpr-blue);
}

/* 成功状态 */
.wpr-success-state {
  padding: 48px 28px;
  text-align: center;
}

.wpr-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--wpr-success), #2ea043);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
}

.wpr-success-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
}

.wpr-success-text {
  font-size: 14px;
  color: var(--wpr-text-2);
  line-height: 1.6;
  margin: 0 0 24px;
}

/* 加载态 */
.wpr-loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 999px;
  animation: wpr-spin 600ms linear infinite;
  margin-right: 6px;
  vertical-align: -2px;
}

@keyframes wpr-spin {
  to { transform: rotate(360deg); }
}

/* 移动端响应 */
@media (max-width: 640px) {
  .wpr-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 32px);
    border-radius: 12px;
  }

  .wpr-header {
    padding: 20px 20px 14px;
  }

  .wpr-header h3 {
    font-size: 18px;
  }

  .wpr-body {
    padding: 20px;
  }

  .wpr-footer {
    padding: 14px 20px 20px;
  }

  .wpr-row.wpr-row-2 {
    grid-template-columns: 1fr;
  }

  .wpr-checkbox-group {
    grid-template-columns: 1fr;
  }

  .wpr-success-state {
    padding: 36px 20px;
  }
}
