/**
 * CamThink 表单组件基础样式（libs/camthink-forms）。
 * 仅提供中性视觉与结构布局；footer 订阅的皮肤由主题 css/global.css 的
 * .footer-email-container .ctf-* 覆盖，上传组件可在任意浅色容器直接使用。
 */

/* ── 订阅表单（footer 之外使用时的兜底视觉） ───────────────────── */
.ctf-form.ctf-subscribe {
  margin: 24px 0 0;
}

.ctf-subscribe .ctf-field {
  position: relative;
  min-height: 56px;
  border-radius: 6px;
  background: #ffffff;
}

.ctf-subscribe .ctf-field input {
  width: 100%;
  height: 56px;
  box-sizing: border-box;
  padding: 0 168px 0 20px;
  border: 0;
  border-radius: 6px;
  outline: 0;
  background: transparent;
  color: #111111;
  font-size: 16px;
  line-height: 24px;
}

.ctf-subscribe .ctf-submit {
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
}

.ctf-subscribe .ctf-submit-button {
  height: 100%;
  min-width: 100px;
  padding: 0 20px;
  border: 0;
  border-radius: 6px;
  background: #f24a00;
  color: #ffffff;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.ctf-subscribe .ctf-submit-button:hover {
  background: #ef713a;
}

.ctf-subscribe .ctf-submit-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ctf-label-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ctf-error {
  margin: 8px 0 0;
  color: #f24a00;
  font-size: 14px;
  line-height: 20px;
}

/* 配置加载失败时的联系兜底链接：表单不可用也不流失订阅意向。
 * inline-block：与紧随其后的 .ctf-retry 同排展示。 */
.ctf-contact {
  display: inline-block;
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  line-height: 20px;
  text-decoration: underline;
  vertical-align: middle;
}

.ctf-contact:hover,
.ctf-contact:focus-visible {
  color: #ffffff;
}

.ctf-loading {
  min-height: 56px;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.ctf-failed {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

/* 失败态的 Retry：紧凑描边按钮（不依赖容器类，深色 footer 直接可用），
 * 与 .ctf-contact 同排展示。 */
.ctf-retry {
  display: inline-block;
  margin: 8px 0 0 12px;
  padding: 5px 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: transparent;
  color: #ffffff;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
  vertical-align: middle;
}

.ctf-retry:hover,
.ctf-retry:focus-visible {
  border-color: rgba(255, 255, 255, 0.6);
}

/* ── 文件上传组件 ─────────────────────────────────────────────── */
.ctf-upload-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  border: 1px dashed #d0d0d0;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ctf-upload-area:hover,
.ctf-upload-area.ctf-drag-active {
  border-color: #f24a00;
  background: #fff7f3;
}

.ctf-upload-area:focus-visible {
  outline: 2px solid #f24a00;
  outline-offset: 2px;
}

.ctf-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ctf-upload-icon::before {
  content: "↑";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: #f24a00;
  font-size: 20px;
}

.ctf-upload-label {
  color: #1f1f1f;
  font-size: 14px;
  font-weight: 600;
}

.ctf-upload-browse {
  margin-top: 4px;
  color: #5f5f5f;
  font-size: 13px;
}

.ctf-upload-hint {
  margin-top: 12px;
  color: #8a8a8a;
  font-size: 12px;
}

.ctf-upload-error {
  margin: 8px 0 0;
  color: #d92d20;
  font-size: 13px;
}

.ctf-upload-files {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.ctf-upload-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #ececec;
  font-size: 13px;
}

.ctf-upload-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
}

.ctf-upload-item-info {
  flex: 1;
  min-width: 0;
}

.ctf-upload-item-name {
  display: block;
  overflow-wrap: anywhere;
  color: #1f1f1f;
}

.ctf-upload-item-status {
  margin: 4px 0 0;
  color: #5f5f5f;
}

.ctf-upload-item.ctf-failed .ctf-upload-item-status {
  color: #d92d20;
}

.ctf-upload-item.ctf-ready .ctf-upload-item-status {
  color: #12805c;
}

.ctf-upload-item progress {
  width: 100%;
  max-width: 320px;
  height: 6px;
  margin-top: 6px;
}

.ctf-upload-item-retry,
.ctf-upload-item-remove {
  padding: 6px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  background: #ffffff;
  color: #1f1f1f;
  font-size: 13px;
  cursor: pointer;
}

.ctf-upload-item-retry:hover,
.ctf-upload-item-remove:hover {
  border-color: #f24a00;
  color: #f24a00;
}

/* Generic Schema layout; footer single-email markup keeps its theme skin. */
.ctf-schema { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: 16px; }
.ctf-schema > .ctf-field { grid-column: span var(--ctf-col,12); min-width: 0; }
.ctf-schema > :not(.ctf-field) { grid-column: 1 / -1; }
.ctf-schema .ctf-field > input:not([type=checkbox]):not([type=radio]), .ctf-schema textarea, .ctf-schema select { width: 100%; padding: 10px; border: 1px solid #d0d0d0; border-radius: 6px; box-sizing: border-box; }
.ctf-schema .ctf-label { display: block; margin-bottom: 6px; }
.ctf-schema .ctf-choice { display: block; }
.ctf-schema .ctf-submit-button { padding: 12px 24px; background: #f24a00; color: white; border: 0; border-radius: 6px; }
.ctf-subscribe input[type=checkbox], .ctf-subscribe input[type=radio] { width: auto; height: auto; margin-right: 8px; }
@media (max-width: 1023px) { .ctf-schema > .ctf-field { grid-column: span var(--ctf-tablet-col,12); } }
@media (max-width: 639px) { .ctf-schema > .ctf-field { grid-column: span var(--ctf-mobile-col,12); } }
