/**
 * Sena Design System v1.0
 * Checkbox Component
 *
 * Requires: colors.css + theme.css + Font Awesome 7 Pro (@font-face from buttons.css or declared separately)
 *
 * Usage:
 *   <label class="checkbox">
 *     <input type="checkbox" class="checkbox-input">
 *     <span class="checkbox-box"><span class="checkbox-icon">check</span></span>
 *     Optional label
 *   </label>
 */

/* @font-face removed — now provided by vendored FA CSS */
/* ─── Container ───────────────────────────────────────────────────────────── */

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-8);
  cursor: pointer;
  font-family: var(--ff-text);
  font-size: var(--text-sm);
  font-weight: var(--fw-regular);
  color: var(--text-primary);
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
}

/* ─── Hidden native input ─────────────────────────────────────────────────── */

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

/* ─── Box ─────────────────────────────────────────────────────────────────── */

.checkbox-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border: 1px solid var(--stroke-accent);
  border-radius: 3px;
  background-color: transparent;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease;
}

/* ─── Checkmark icon ──────────────────────────────────────────────────────── */

.checkbox-icon {
  /* Font comes from the required `fa-solid fa-check` classes on this element. */
  font-size: 7px;
  line-height: 1;
  color: var(--fg-on-accent);
  opacity: 0;
  transition: opacity 0.1s ease;
}

/* ─── Checked state ───────────────────────────────────────────────────────── */

.checkbox-input:checked + .checkbox-box {
  background-color: var(--fg-accent);
  border-color: var(--fg-accent);
}

.checkbox-input:checked + .checkbox-box .checkbox-icon {
  opacity: 1;
}

/* ─── Focus ───────────────────────────────────────────────────────────────── */

.checkbox-input:focus-visible + .checkbox-box {
  outline: 2px solid var(--stroke-accent);
  outline-offset: 2px;
}

/* ─── Disabled ────────────────────────────────────────────────────────────── */

.checkbox-input:disabled + .checkbox-box {
  border-color: var(--stroke-secondary);
  background-color: transparent;
  cursor: not-allowed;
}

.checkbox-input:disabled + .checkbox-box .checkbox-icon {
  color: var(--fg-disabled);
}

.checkbox-input:disabled:checked + .checkbox-box {
  background-color: var(--bg-secondary);
  border-color: var(--stroke-secondary);
}

.checkbox-input:disabled ~ * {
  cursor: not-allowed;
}

.checkbox:has(.checkbox-input:disabled) {
  cursor: not-allowed;
  color: var(--text-disabled);
}
