/* ==========================================================================
   Cookie consent popup — 全局弹窗（由 public/footer 引入，全站生效）
   设计稿：node 9385-34159（720×480 白卡）
   ========================================================================== */

.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cookie-modal.is-open {
  visibility: visible;
  opacity: 1;
}

.cookie-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.cookie-modal__card {
  position: relative;
  width: 720px;
  /* 高度自适应：折叠 ≈380px，展开内容正好填满 480px（设计稿为展开态） */
  height: auto;
  background: #ffffff;
  border-radius: 20px;
  padding: 60px 40px 49px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 15, 0.3);
  transform: translateY(24px) scale(0.98);
  transition: transform 0.3s ease;
}

.cookie-modal.is-open .cookie-modal__card {
  transform: translateY(0) scale(1);
}

/* 右上角关闭（655,25 40×40） */
.cookie-modal__close {
  position: absolute;
  top: 25px;
  right: 25px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.cookie-modal__close:hover img {
  opacity: 0.7;
}

/* 标题（40,60） */
.cookie-modal__title {
  font-size: 30px;
  font-weight: 700;
  line-height: 40px;
  color: #000000;
}

/* 说明文字（40,110），隐私政策链接下划线浅蓝 */
.cookie-modal__text {
  margin-top: 10px;
  font-size: 18px;
  line-height: 30px;
  color: #000000;
}

.cookie-modal__link {
  color: #5ea4ff;
  text-decoration: underline;
}

/* Why necessary?（40,220）可折叠按钮：文字 + 三角图标
   折叠态三角旋转 -90° 指向右侧（▶），展开恢复向下（▼） */
.cookie-modal__why {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  font-size: 18px;
  line-height: 30px;
  color: #5ea4ff;
  cursor: pointer;
}

.cookie-modal__why img {
  transition: transform 0.2s ease;
  transform: rotate(-90deg);
}

.cookie-modal.is-why-expanded .cookie-modal__why img {
  transform: rotate(0deg);
}

/* 必要 Cookie 说明（40,260）：默认折叠，点击 Why necessary? 展开 */
.cookie-modal__necessary {
  display: none;
  margin-top: 10px;
  font-size: 18px;
  line-height: 30px;
  color: #000000;
}

.cookie-modal.is-why-expanded .cookie-modal__necessary {
  display: block;
}

/* 底部操作行：Manage Preferences + Accept All（y≈391，固定间距保证展开态总高 480px） */
.cookie-modal__actions {
  margin-top: 41px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 25px;
}

.cookie-modal__manage {
  font-size: 20px;
  line-height: 30px;
  color: #5ea4ff;
  text-decoration: underline;
}

.cookie-modal__accept {
  width: 180px;
  height: 40px;
  border: none;
  background: #5ea4ff;
  color: #ffffff;
  font-family: inherit;
  font-size: 20px;
  line-height: 30px;
  cursor: pointer;
}

.cookie-modal__accept:hover {
  background: #0a47ed;
}

/* 响应式：小屏时卡片自适应宽度 */
@media (max-width: 767px) {
  .cookie-modal__card {
    width: auto;
    height: auto;
    margin: 20px;
    padding: 52px 24px 32px;
  }

  .cookie-modal__actions {
    flex-direction: column-reverse;
    gap: 16px;
  }

  .cookie-modal__accept {
    width: 100%;
  }
}

/* ==========================================================================
   Cookie preferences popup — 偏好设置弹窗（node 9385-34195）
   由弹窗 1 的 Manage Preferences 或 footer 的 Cookies 链接打开
   ========================================================================== */

.cookie-modal__card--prefs {
  height: 820px;
}

/* 说明文字后间距（下一元素 y=213） */
.cookie-modal--prefs .cookie-modal__text {
  margin-bottom: 43px;
}

.cookie-prefs__group {
  display: flex;
  flex-direction: column;
}

/* 分类行：名称左、状态/开关右（开关 72×40，行高 40） */
.cookie-prefs__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
}

.cookie-prefs__name {
  font-size: 18px;
  font-weight: 700;
  line-height: 30px;
  color: #000000;
}

.cookie-prefs__always {
  font-size: 18px;
  font-weight: 700;
  line-height: 30px;
  color: #5ea4ff;
}

.cookie-prefs__desc {
  margin-top: 10px;
  font-size: 18px;
  line-height: 30px;
  color: #000000;
}

/* 分割线（640 宽，灰 #97999B） */
.cookie-prefs__divider {
  margin: 20px 0 25px;
  border: none;
  border-top: 1px solid #97999b;
}

/* 开关（设计稿 72×40，胶囊 + 白圆点；灰=关，蓝=开） */
.cookie-prefs__switch {
  position: relative;
  width: 72px;
  height: 40px;
  border: none;
  border-radius: 20px;
  background: #97999b;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.cookie-prefs__switch[aria-checked="true"] {
  background: #5ea4ff;
}

.cookie-prefs__knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease;
}

.cookie-prefs__switch[aria-checked="true"] .cookie-prefs__knob {
  transform: translateX(32px);
}

/* 底部保存按钮（居中，180×38） */
.cookie-prefs__footer {
  margin-top: 38px;
  display: flex;
  justify-content: center;
}

.cookie-prefs__save {
  width: 180px;
  height: 38px;
  border: none;
  background: #5ea4ff;
  color: #ffffff;
  font-family: inherit;
  font-size: 20px;
  line-height: 30px;
  cursor: pointer;
}

.cookie-prefs__save:hover {
  background: #0a47ed;
}

/* 小屏适配：紧凑排版 + 卡片内滚动兜底。
   卡片内容较长，手机上会高于视口；.cookie-modal 自身不可滚动，
   故这里给卡片加 max-height + overflow-y，保证底部「保存选择」始终可达。 */
@media (max-width: 767px) {
  .cookie-modal__card--prefs {
    height: auto;
    min-height: 0;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px;
    padding: 44px 20px 24px;
  }

  .cookie-modal--prefs .cookie-modal__title {
    font-size: 22px;
    line-height: 30px;
  }

  .cookie-modal--prefs .cookie-modal__text {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 22px;
  }

  .cookie-modal--prefs .cookie-modal__close {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
  }

  .cookie-modal--prefs .cookie-modal__close img {
    width: 100%;
    height: 100%;
  }

  .cookie-prefs__head {
    min-height: 32px;
  }

  .cookie-prefs__name {
    font-size: 15px;
    line-height: 24px;
  }

  .cookie-prefs__always {
    font-size: 13px;
    line-height: 24px;
  }

  .cookie-prefs__desc {
    margin-top: 6px;
    font-size: 13px;
    line-height: 21px;
  }

  .cookie-prefs__divider {
    margin: 12px 0 14px;
  }

  .cookie-prefs__switch {
    width: 56px;
    height: 32px;
    border-radius: 16px;
  }

  .cookie-prefs__knob {
    width: 24px;
    height: 24px;
  }

  .cookie-prefs__switch[aria-checked="true"] .cookie-prefs__knob {
    transform: translateX(24px);
  }

  .cookie-prefs__footer {
    margin-top: 20px;
  }

  .cookie-prefs__save {
    width: 100%;
    height: 42px;
    font-size: 16px;
  }
}
