/**
 * ONE-OS vm-page 多选框 — 全局样式
 * 规范：src/prototypes/vm-shared/DESIGN.md
 */

.vm-checkbox,
.vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  border: 1.5px solid var(--ln-hairline-strong);
  border-radius: 6px;
  background-color: var(--ln-surface-card);
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  vertical-align: middle;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.14s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.vm-checkbox:hover:not(:disabled),
.vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"]:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--ln-primary) 55%, var(--ln-hairline-strong));
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.04),
    0 0 0 3px color-mix(in srgb, var(--ln-primary) 14%, transparent);
}

.vm-checkbox:active:not(:disabled),
.vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"]:active:not(:disabled) {
  transform: scale(0.92);
}

.vm-checkbox:checked,
.vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"]:checked {
  border-color: var(--ln-primary-focus);
  background-color: var(--ln-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.75 8.25 6.5 11 12.25 5'/%3E%3C/svg%3E");
  background-size: 13px 13px;
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--ln-primary) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.vm-checkbox:indeterminate,
.vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"]:indeterminate {
  border-color: var(--ln-primary-focus);
  background-color: var(--ln-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ffffff' stroke-width='2.25' stroke-linecap='round'%3E%3Cpath d='M4.25 8h7.5'/%3E%3C/svg%3E");
  background-size: 13px 13px;
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--ln-primary) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.vm-checkbox:focus-visible,
.vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow:
    inset 0 1px 2px rgba(15, 23, 42, 0.04),
    0 0 0 3px color-mix(in srgb, var(--ln-primary) 28%, transparent);
}

.vm-checkbox:checked:focus-visible,
.vm-checkbox:indeterminate:focus-visible,
.vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"]:checked:focus-visible,
.vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"]:indeterminate:focus-visible {
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--ln-primary) 28%, transparent),
    0 0 0 3px color-mix(in srgb, var(--ln-primary) 28%, transparent);
}

.vm-checkbox:disabled,
.vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 表格勾选列 */
.vm-col-check,
.ldb-col-check,
.cm-col-check {
  width: 48px;
  text-align: center;
  vertical-align: middle;
}

.vm-col-check .vm-checkbox,
.ldb-col-check .vm-checkbox,
.cm-col-check .vm-checkbox,
.vm-col-check > input[type="checkbox"],
.ldb-col-check > input[type="checkbox"],
.cm-col-check > input[type="checkbox"] {
  display: inline-grid;
}


@media (prefers-reduced-motion: reduce) {
  .vm-checkbox,
  .vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"] {
    transition: none;
  }

  .vm-checkbox:active:not(:disabled),
  .vm-page :is(.vm-col-check, .ldb-col-check, .cm-col-check) > input[type="checkbox"]:active:not(:disabled) {
    transform: none;
  }
}
