/**
 * 试用申请弹窗样式
 * 支持 PC 横向布局和移动端竖向布局
 * 现代化毛玻璃效果
 */

/* 弹窗遮罩层 */
.trial-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.trial-modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 弹窗容器 - PC 端宽屏 */
.trial-modal-container {
  background: linear-gradient(145deg, 
    rgba(255, 255, 255, 0.95) 0%, 
    rgba(248, 250, 252, 0.98) 100%);
  border-radius: 24px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  /* 关键修复: 禁止容器滚动到底/顶时触发橡皮筋效果或滚动穿透 */
  overscroll-behavior: none;
  /* 针对旧版 iOS 的优化 */
  -webkit-overflow-scrolling: touch;
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.25),
    0 10px 30px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 弹窗头部 */
.trial-modal-header {
  padding: 24px 30px 18px;
  text-align: center;
  position: relative;
  background: linear-gradient(135deg, 
    rgba(74, 144, 226, 0.08) 0%, 
    rgba(53, 122, 189, 0.05) 100%);
  border-bottom: 1px solid rgba(74, 144, 226, 0.1);
}

.trial-modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, #4A90E2, #357ABD);
  border-radius: 0 0 4px 4px;
}

.trial-modal-title {
  font-size: 22px;
  font-weight: 700;
  color: #1A2332;
  margin: 0 0 6px;
  letter-spacing: 0.5px;
}

.trial-modal-subtitle {
  font-size: 13px;
  color: #5A6C7D;
  margin: 0;
  font-weight: 400;
}

/* 关闭按钮 */
.trial-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #5A6C7D;
}

.trial-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: rotate(90deg);
  color: #1A2332;
}

.trial-modal-close svg {
  width: 16px;
  height: 16px;
}

/* 弹窗内容 */
.trial-modal-body {
  padding: 20px 30px 24px;
}

/* 表单网格布局 - PC 端横向两列 */
.trial-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.trial-form-column {
  display: flex;
  flex-direction: column;
}

/* 错误提示 */
.trial-error-tip {
  background: linear-gradient(135deg, #FFF5F5 0%, #FED7D7 100%);
  color: #C53030;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(197, 48, 48, 0.2);
  animation: shake 0.5s ease;
  grid-column: 1 / -1;
}

.trial-error-tip.visible {
  display: flex;
}

.trial-error-tip svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* 成功提示 */
.trial-success-tip {
  background: linear-gradient(135deg, #F0FFF4 0%, #C6F6D5 100%);
  color: #276749;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(39, 103, 73, 0.2);
  grid-column: 1 / -1;
}

.trial-success-tip.visible {
  display: flex;
}

.trial-success-tip svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

/* 表单组 */
.trial-form-group {
  margin-bottom: 14px;
}

.trial-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1A2332;
  margin-bottom: 6px;
}

.trial-form-label .required {
  color: #E53E3E;
  margin-right: 3px;
}

/* 输入框容器 */
.trial-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.trial-input-icon {
  position: absolute;
  left: 12px;
  color: #A0AEC0;
  transition: color 0.3s ease;
  pointer-events: none;
}

.trial-input-icon svg {
  width: 18px;
  height: 18px;
}

.trial-input-wrapper:focus-within .trial-input-icon {
  color: #4A90E2;
}

/* 输入框 */
.trial-input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  font-size: 14px;
  color: #1A2332;
  background: #FFFFFF;
  border: 2px solid #E2E8F0;
  border-radius: 10px;
  outline: none;
  transition: all 0.3s ease;
  font-family: inherit;
}

.trial-input::placeholder {
  color: #A0AEC0;
  font-size: 13px;
}

.trial-input:focus {
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.12);
}

.trial-input.error {
  border-color: #E53E3E;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12);
}

.trial-input.success {
  border-color: #38A169;
}

/* 验证码容器 */
.trial-captcha-wrapper {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.trial-captcha-input {
  flex: 1;
}

.trial-captcha-image {
  width: 120px;
  height: 42px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: #f0f4f8;
  border: 2px solid #E2E8F0;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.trial-captcha-image:hover {
  border-color: #4A90E2;
}

.trial-captcha-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.trial-captcha-refresh {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  background: rgba(74, 144, 226, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.trial-captcha-image:hover .trial-captcha-refresh {
  opacity: 1;
}

.trial-captcha-refresh svg {
  width: 14px;
  height: 14px;
  color: white;
}

/* 表单操作区 */
.trial-form-actions {
  grid-column: 1 / -1;
  margin-top: 6px;
  display: flex;
  gap: 12px;
}

/* 价格试算按钮 */
.trial-price-btn {
  flex: 1;
  padding: 14px 24px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #4A90E2;
  border: 2px solid #4A90E2;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.trial-price-btn:hover {
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  color: white;
  box-shadow: 0 6px 16px rgba(74, 144, 226, 0.32);
}

.trial-price-btn > .btn-shift {
  display: inline-block;
  transition: transform 0.3s ease;
}

.trial-price-btn:hover > .btn-shift {
  transform: translateY(-2px);
}

/* 提交按钮 */
.trial-submit-btn {
  flex: 1;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(74, 144, 226, 0.35);
  letter-spacing: 0.5px;
}

.trial-submit-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #357ABD 0%, #2868A8 100%);
  box-shadow: 0 10px 28px rgba(74, 144, 226, 0.45);
}

.trial-submit-btn > .btn-shift {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.3s ease;
}

.trial-submit-btn:hover:not(:disabled) > .btn-shift {
  transform: translateY(-2px);
}

.trial-submit-btn:active:not(:disabled) > .btn-shift {
  transform: translateY(0);
}

.trial-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.trial-submit-btn:disabled > .btn-shift {
  transform: none;
}

/* 下单模式按钮样式 */
.trial-submit-btn.trial-order-mode {
  background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.35);
  animation: pulse-order 2s ease-in-out infinite;
}

.trial-submit-btn.trial-order-mode:hover:not(:disabled) {
  background: linear-gradient(135deg, #EE5A6F 0%, #DC4A5A 100%);
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.45);
}

@keyframes pulse-order {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.35);
  }
  50% {
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
  }
}

/* 加载动画 */
.trial-submit-btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 底部说明 */
.trial-modal-footer {
  padding: 0 30px 20px;
  text-align: center;
}

.trial-footer-text {
  font-size: 12px;
  color: #718096;
  line-height: 1.6;
}

.trial-footer-text a {
  color: #4A90E2;
  text-decoration: none;
}

.trial-footer-text a:hover {
  text-decoration: underline;
}

/* ========== 移动端适配 ========== */
/* 响应式 - 价格试算按钮 */
@media (max-width: 480px) {
  .trial-form-actions {
    flex-direction: column;
    gap: 10px;
  }
  
  .trial-price-btn,
  .trial-submit-btn {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .trial-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  
  .trial-modal-container {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    /* 方案1: 使用 CSS 变量动态设置高度，默认值为 100vh */
    max-height: var(--modal-max-height, 100vh);
    /* iOS 安全区域适配 */
    padding-bottom: env(safe-area-inset-bottom, 0);
    animation: modalSlideUpMobile 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  
  @keyframes modalSlideUpMobile {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  /* 移动端改为单列布局 */
  .trial-form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .trial-modal-header {
    padding: 20px 24px 14px;
    /* iOS 安全区域顶部适配 */
    padding-top: max(20px, env(safe-area-inset-top, 0));
  }
  
  .trial-modal-title {
    font-size: 20px;
  }
  
  .trial-modal-body {
    padding: 16px 24px 20px;
  }
  
  .trial-form-group {
    margin-bottom: 14px;
  }
  
  .trial-input {
    padding: 12px 14px 12px 42px;
    font-size: 16px; /* 防止 iOS 缩放 */
  }
  
  .trial-input::placeholder {
    font-size: 14px;
  }
  
  .trial-captcha-image {
    width: 110px;
    height: 44px;
  }
  
  .trial-submit-btn {
    padding: 14px 20px;
    font-size: 16px;
  }
  
  .trial-modal-footer {
    padding: 0 24px 18px;
  }
}

@media (max-width: 480px) {
  .trial-modal-overlay {
    padding: 0;
  }
  
  .trial-modal-container {
    max-height: var(--modal-max-height, 100vh);
    border-radius: 16px 16px 0 0;
  }
  
  .trial-modal-header {
    padding: 18px 20px 12px;
    /* iOS 安全区域顶部适配 */
    padding-top: max(18px, env(safe-area-inset-top, 0));
  }
  
  .trial-modal-header::before {
    width: 50px;
    height: 4px;
    background: rgba(0, 0, 0, 0.15);
  }
  
  .trial-modal-title {
    font-size: 18px;
  }
  
  .trial-modal-subtitle {
    font-size: 12px;
  }
  
  .trial-modal-close {
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
  }
  
  .trial-modal-body {
    padding: 16px 20px 20px;
  }
  
  .trial-form-group {
    margin-bottom: 14px;
  }
  
  .trial-form-label {
    font-size: 12px;
    margin-bottom: 5px;
  }
  
  .trial-input {
    padding: 11px 12px 11px 38px;
    border-radius: 8px;
  }
  
  .trial-input-icon {
    left: 10px;
  }
  
  .trial-input-icon svg {
    width: 16px;
    height: 16px;
  }
  
  .trial-captcha-wrapper {
    gap: 8px;
  }
  
  .trial-captcha-image {
    width: 100px;
    height: 42px;
  }
  
  .trial-submit-btn {
    padding: 13px 16px;
    border-radius: 10px;
  }
  
  .trial-modal-footer {
    padding: 0 20px 16px;
    /* iOS 安全区域底部适配 */
    padding-bottom: max(16px, calc(16px + env(safe-area-inset-bottom, 0)));
  }
  
  .trial-footer-text {
    font-size: 11px;
  }
}

/* 滚动条美化 */
.trial-modal-container::-webkit-scrollbar {
  width: 6px;
}

.trial-modal-container::-webkit-scrollbar-track {
  background: transparent;
}

.trial-modal-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.trial-modal-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}
