/*
  询价表单：附件选择区样式
  ────────────────────────
  原站用的是 Gravity Forms 的原生 <input type="file">：
    · 系统默认样式，和整站风格不搭
    · 选完只显示一个文件名，看不出大小，也没法取消
    · 换语言后标签是「项目图片 1（jpg、gif、png、pdf，小于 5MB）」，很长很挤

  inquiry-form.js 会把原生控件藏起来，换成下面这套：
    [选择文件]  支持 jpg / png / gif / webp / pdf，单个 ≤ 5MB
  选好之后：
    [更换文件]  产品外观图.png · 67 B                                [✕]

  【为什么全部用 #top 前缀 + !important】
  主题有一大堆 `#top button`、`#top input[type=...]`、`.button` 之类的选择器，
  它们比单类选择器优先级高得多 —— 第一版没加前缀，结果"选择文件"按钮
  被主题染成了蓝色大方块、✕ 变成蓝色方块、文件名也被挤到下一行（实测截图）。
  `#top` 是主题给整站容器的 ID，在这里等于把优先级拉平，再加 !important 兜底。
*/

#top .korono-file-field .korono-file-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 上下两行：第一行按钮，第二行「文件名 · 大小 + ✕」 */
#top .korono-file-box {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 6px !important;
  margin: 4px 0 0 !important;
}

/*
 * 「文件名 · 大小  ✕」
 *
 * 【对齐要按首行，不是按整行居中】文件名长了会折成两行，
 * 如果 align-items: center，✕ 会跑到两行的垂直中间，看起来像"错位"
 * （用户反馈："删除按钮在文件名两行时样式错位"）。
 * 改成 align-items: flex-start，并给 ✕ 一点点上边距与首行文字基线对齐。
 */
#top .korono-file-row {
  display: flex !important;
  align-items: flex-start !important;
  gap: 8px !important;
  width: auto !important;
  max-width: 100% !important;
}

#top .korono-file-box .korono-file-clear {
  margin-top: 2px !important;
}

/* 文件名：可点击，在新标签页预览（本地 blob 地址） */
#top .korono-file-box .korono-file-link {
  color: #a81010 !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
  word-break: break-all;
  cursor: pointer;
}

#top .korono-file-box .korono-file-link:hover {
  color: #7a0b0b !important;
}

#top .korono-file-box .korono-file-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 34px !important;
  min-width: 92px;
  padding: 0 14px !important;
  margin: 0 !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 32px !important;
  color: #333 !important;
  text-transform: none !important;
  background: #fff !important;
  background-image: none !important;
  border: 1px solid #c9c9c9 !important;
  border-radius: 3px !important;
  box-shadow: none !important;
  cursor: pointer !important;
  transition: border-color .15s, color .15s, background .15s;
}

#top .korono-file-box .korono-file-btn:hover {
  color: #a81010 !important;
  background: #fdf3f3 !important;
  border-color: #a81010 !important;
}

/* 已选择时弱化主按钮，避免和「提交需求」抢视线 */
#top .korono-file-box.is-picked .korono-file-btn {
  color: #666 !important;
  background: #f7f7f7 !important;
  border-color: #ddd !important;
}

#top .korono-file-box .korono-file-info {
  flex: 1 1 200px;
  min-width: 0;
  font-size: 12.5px !important;
  line-height: 1.5 !important;
  color: #999 !important;
  word-break: break-all;
}

#top .korono-file-box.is-picked .korono-file-info {
  color: #333 !important;
}

#top .korono-file-box .korono-file-size {
  color: #999 !important;
  margin-left: 4px;
  font-size: 12px !important;
}

#top .korono-file-box .korono-file-clear {
  flex: 0 0 auto;
  width: 24px !important;
  height: 24px !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 22px !important;
  color: #999 !important;
  background: #fff !important;
  background-image: none !important;
  border: 1px solid #ddd !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

#top .korono-file-box .korono-file-clear:hover {
  color: #fff !important;
  background: #c62828 !important;
  border-color: #c62828 !important;
}

/* 校验不通过 */
#top .korono-file-box.is-error .korono-file-info {
  color: #c62828 !important;
}

/* 上传中的小转圈 */
.korono-form-status.is-wait::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid #bbb;
  border-top-color: transparent;
  border-radius: 50%;
  animation: korono-spin .8s linear infinite;
  vertical-align: -2px;
}

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

@media (max-width: 767px) {
  #top .korono-file-box .korono-file-info {
    flex-basis: 100%;
    min-width: 0;
  }
}

/* ============================================================
   强制显示表单容器
   ------------------------------------------------------------
   Gravity Forms 的 CSS 默认把 .gform_wrapper 设为 display:none，
   靠它自己的 JS（jQuery('#gform_wrapper_6').show()）才显示。
   我们不再加载 GF 的 JS（它依赖缺失的 /wp-content chunk，控制台会报 404），
   所以这里直接把它设为可见，保证联系页表单一定出现。
   ============================================================ */
.gform_wrapper,
.gform_wrapper.gform_legacy_markup_wrapper,
div[id^="gform_wrapper_"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
}
