/* inputs — text/textarea/select/checkbox/radio/range/switch.
 * Token-only. Physical depth: bevels, gradients, animated state changes. */

/* --- field scaffolding --------------------------------------------------- */
.iblis-field {
  display: flex; flex-direction: column; gap: var(--space-1);
  margin-bottom: var(--space-3);
}
.iblis-label { font-size: var(--font-size-sm); color: var(--color-text-secondary); font-weight: 500; }
.iblis-help  { font-size: var(--font-size-xs); color: var(--color-text-muted); }

/* --- text-style inputs --------------------------------------------------- */
.iblis-input,
.iblis-textarea,
.iblis-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background:
    linear-gradient(180deg, var(--color-bg-inset), color-mix(in srgb, var(--color-bg-inset) 100%, white 2%));
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-sm);
  font: inherit; font-size: var(--font-size-sm);
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.45),
    inset 0 -1px 0 rgba(255,255,255,0.03);
  transition:
    border-color var(--motion-fast),
    box-shadow var(--motion-fast) var(--ease-standard),
    background var(--motion-fast);
}
.iblis-input:hover,
.iblis-textarea:hover,
.iblis-select:hover { border-color: var(--color-border-strong); }
.iblis-input:focus,
.iblis-textarea:focus,
.iblis-select:focus {
  outline: none;
  border-color: var(--color-accent-cool);
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.45),
    0 0 0 3px color-mix(in srgb, var(--color-accent-cool) 30%, transparent);
}
.iblis-textarea { min-height: 90px; resize: vertical; line-height: 1.5; }

.iblis-select {
  appearance: none;
  background-image:
    linear-gradient(180deg, var(--color-bg-inset), color-mix(in srgb, var(--color-bg-inset) 100%, white 2%)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4 L6 9 L10 4 Z' fill='%23a4a6b3'/></svg>");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right var(--space-3) center;
  background-size: auto, 10px;
  padding-right: var(--space-6);
}

/* --- checkbox + radio ---------------------------------------------------- */
.iblis-check, .iblis-radio {
  appearance: none;
  position: relative;
  width: 18px; height: 18px;
  margin: 0;
  background:
    linear-gradient(180deg, var(--color-bg-inset), color-mix(in srgb, var(--color-bg-inset) 100%, white 3%));
  border: 1px solid var(--color-border-strong);
  display: inline-block;
  vertical-align: -4px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.50),
    0 1px 0 rgba(255,255,255,0.03);
  transition:
    border-color var(--motion-fast),
    background var(--motion-base),
    box-shadow var(--motion-fast);
}
.iblis-check { border-radius: var(--radius-sm); }
.iblis-radio { border-radius: var(--radius-full); }
.iblis-check:hover, .iblis-radio:hover {
  border-color: var(--color-accent-cool);
}

.iblis-check:checked, .iblis-radio:checked {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--color-accent) 100%, white 18%),
      color-mix(in srgb, var(--color-accent) 100%, black 25%));
  border-color: var(--color-accent-cool);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    inset 0 -1px 0 rgba(0,0,0,0.45),
    0 0 0 1px color-mix(in srgb, var(--color-accent-cool) 35%, transparent);
}

/* checkmark — drawn as an inline SVG via mask */
.iblis-check:checked::after {
  content: "";
  position: absolute; inset: 0;
  background: #fff;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'><path d='M4 9.5 L7.5 13 L14 5.5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/14px no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'><path d='M4 9.5 L7.5 13 L14 5.5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/14px no-repeat;
  animation: iblis-check-pop var(--motion-base) var(--ease-standard) both;
}
.iblis-radio:checked::after {
  content: "";
  position: absolute;
  top: 4px; left: 4px;
  width: 8px; height: 8px;
  background: #fff;
  border-radius: var(--radius-full);
  box-shadow: 0 0 6px rgba(255,255,255,0.5);
  animation: iblis-radio-pop var(--motion-base) var(--ease-standard) both;
}

@keyframes iblis-check-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes iblis-radio-pop {
  0%   { transform: scale(0.2); opacity: 0; }
  60%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* --- switch -------------------------------------------------------------- */
.iblis-switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px;
  vertical-align: -7px;
}
.iblis-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.iblis-switch-track {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, var(--color-bg-inset), color-mix(in srgb, var(--color-bg-inset) 100%, white 4%));
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.55),
    inset 0 -1px 0 rgba(255,255,255,0.04);
  transition:
    background var(--motion-base) var(--ease-standard),
    border-color var(--motion-base);
}
.iblis-switch-track::after {
  content: ""; position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background:
    radial-gradient(circle at 30% 25%, #fdfdff 0%, #c9cbd4 60%, #8e909a 100%);
  border-radius: var(--radius-full);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.7),
    inset 0 -2px 3px rgba(0,0,0,0.30),
    0 1px 2px rgba(0,0,0,0.55),
    0 2px 4px rgba(0,0,0,0.30);
  transition: transform var(--motion-base) var(--ease-standard), background var(--motion-base);
}
.iblis-switch input:checked + .iblis-switch-track {
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--color-accent) 100%, black 20%) 0%,
      color-mix(in srgb, var(--color-accent-cool) 100%, black 15%) 100%);
  border-color: color-mix(in srgb, var(--color-accent-cool) 100%, black 30%);
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.45),
    inset 0 -1px 0 rgba(255,255,255,0.10),
    0 0 0 1px color-mix(in srgb, var(--color-accent-cool) 25%, transparent);
}
.iblis-switch input:checked + .iblis-switch-track::after {
  transform: translateX(20px);
  background: radial-gradient(circle at 30% 25%, #ffffff 0%, #e8eaf2 60%, #b2b6c3 100%);
}
.iblis-switch input:focus-visible + .iblis-switch-track {
  outline: 2px solid var(--color-accent-cool);
  outline-offset: 3px;
}

/* --- range slider -------------------------------------------------------- */
.iblis-range {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 26px;
  background: transparent;
  cursor: pointer;
}
.iblis-range::-webkit-slider-runnable-track {
  height: 6px;
  background:
    linear-gradient(90deg, var(--color-accent) 0%, var(--color-accent-cool) 100%);
  border-radius: var(--radius-full);
  box-shadow:
    inset 0 1px 2px rgba(0,0,0,0.55),
    inset 0 -1px 0 rgba(255,255,255,0.10);
  border: 1px solid rgba(0,0,0,0.4);
}
.iblis-range::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px;
  margin-top: -7px;
  background:
    radial-gradient(circle at 30% 25%, #ffffff 0%, #d4d6df 70%, #9ea1ad 100%);
  border: 1.5px solid color-mix(in srgb, var(--color-accent-cool) 100%, black 25%);
  border-radius: var(--radius-full);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.7),
    inset 0 -2px 3px rgba(0,0,0,0.35),
    0 1px 2px rgba(0,0,0,0.55),
    0 3px 6px rgba(0,0,0,0.35);
  transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}
.iblis-range::-webkit-slider-thumb:hover { transform: scale(1.08); }
.iblis-range::-webkit-slider-thumb:active {
  transform: scale(0.96);
  box-shadow:
    inset 0 2px 3px rgba(0,0,0,0.5),
    0 1px 1px rgba(0,0,0,0.55);
}
.iblis-range::-moz-range-track {
  height: 6px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-cool));
  border-radius: var(--radius-full);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.55);
}
.iblis-range::-moz-range-thumb {
  width: 18px; height: 18px;
  background: radial-gradient(circle at 30% 25%, #ffffff, #c9cbd4 70%, #8e909a);
  border: 1.5px solid color-mix(in srgb, var(--color-accent-cool) 100%, black 25%);
  border-radius: var(--radius-full);
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
