/* controls.css — элементы управления и строки: свитч, сегменты, чекбокс,
 * строка списка (.c-row), компактное напоминание (.c-reminder), чипы. */

/* ── Строка списка: настройки, поездки, устройства ────────────────────── */
.c-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding-block: var(--sp-3);
  border-top: 1px solid var(--border);
}

.c-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.c-row:last-child {
  padding-bottom: 0;
}

.c-row__icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--text-muted);
}

.c-row__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.c-row__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
}

.c-row__meta {
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}

.c-row__trail {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
}

/* ── Свитч: нативный checkbox, стилизованный под переключатель ────────── */
.c-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  cursor: pointer;
}

.c-switch input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface-3);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease);
}

.c-switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--sh-1);
  transition: transform var(--dur-2) var(--ease);
}

.c-switch input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.c-switch input:checked::after {
  transform: translateX(18px);
}

.c-switch input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ── Сегментированный выбор (тема, язык) ─────────────────────────────── */
.c-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  max-width: 100%;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.c-seg__item {
  position: relative;
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.c-seg__item input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.c-seg__item:has(input:checked) {
  background: var(--surface);
  color: var(--text);
  font-weight: var(--fw-semibold);
  box-shadow: var(--sh-1);
}

.c-seg__item:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ── Чекбокс-строка (чек-листы) ──────────────────────────────────────── */
.c-check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  min-height: var(--tap);
  padding-block: var(--sp-2);
  cursor: pointer;
}

.c-check input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.c-check input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.c-check input:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 7px;
  width: 5px;
  height: 10px;
  border: 2px solid var(--accent-ink);
  border-top: 0;
  border-left: 0;
  transform: rotate(40deg);
}

.c-check input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.c-check__text {
  font-size: var(--fs-sm);
  line-height: 1.45;
}

.c-check input:checked + .c-check__text {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}

/* ── Компактное напоминание под карточкой ────────────────────────────── */
.c-reminder {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}

.c-reminder__icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--warn);
}

.c-reminder__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.c-reminder__title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}

.c-reminder__meta {
  font-size: var(--fs-2xs);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}

.c-reminder__action {
  flex: none;
}

/* ── Чипы (список валют в профиле, теги) ────────────────────────────── */
.c-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

/* Строка, где управление не влезает справа: уводим его под текст */
.c-row--stack {
  flex-wrap: wrap;
}

.c-row--stack .c-row__trail {
  width: 100%;
}

/* Сегменты на всю ширину — для стека и настроек */
.c-seg--block {
  display: flex;
  width: 100%;
}

.c-seg--block .c-seg__item {
  flex: 1;
}

/* ── Сворачиваемый блок (details/summary) ─────────────────────────────── */
.c-details {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

.c-details > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  color: var(--accent-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  list-style: none;
}

.c-details > summary::-webkit-details-marker {
  display: none;
}

.c-details > summary svg {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform var(--dur-1) var(--ease);
}

.c-details[open] > summary svg {
  transform: rotate(90deg);
}

.c-details > summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.c-details__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
}

.c-details__count {
  color: var(--text-muted);
  font-weight: var(--fw-regular);
}
