/* ═══════════════════════════════════════
   ELITE CS v4 — FORM COMPONENTS
   mw-input, mw-select, mw-textarea,
   mw-checkbox, mw-radio, mw-switch
   ═══════════════════════════════════════ */

/* ─── Form Group ─── */
.mw-form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--s5);
}

.mw-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* ─── Input / Select / Textarea (shared base) ─── */
.mw-input,
.mw-select,
.mw-textarea {
  height: 38px;
  padding: var(--s2) var(--s3);
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  transition: all 200ms var(--ease);
  outline: none;
  width: 100%;
}

.mw-input::placeholder {
  color: var(--text-tertiary);
}

/* Focus */
.mw-input:focus,
.mw-select:focus,
.mw-textarea:focus {
  border-color: rgba(64,200,240,0.4);
  box-shadow: 0 0 0 3px var(--teal-soft);
  background: var(--glass-2);
}

/* Error */
.mw-input.error,
.mw-textarea.error {
  border-color: rgba(240,85,69,0.5);
  box-shadow: 0 0 0 3px rgba(240,85,69,0.08);
}

/* Disabled */
.mw-input:disabled,
.mw-select:disabled,
.mw-textarea:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Small variant */
.mw-input-sm {
  height: 32px;
  font-size: 12px;
}

/* ─── Select ─── */
.mw-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 256 256'%3E%3Cpath d='M216.49 104.49l-80 80a12 12 0 0 1-17 0l-80-80a12 12 0 0 1 17-17L128 159l71.51-71.52a12 12 0 0 1 17 17Z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

[data-theme="light"] .mw-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 256 256'%3E%3Cpath d='M216.49 104.49l-80 80a12 12 0 0 1-17 0l-80-80a12 12 0 0 1 17-17L128 159l71.51-71.52a12 12 0 0 1 17 17Z' fill='rgba(0,20,40,0.35)'/%3E%3C/svg%3E");
}

/* ─── Textarea ─── */
.mw-textarea {
  height: auto;
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

/* ─── Helper & Error Text ─── */
.mw-helper {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.mw-error {
  font-size: 11px;
  color: var(--status-urgent);
  margin-top: 4px;
}

/* ─── Checkbox ─── */
.mw-checkbox {
  display: flex;
  align-items: center;
  gap: var(--s2);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  user-select: none;
}

.mw-checkbox input { display: none; }

.mw-checkbox-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--glass-border-hover);
  background: var(--glass-1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms var(--ease);
  flex-shrink: 0;
  font-size: 11px;
  color: transparent;
}

.mw-checkbox input:checked + .mw-checkbox-box {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
}

.mw-checkbox input:focus-visible + .mw-checkbox-box {
  box-shadow: 0 0 0 3px var(--teal-soft);
}

/* ─── Radio ─── */
.mw-radio {
  display: flex;
  align-items: center;
  gap: var(--s2);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  user-select: none;
}

.mw-radio input { display: none; }

.mw-radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--glass-border-hover);
  background: var(--glass-1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms var(--ease);
  flex-shrink: 0;
}

.mw-radio-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: background 200ms var(--ease);
}

.mw-radio input:checked + .mw-radio-dot {
  border-color: var(--teal);
}

.mw-radio input:checked + .mw-radio-dot::after {
  background: var(--teal);
}

.mw-radio input:focus-visible + .mw-radio-dot {
  box-shadow: 0 0 0 3px var(--teal-soft);
}

/* ─── Switch ─── */
.mw-switch {
  display: flex;
  align-items: center;
  gap: var(--s3);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  user-select: none;
}

.mw-switch input { display: none; }

.mw-switch-track {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--glass-3);
  position: relative;
  transition: background 200ms var(--ease);
  flex-shrink: 0;
}

.mw-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: all 200ms var(--ease);
}

.mw-switch input:checked + .mw-switch-track {
  background: var(--teal);
}

.mw-switch input:checked + .mw-switch-track::after {
  transform: translateX(18px);
  background: white;
}

.mw-switch input:focus-visible + .mw-switch-track {
  box-shadow: 0 0 0 3px var(--teal-soft);
}

/* ─── Form Showcase Grid ─── */
.form-showcase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s6);
}

@media (max-width: 767px) {
  .form-showcase { grid-template-columns: 1fr; }
  .mw-input, .mw-select { min-height: 44px; font-size: 16px; } /* 16px prevents iOS zoom */
  .mw-textarea { font-size: 16px; }
}

/* ─── Light Mode ─── */
[data-theme="light"] .mw-input,
[data-theme="light"] .mw-select,
[data-theme="light"] .mw-textarea {
  background: rgba(255,255,255,0.6);
  border-color: rgba(0,40,80,0.10);
}

[data-theme="light"] .mw-input:focus,
[data-theme="light"] .mw-select:focus,
[data-theme="light"] .mw-textarea:focus {
  border-color: rgba(29,168,208,0.4);
  box-shadow: 0 0 0 3px rgba(29,168,208,0.08);
  background: rgba(255,255,255,0.85);
}

[data-theme="light"] .mw-checkbox-box,
[data-theme="light"] .mw-radio-dot {
  background: rgba(255,255,255,0.6);
  border-color: rgba(0,40,80,0.16);
}

[data-theme="light"] .mw-switch-track {
  background: rgba(0,20,40,0.12);
}

[data-theme="light"] .mw-switch-track::after {
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
