/**
 * 度才子集团官网 - 内嵌联系表单样式
 * =================================
 * 用于服务页 CTA 区块和首页内嵌表单
 * 浮动 chat-panel 表单样式见 float-toolbar.css (.consult-form)
 */

/* ===== CTA 表单区块容器 ===== */
.contact-form-section {
  background: #fff;
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* 飞书 iframe 嵌入：分档高度由 CSS 控制，避免内联固定高度造成布局跳动 */
.contact-form-section.feishu-form-embed {
  position: relative;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.contact-form-section.feishu-form-embed iframe {
  display: block;
  border: 0;
  width: 100%;
  height: 820px;
  background: #fff;
}

.dcz-feishu-container {
  position: relative;
}

@media (max-width: 1024px) {
  .contact-form-section.feishu-form-embed iframe { height: 760px; }
}

@media (max-width: 640px) {
  .contact-form-section { padding: 28px 20px; }
  .contact-form-section.feishu-form-embed { padding: 0; }
  .contact-form-section.feishu-form-embed iframe { height: 720px; }
}

@media (max-width: 380px) {
  .contact-form-section.feishu-form-embed iframe { height: 680px; }
}

/* ===== 内嵌表单（dcz-contact-form） ===== */
.dcz-contact-form {
  display: block;
}

.dcz-contact-form .dcz-form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dcz-contact-form .dcz-form-row-full {
  display: block;
  margin-bottom: 18px;
}

.dcz-contact-form .dcz-field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.dcz-contact-form .dcz-field-label .req {
  color: #ef4444;
  margin-left: 2px;
}

.dcz-contact-form input,
.dcz-contact-form select,
.dcz-contact-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #1e293b;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dcz-contact-form input:focus,
.dcz-contact-form select:focus,
.dcz-contact-form textarea:focus {
  outline: none;
  border-color: #2b5cff;
  box-shadow: 0 0 0 3px rgba(43, 92, 255, 0.12);
}

.dcz-contact-form textarea {
  resize: vertical;
  min-height: 90px;
}

.dcz-contact-form textarea[data-field="message"] {
  min-height: 110px;
}

/* 验证码行 */
.dcz-contact-form .dcz-captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dcz-contact-form .dcz-captcha-row input {
  width: 100px;
  flex-shrink: 0;
}

.dcz-contact-form .dcz-captcha-q {
  font-size: 0.9rem;
  color: #475569;
  white-space: nowrap;
  font-weight: 600;
}

.dcz-contact-form .dcz-captcha-refresh {
  background: none;
  border: none;
  color: #2b5cff;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 4px 8px;
  white-space: nowrap;
}

.dcz-contact-form .dcz-captcha-refresh:hover {
  text-decoration: underline;
}

/* 提交按钮 */
.dcz-contact-form .dcz-submit-btn {
  display: block;
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #2b5cff, #0ea5e9);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  margin-top: 4px;
}

.dcz-contact-form .dcz-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(43, 92, 255, 0.35);
}

.dcz-contact-form .dcz-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* 底部提示 */
.dcz-contact-form .dcz-form-footer {
  margin-top: 16px;
  text-align: center;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.6;
}

/* 移动端 */
@media (max-width: 640px) {
  .dcz-contact-form .dcz-form-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .dcz-contact-form input,
  .dcz-contact-form select,
  .dcz-contact-form textarea {
    font-size: 16px;
    padding: 10px 12px;
  }
  .dcz-contact-form .dcz-captcha-row input {
    width: 80px;
  }
}

/* ===== CTA 区块（表单 + 电话/微信 双入口） ===== */
.cta-contact-wrapper {
  max-width: 1100px;
  margin: 0 auto;
}

.cta-contact-wrapper .cta-contact-header {
  text-align: center;
  margin-bottom: 28px;
}

.cta-contact-wrapper .cta-contact-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}

.cta-contact-wrapper .cta-contact-sub {
  font-size: 0.95rem;
  color: #dbeafe;
  margin: 0;
  line-height: 1.6;
}

.cta-contact-wrapper .cta-contact-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: stretch;
}

/* 右侧联系卡 */
.cta-contact-wrapper .cta-contact-alt {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.cta-contact-wrapper .cta-contact-alt-hint {
  font-size: 0.88rem;
  color: #475569;
  margin: 0;
  line-height: 1.7;
}

.cta-contact-wrapper .cta-contact-phone,
.cta-contact-wrapper .cta-contact-wechat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cta-contact-wrapper .cta-contact-phone {
  background: #2b5cff;
  color: #fff;
}

.cta-contact-wrapper .cta-contact-phone:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(43, 92, 255, 0.3);
}

.cta-contact-wrapper .cta-contact-wechat {
  background: #10b981;
  color: #fff;
}

.cta-contact-wrapper .cta-contact-wechat:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.cta-contact-wrapper .cta-contact-note {
  font-size: 0.82rem;
  color: #94a3b8;
  margin: 0;
}

@media (max-width: 768px) {
  .cta-contact-wrapper .cta-contact-body {
    grid-template-columns: 1fr;
  }
  .cta-contact-wrapper .cta-contact-title {
    font-size: 1.35rem;
  }
}

/* ===== 独立表单区块（非双入口，直接一张大表单） ===== */
.standalone-form-wrapper {
  max-width: 680px;
  margin: 0 auto;
}

.standalone-form-wrapper .standalone-form-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin: 0 0 8px;
}

.standalone-form-wrapper .standalone-form-sub {
  font-size: 0.95rem;
  color: #dbeafe;
  text-align: center;
  margin: 0 0 28px;
  line-height: 1.6;
}

/* ===== 飞书加载状态、失败兜底与桌面滚轮激活层 ===== */
.dcz-feishu-loading,
.dcz-feishu-fallback {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-sizing: border-box;
  padding: 28px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
  text-align: center;
}

.dcz-feishu-fallback { z-index: 4; }
.dcz-feishu-loading[hidden],
.dcz-feishu-fallback[hidden],
.dcz-feishu-gate[hidden] { display: none !important; }

.dcz-feishu-loading p,
.dcz-feishu-fallback p {
  margin: 0;
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.7;
}

.dcz-feishu-fallback strong {
  color: #1e293b;
  font-size: 1rem;
}

.dcz-feishu-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #2b5cff;
  border-radius: 50%;
  animation: dcz-feishu-spin 0.8s linear infinite;
}

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

.dcz-feishu-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.dcz-feishu-fallback-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.dcz-feishu-fallback-primary {
  color: #fff;
  background: #2b5cff;
}

.dcz-feishu-fallback-secondary {
  color: #2b5cff;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
}

/* 透明激活层不遮挡表单；未点击时滚轮事件留在主页面 */
.dcz-feishu-gate {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 16px 18px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.dcz-feishu-gate-tip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 14px;
  border-radius: 10px;
  color: #fff;
  background: rgba(15, 23, 42, 0.88);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
  font-size: 0.86rem;
  line-height: 1.4;
  pointer-events: none;
}

.dcz-feishu-gate-tip small {
  color: #dbeafe;
  font-size: 0.72rem;
}

/* ===== 飞书表单弹窗 Modal ===== */
.dcz-feishu-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.dcz-feishu-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.dcz-feishu-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dcz-feishu-modal-content {
  position: relative;
  width: 100%;
  max-width: 820px;
  height: 88vh;
  height: 88dvh;
  max-height: 900px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 120px);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: auto;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s ease;
}

.dcz-feishu-modal-handle {
  display: none;
  width: 40px;
  height: 5px;
  background: #cbd5e1;
  border-radius: 3px;
  margin: 10px auto 4px;
  flex-shrink: 0;
}

.dcz-feishu-modal.open .dcz-feishu-modal-content {
  transform: translateY(0) scale(1);
}

.dcz-feishu-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.dcz-feishu-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
}

.dcz-feishu-modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

.dcz-feishu-modal-close:active { background: rgba(0, 0, 0, 0.06); }
.dcz-feishu-modal-close:hover { color: #1e293b; }

.dcz-feishu-modal-body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: auto;
  -webkit-overflow-scrolling: touch;
}

.dcz-feishu-modal-body iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* 手机端全屏，滚动只发生在飞书表单内部 */
@media (max-width: 640px) {
  .dcz-feishu-modal {
    padding: 0;
    align-items: stretch;
  }
  .dcz-feishu-modal-content {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    transform: translateY(30px);
    background: #fff;
  }
  .dcz-feishu-modal.open .dcz-feishu-modal-content { transform: translateY(0); }
  .dcz-feishu-modal-handle { display: block; }
  .dcz-feishu-modal-header { padding: 8px 16px 12px; }
  .dcz-feishu-modal-header h3 { font-size: 1rem; }
  .dcz-feishu-modal-close { font-size: 1.4rem; }
  .dcz-feishu-fallback-actions { flex-direction: column; width: 100%; }
}

/* 背景锁定由 JS 配合 body fixed 保存并恢复滚动位置 */
html.dcz-modal-locked,
html.dcz-modal-locked body {
  overflow: hidden !important;
  height: 100% !important;
  overscroll-behavior: none !important;
  -webkit-overflow-scrolling: auto !important;
}

html.dcz-modal-locked .dcz-feishu-modal-backdrop {
  touch-action: none;
}
