/* nc-checkbox — styled native checkbox with oversized checkmark */

.nc-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.nc-check__input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--theme-border-strong, #ced4da);
  border-radius: 6px;
  background: var(--theme-bg-surface, #fff);
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  flex-shrink: 0;
}

/* Oversized checkmark, extends beyond the box. Форма маской, а не символом: U+2714 на iOS рисуется эмодзи и не берёт
   color (замечание владельца 05.11: чёрная/серая галочка на iPhone). Цвет — по-прежнему color, размер — от font-size. */
.nc-check__input::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 1px;
  font-size: 24px;
  width: 0.92em;
  height: 0.92em;
  color: var(--theme-accent);
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.2 13.4c1.2-1.2 2.4-1.8 3.4-1.7.9.1 1.8 1.2 2.8 3.1C11.8 10.2 15.200 6 21.700 2.200l1 1.200c-5.100 4.700-8.500 10-11.100 16.900-.4 1-1 1.400-1.900 1.400s-1.500-.4-1.900-1.400c-1-2.500-2.500-5-4.600-7.300z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.2 13.4c1.2-1.2 2.4-1.8 3.4-1.7.9.1 1.8 1.2 2.8 3.1C11.8 10.2 15.200 6 21.700 2.200l1 1.200c-5.100 4.700-8.500 10-11.100 16.900-.4 1-1 1.400-1.900 1.400s-1.500-.4-1.900-1.400c-1-2.500-2.500-5-4.600-7.300z'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: scale(0);
  transform-origin: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Cross hint — hidden by default */
.nc-check__input::before {
  content: '✘';
  position: absolute;
  bottom: -1px;
  left: 1px;
  font-size: 20px;
  line-height: 1;
  color: var(--theme-danger, #f06548);
  opacity: 0;
  transform: scale(0);
  transform-origin: center;
  transition: opacity 0.2s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Checked state */
.nc-check__input:checked {
  background: var(--theme-bg-surface, #fff);
  border-color: var(--theme-accent);
}

.nc-check__input:checked::after {
  transform: scale(1);
}

/* Bounce on check */
.nc-check__input:active {
  transform: scale(0.9);
}

/* Подсказки наведения — только там, где оно есть: на касании :hover залипает, и только что отмеченное выглядело снятым
   (галочка скрыта, крест, красноватая рамка). */
@media (hover: hover) {
  /* Hover unchecked — ghost checkmark */
  .nc-check:hover .nc-check__input:not(:checked)::after {
    transform: scale(0.7);
    opacity: 0.25;
  }

  /* Hover checked — fade checkmark out, show cross */
  .nc-check:hover .nc-check__input:checked::after {
    opacity: 0;
    transform: scale(0.5);
  }

  .nc-check:hover .nc-check__input:checked::before {
    opacity: 0.5;
    transform: scale(0.85);
  }

  .nc-check:hover .nc-check__input:checked {
    border-color: color-mix(in srgb, var(--theme-danger, #f06548) 50%, var(--theme-border-strong, #ced4da));
  }
}

/* Focus */
.nc-check__input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent-base) 24%, transparent);
}

/* Disabled */
.nc-check__input:disabled {
  opacity: 0.5;
  cursor: default;
}

.nc-check:has(.nc-check__input:disabled) {
  cursor: default;
  opacity: 0.6;
}

/* Radio — круг с точкой: выбор одного из нескольких (галочка и крестик — у checkbox) */
.nc-check__input[type="radio"] {
  border-radius: 50%;
}

.nc-check__input[type="radio"]::after {
  content: '';
  top: 4px;
  left: 4px;
  bottom: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--theme-accent);
  -webkit-mask: none;
  mask: none;
}

.nc-check__input[type="radio"]::before {
  content: none;
}

/* Выбранный radio по наведению не «снимается» — повторный клик его не сбрасывает */
.nc-check:hover .nc-check__input[type="radio"]:checked::after {
  opacity: 1;
  transform: scale(1);
}

.nc-check:hover .nc-check__input[type="radio"]:checked {
  border-color: var(--theme-accent);
}

/* Label */
.nc-check__label {
  font-size: 0.85rem;
  color: var(--theme-text-primary, #212529);
  line-height: 1.3;
}

/* Dark mode */
[data-layout-mode="dark"] .nc-check__input {
  background: var(--theme-bg-surface, #262a2f);
  border-color: var(--theme-border-strong, #3f4a58);
}

[data-layout-mode="dark"] .nc-check__input:checked {
  background: var(--theme-bg-surface, #262a2f);
  border-color: var(--theme-accent);
}

[data-layout-mode="dark"] .nc-check__input::after {
  color: var(--theme-accent);
}


[data-layout-mode="dark"] .nc-check__input::before {
  color: var(--theme-danger, #ff8a75);
}

[data-layout-mode="dark"] .nc-check__label {
  color: var(--theme-text-primary, #ced4da);
}
