/* =========================================
   需求面板（右下角常驻）—— mac genie 风格
   配色：#0F172A 底 + blue-purple 渐变强调
   ========================================= */

.dm-root {
  position: fixed;
  right: 6px;
  bottom: 24px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  font-size: 16px;
  animation: dmRootFloat 2.4s ease-in-out infinite;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 鼠标划入或表单获焦时停止浮动并归位 */
.dm-root:hover,
.dm-root:focus-within {
  animation: none;
  transform: translateY(0);
}

/* 常驻轻柔上下浮动 */
.dm-root .dm-card {
  box-shadow:
    0 22px 62px rgba(59, 130, 246, 0.22),
    0 20px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.dm-root .dm-launcher {
  box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5);
}

@keyframes dmRootFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* ===== 启动器（相当于 dock 图标，常驻，仅图标） ===== */
.dm-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.45);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.dm-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 38px rgba(59, 130, 246, 0.6);
}

.dm-launcher svg,
.dm-launcher .dm-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ===== 卡片 ===== */
.dm-card {
  width: 355px;
  max-width: calc(100vw - 32px);
  border-radius: 16px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(51, 65, 85, 0.5);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform-origin: bottom right;
  will-change: transform, opacity;
  contain: layout paint;
  backface-visibility: hidden;
}

/* 页面加载前：保持动画起始态，避免首帧闪现 */
.dm-card.dm-pending {
  opacity: 0;
  transform: scale(0.85) translateY(12px);
  pointer-events: none;
}

/* 拉出（打开）：从右下角胶囊方向缩放淡入，内容全程可见，GPU 合成不卡 */
.dm-card.dm-in {
  animation: dmGenieIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 吸回（最小化）：朝右下角胶囊缩小淡出 */
.dm-card.dm-out {
  animation: dmGenieOut 0.22s cubic-bezier(0.4, 0, 1, 1) both;
}

@keyframes dmGenieIn {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes dmGenieOut {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.85) translateY(12px);
  }
}

/* 胶囊入场：卡片收完后轻弹出现 */
.dm-launcher.dm-pop {
  animation: dmLauncherIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes dmLauncherIn {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* 卡片头部（仅装饰背景 + 最小化按钮） */
.dm-card-header {
  position: relative;
  min-height: 48px;
  background-color: #1e3a8a;
  background-image: url("../images/dm-header-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.dm-card-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

.dm-min {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.dm-min:hover {
  background: rgba(0, 0, 0, 0.4);
}

.dm-min svg {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

/* 卡片主体（内容区可滚动） */
.dm-card-body {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 10px 14px 12px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0.08) 100%),
    #0f172a;
}

.dm-heading {
  display: flex;
  align-items: center;
  margin: 0 0 8px;
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.dm-intro {
  margin: 0 0 10px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.5;
}

/* 表单栅格：两列，姓名/公司、职位/行业各占一行两列；联系方式、留言、提交按钮跨整行 */
.dm-card-body form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dm-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* 跨整行的表单项 */
.dm-group--full,
.dm-submit {
  grid-column: 1 / -1;
}

.dm-control {
  width: 100%;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e2937;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.dm-control::placeholder {
  color: #64748b;
}

.dm-control:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
  background: #1e2937;
}

textarea.dm-control {
  min-height: 64px;
  resize: vertical;
}

select.dm-control {
  appearance: none;
  cursor: pointer;
  padding-right: 32px;
  background-color: #1e2937;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

select.dm-control.is-placeholder {
  color: #64748b;
}

select.dm-control option {
  background: #0f172a;
  color: #fff;
}

/* 提交按钮 */
.dm-submit {
  width: 100%;
  margin-top: 2px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.dm-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}

.dm-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* 移动端适配 */
@media (max-width: 640px) {
  .dm-root {
    right: 6px;
    bottom: 12px;
  }

  .dm-card {
    width: calc(100vw - 24px);
  }

  .dm-card-body {
    max-height: 55vh;
  }
}
