/* ========================================
   弹窗组件样式
   ======================================== */

/* ===== 遮罩层 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== 弹窗容器 ===== */
.modal-container {
  background: white;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: all 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

/* ===== 关闭按钮 ===== */
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: #f5f5f5;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #666;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close:hover {
  background: #e0e0e0;
  color: #333;
}

/* ===== 购买引导弹窗 ===== */
.purchase-modal .modal-header {
  padding: 32px 24px 20px;
  text-align: center;
  background: linear-gradient(135deg, #FFF5F7 0%, #FFE8EC 100%);
}

.purchase-modal .modal-icon {
  font-size: 56px;
  margin-bottom: 12px;
}

.purchase-modal .modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #E91E63;
  margin-bottom: 8px;
}

.purchase-modal .modal-subtitle {
  font-size: 15px;
  color: #666;
  line-height: 1.5;
}

.purchase-modal .modal-body {
  padding: 24px;
}

.purchase-modal .price-section {
  text-align: center;
  margin-bottom: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #FFF5F7 0%, #FFE8EC 100%);
  border-radius: 12px;
}

.purchase-modal .price {
  font-size: 48px;
  font-weight: 700;
  color: #E91E63;
  margin-bottom: 4px;
}

.purchase-modal .price-label {
  font-size: 14px;
  color: #666;
}

.purchase-modal .features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.purchase-modal .features li {
  font-size: 15px;
  color: #333;
  line-height: 1.8;
  padding-left: 32px;
  position: relative;
  margin-bottom: 8px;
}

.purchase-modal .features li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #E91E63;
  font-weight: 700;
  font-size: 16px;
}

.purchase-modal .modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-btn {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-btn-primary {
  background: linear-gradient(135deg, #E91E63 0%, #FF4081 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.3);
}

.modal-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(233, 30, 99, 0.4);
}

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

.modal-btn-secondary {
  background: white;
  color: #E91E63;
  border: 2px solid #E91E63;
}

.modal-btn-secondary:hover {
  background: #FFF5F7;
}

.modal-btn-link {
  background: none;
  color: #999;
  padding: 12px;
  font-size: 14px;
  border: none;
}

.modal-btn-link:hover {
  color: #E91E63;
}

/* ===== 激活码输入弹窗 ===== */
.code-modal .modal-header {
  padding: 32px 24px 20px;
  text-align: center;
  background: linear-gradient(135deg, #FFF5F7 0%, #FFE8EC 100%);
}

.code-modal .modal-icon {
  font-size: 56px;
  margin-bottom: 12px;
}

.code-modal .modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #E91E63;
  margin-bottom: 8px;
}

.code-modal .modal-subtitle {
  font-size: 15px;
  color: #666;
  line-height: 1.5;
}

.code-modal .modal-body {
  padding: 24px;
}

.code-modal .input-group {
  margin-bottom: 16px;
}

.code-modal .input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.code-modal .input-group input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: white;
  color: #333;
  text-align: center;
  letter-spacing: 2px;
  transition: all 0.2s ease;
  font-weight: 600;
  /* 允许选择、复制和粘贴 */
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

.code-modal .input-group input:focus {
  outline: none;
  border-color: #E91E63;
  background: #FFF5F7;
}

.code-modal .input-group input::placeholder {
  letter-spacing: normal;
  color: #999;
  font-weight: 400;
}

.code-modal .error-message {
  font-size: 14px;
  color: #DC2626;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

.code-modal .tips {
  margin-top: 16px;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 13px;
  color: #666;
  line-height: 1.6;
}

.code-modal .tips p {
  margin: 0 0 4px 0;
}

.code-modal .tips p:last-child {
  margin-bottom: 0;
}

.code-modal .modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== 加载状态 ===== */
.modal-btn .btn-loading {
  display: none;
}

.modal-btn.loading .btn-text {
  display: none;
}

.modal-btn.loading .btn-loading {
  display: inline-block;
}

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

.modal-btn.loading .btn-loading:after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .modal-container {
    width: 95%;
    max-height: 95vh;
  }

  .purchase-modal .modal-header,
  .code-modal .modal-header {
    padding: 24px 20px 16px;
  }

  .modal-icon {
    font-size: 48px;
  }

  .modal-title {
    font-size: 22px;
  }

  .purchase-modal .price {
    font-size: 40px;
  }
}
