/* Глобальные шрифты */
:root {
  --tpl-font-size-main: 14px; /* Установите новый размер шрифта */
  --tpl-font-size-main-lg: 14px; /* Установите новый размер шрифта для больших элементов */
  --tpl-line-height-main: 1.6; /* Увеличена высота строки для лучшей читаемости */
}

/* Обёртка страницы шаблона */
.tpl-page {
  padding-top: 20px;
  padding-bottom: 40px;
}

/* HERO над шаблоном */
.tpl-hero {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(var(--blur)) saturate(150%);
  padding: 18px 18px 16px;
  margin-bottom: 20px;
  overflow: hidden;
}

.tpl-hero::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(76, 111, 255, 0.25),
    transparent 70%
  );
  top: -110px;
  right: -110px;
  pointer-events: none;
}

.tpl-hero-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-strong);
  margin-bottom: 6px;
}

.tpl-hero-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
  color: #111827;
  max-width: 76%;
  margin-bottom: 6px;
}

.tpl-hero-subtitle {
  font-size: 12px;
  color: var(--text-soft);
  max-width: 80%;
  margin-bottom: 10px;
}

.tpl-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--text-soft);
}

.tpl-hero-meta-badge {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(76, 111, 255, 0.08);
  color: var(--accent-strong);
}

.tpl-hero-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
}

/* Основной блок с шаблоном */
.tpl-layout {
  display: block;
}

.tpl-card-full {
  border-radius: var(--radius-lg);
  background: #ffffff;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  padding: 0;
  overflow: hidden;
}

.tpl-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.tpl-card-header-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
}

.tpl-body {
  padding: 14px 14px 16px;
  font-size: var(--tpl-font-size-main); /* Размер шрифта для основного текста */
  line-height: var(--tpl-line-height-main);
  color: var(--text-main);
  background: #ffffff;
}

/* Панель с кнопками */
.tpl-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 10px;
}

.tpl-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tpl-toolbar button {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 10.5px;
  border: 1px solid rgba(209, 213, 219, 1);
  background: #f9fafb;
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
  white-space: nowrap;
}

.tpl-toolbar button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tpl-toolbar button:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-ink-sm);
  background: #eceff1;
}

.tpl-toolbar button.primary {
  border: none;
  background-image: linear-gradient(130deg, var(--accent), var(--accent-alt));
  color: #ffffff;
  box-shadow: var(--shadow-glass);
}

.tpl-toolbar button.primary:active {
  box-shadow: var(--shadow-ink-sm);
}

.tpl-toolbar-icon {
  font-size: 12px;
}

/* Сам текст шаблона */
.tpl-template-wrapper {
  border-radius: var(--radius-md);
  border: 1px solid #d1d5db;
  background: #f3f4f6;
  padding: 12px 12px 10px;
  max-height: none;
  overflow: visible;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  font-size: 14px; /* Установлен новый размер шрифта */
  line-height: 1.6;
  color: #0f172a;
  white-space: normal;
}

.tpl-template-wrapper h3 {
  font-size: 12px;
  font-weight: 700;
  margin: 10px 0 8px;
  text-transform: uppercase;
}

.tpl-template-wrapper p {
  margin: 0 0 4px;
}

.tpl-template-wrapper p:empty {
  margin: 0;
  padding: 0;
  line-height: 0;
  height: 0;
}

.tpl-placeholder {
  color: #111827;
  font-weight: 600;
  word-break: break-word;
}

/* Toast */
.tpl-toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.97);
  color: #ecfdf5;
  font-size: 11px;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  z-index: 40;
}

.tpl-toast.visible {
  opacity: 1;
  transform: translate(-50%, -4px);
}

/* Адаптив */
@media (max-width: 900px) {
  .tpl-hero-title {
    max-width: 100%;
  }

  .tpl-hero-subtitle {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .tpl-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .tpl-toolbar-left {
    justify-content: flex-start;
  }

  .tpl-toolbar button {
    width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .tpl-page {
    padding-top: 16px;
    padding-bottom: 24px;
  }

  .tpl-hero {
    padding: 14px 12px 12px;
  }

  .tpl-hero-eyebrow {
    font-size: 10px;
    letter-spacing: 0.16em;
  }

  .tpl-hero-title {
    font-size: 17px;
    margin-bottom: 6px;
    max-width: 100%;
  }

  .tpl-hero-subtitle {
    font-size: 11px;
    margin-bottom: 8px;
    max-width: 100%;
  }

  .tpl-body {
    padding: 12px 10px 12px;
    font-size: 11px;
  }

  .tpl-template-wrapper {
    max-height: none;
    padding: 10px 10px 8px;
    font-size: 14px; /* Новый размер шрифта для мобильных устройств */
    line-height: 1.55;
  }
}
