/* ============================================================
   组件库 — 表单元素 (Form)
   输入框 / 选择器 / 复选框 / 单选框 / 开关 / 搜索框
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }

.form-label {
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--color-text-strong);
}
.form-label .required { color: var(--error-500); margin-left: 2px; }

.form-input {
  width: 100%; min-height: var(--touch-min);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base); color: var(--color-text);
  background: var(--color-surface); border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.form-input::placeholder { color: var(--neutral-400); }
.form-input:hover { border-color: var(--color-border-strong); }
.form-input:focus {
  outline: none; border-color: var(--brand-500); box-shadow: var(--shadow-glow);
}
.form-input--error { border-color: var(--error-500); }
.form-input--error:focus { box-shadow: 0 0 0 4px rgba(239,68,68,0.12); }
.form-input:disabled { background: var(--color-surface-dim); color: var(--neutral-400); cursor: not-allowed; }

.form-hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.form-error { font-size: var(--text-xs); color: var(--error-500); }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2357524e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--space-3) center;
  padding-right: var(--space-8); cursor: pointer;
}

/* 复选框 */
.checkbox, .radio {
  display: inline-flex; align-items: center; gap: var(--space-2);
  cursor: pointer; min-height: var(--touch-min); font-size: var(--text-base);
}
.checkbox input, .radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox .box, .radio .box {
  width: 22px; height: 22px; flex: none;
  border: 1.5px solid var(--color-border-strong); border-radius: 6px;
  background: var(--color-surface);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--dur-fast);
}
.radio .box { border-radius: 50%; }
.checkbox .box svg, .radio .box svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; opacity: 0; transform: scale(0); transition: all var(--dur-fast); }
.checkbox input:checked + .box, .radio input:checked + .box {
  background: var(--brand-500); border-color: var(--brand-500);
}
.checkbox input:checked + .box svg, .radio input:checked + .box svg { opacity: 1; transform: scale(1); }
.checkbox input:focus-visible + .box, .radio input:focus-visible + .box { box-shadow: var(--shadow-glow); }
.checkbox:hover .box, .radio:hover .box { border-color: var(--brand-500); }

/* 开关 */
.switch {
  position: relative; width: 48px; height: 28px; flex: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border-radius: var(--radius-full);
  background: var(--neutral-300); transition: background var(--dur-normal);
}
.switch .thumb {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm);
  transition: transform var(--dur-normal) var(--ease-out);
}
.switch input:checked + .track { background: var(--brand-500); }
.switch input:checked + .track + .thumb { transform: translateX(20px); }
.switch input:focus-visible + .track { box-shadow: var(--shadow-glow); }

/* 搜索框 */
.search {
  position: relative; flex: 1; max-width: 360px;
}
.search .icon { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--neutral-400); pointer-events: none; }
.search input {
  width: 100%; min-height: var(--touch-min);
  padding: var(--space-3) var(--space-4) var(--space-3) 44px;
  background: var(--color-surface-dim); border: 1px solid transparent;
  border-radius: var(--radius-full); transition: all var(--dur-fast);
}
.search input:focus { outline: none; background: var(--color-surface); border-color: var(--brand-500); box-shadow: var(--shadow-glow); }
