/**
 * TM School — плашка cookie (152-ФЗ) и чекбоксы согласия в формах.
 *
 * Плашка фиксирована внизу и не участвует в потоке документа,
 * поэтому не вызывает сдвиг контента (CLS = 0).
 */

.tm-cookie {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999;
  display: none;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px));
  background: #ffffff;
  border-top: 1px solid var(--color-border, #e2e8f0);
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.14);
  color: var(--color-body, #334155);
}

html.tm-cookie-pending .tm-cookie {
  display: block;
}

/* Не перекрываем мобильное меню и модальные окна. */
body:has(.tm-mobile-panel.tm-open) .tm-cookie,
body:has(.tm-modal.tm-open) .tm-cookie {
  display: none !important;
}

.tm-cookie[hidden] {
  display: none !important;
}

.tm-cookie__inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tm-cookie__text {
  flex: 1 1 auto;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.tm-cookie__text a {
  color: var(--color-secondary-dark, #5d701c);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tm-cookie__text a:hover {
  color: var(--color-secondary-dark, #5d701c);
  filter: brightness(0.85);
}

.tm-cookie__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.tm-cookie__accept {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 24px;
  border: 0;
  border-radius: 10px;
  background: var(--color-secondary-dark, #5d701c);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.18s ease;
}

.tm-cookie__accept:hover {
  filter: brightness(0.9);
}

.tm-cookie__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.tm-cookie__close:hover {
  background: var(--color-mist, #f1f5f9);
  color: var(--color-ink, #1e293b);
}

.tm-cookie__accept:focus-visible,
.tm-cookie__close:focus-visible {
  outline: 3px solid var(--color-primary, #01a0e2);
  outline-offset: 2px;
}

/* Чекбокс согласия в формах обратной связи и комментариях. */
.tm-consent {
  margin: 0.25rem 0 0;
}

.tm-consent .tm-check {
  align-items: flex-start;
}

.tm-consent .tm-check-mark {
  flex: 0 0 auto;
  margin-top: 2px;
}

.tm-consent .tm-check-text {
  line-height: 1.5;
}

.tm-consent .tm-check-text a {
  color: var(--color-secondary-dark, #5d701c);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Мобильная версия: кнопка согласия на всю ширину, крестик — в углу. */
@media (max-width: 639px) {
  .tm-cookie__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .tm-cookie__text {
    padding-right: 48px;
  }

  .tm-cookie__actions {
    display: block;
  }

  .tm-cookie__accept {
    width: 100%;
  }

  .tm-cookie__close {
    position: absolute;
    top: 8px;
    right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tm-cookie__accept,
  .tm-cookie__close {
    transition: none;
  }
}

@media print {
  .tm-cookie {
    display: none !important;
  }
}
