/* Telegram-блок */
.tg-compact {
  margin: 0 auto;
  max-width: var(--p24-container, 1200px);
  padding: 0;
}

/* Обёртка на главной перед подвалом */
.site-pre-footer {
  padding: 40px 20px 48px;
  background: linear-gradient(180deg, #fff 0%, #f0f9ff 100%);
  border-top: 1px solid #e2e8f0;
}

.site-pre-footer__inner {
  max-width: var(--p24-container, 1200px);
  margin: 0 auto;
}

.site-pre-footer .tg-compact {
  max-width: none;
}

.tg-compact__card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(34, 158, 217, 0.18);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 40px rgba(34, 158, 217, 0.1);
}

.tg-compact__glow {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 0% 0%, rgba(34, 158, 217, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(0, 186, 119, 0.08), transparent 50%);
}

.tg-compact__bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 20px;
  padding: 16px 18px;
  flex-wrap: wrap;
}

.tg-compact__brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.tg-compact__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #2aabee 0%, #229ed9 100%);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(34, 158, 217, 0.35);
}

.tg-compact__headline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.tg-compact__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.3;
}

.tg-compact__badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0369a1;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  border: 1px solid rgba(34, 158, 217, 0.25);
  border-radius: 999px;
}

.tg-compact__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #64748b;
}

.tg-compact__desc strong {
  color: #0f172a;
  font-weight: 700;
}

.tg-compact__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.tg-compact__cta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 10px 18px;
  border-radius: 12px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #2aabee 0%, #1d8ccc 100%);
  box-shadow: 0 4px 14px rgba(34, 158, 217, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tg-compact__cta:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(34, 158, 217, 0.45);
}

.tg-compact__cta-label {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tg-compact__cta-user {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tg-compact__toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.tg-compact__toggle:hover {
  border-color: #94a3b8;
  background: #fff;
  color: #0f172a;
}

.tg-compact__toggle[aria-expanded="true"] {
  border-color: #229ed9;
  background: #f0f9ff;
  color: #0369a1;
}

.tg-compact__chevron {
  transition: transform 0.25s ease;
}

.tg-compact__toggle[aria-expanded="true"] .tg-compact__chevron {
  transform: rotate(180deg);
}

/* Панель: только одно состояние видно */
.tg-compact__panel {
  position: relative;
  border-top: 1px solid rgba(34, 158, 217, 0.12);
  background: linear-gradient(180deg, #f8fcff 0%, #fff 100%);
  padding: 0 18px 18px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.3s ease;
}

.tg-compact__panel:not([hidden]) {
  max-height: 420px;
  opacity: 1;
  padding-top: 16px;
}

.tg-compact__panel[data-state="idle"] .tg-compact__skeleton,
.tg-compact__panel[data-state="idle"] .tg-compact__picker,
.tg-compact__panel[data-state="ready"] .tg-compact__skeleton {
  display: none !important;
}

.tg-compact__panel[data-state="loading"] .tg-compact__picker {
  display: none !important;
}

.tg-compact__panel[data-state="loading"] .tg-compact__skeleton {
  display: block !important;
}

.tg-compact__panel[data-state="ready"] .tg-compact__picker {
  display: block !important;
  animation: tg-compact-fade-in 0.35s ease;
}

@keyframes tg-compact-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Скелетон */
.tg-compact__skeleton {
  display: none;
  padding: 4px 0 8px;
}

.tg-compact__skel-search {
  height: 44px;
  border-radius: 12px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 45%, #e2e8f0 90%);
  background-size: 200% 100%;
  animation: tg-compact-shimmer 1.2s ease-in-out infinite;
}

.tg-compact__skel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tg-compact__skel-chips span {
  display: block;
  width: 76px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 45%, #e2e8f0 90%);
  background-size: 200% 100%;
  animation: tg-compact-shimmer 1.2s ease-in-out infinite;
}

.tg-compact__skel-chips span:nth-child(3n) { width: 92px; }
.tg-compact__skel-chips span:nth-child(4n) { width: 64px; }

@keyframes tg-compact-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Пикер */
.tg-compact__popular {
  margin-bottom: 14px;
}

.tg-compact__popular-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  margin-bottom: 8px;
}

.tg-compact__popular-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tg-compact__chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #0369a1;
  text-decoration: none;
  background: #fff;
  border: 1px solid rgba(34, 158, 217, 0.28);
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.tg-compact__chip:hover {
  background: #e0f2fe;
  border-color: #229ed9;
  color: #0c4a6e;
  transform: translateY(-1px);
}

.tg-compact__chip.is-active {
  background: linear-gradient(135deg, #2aabee, #229ed9);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(34, 158, 217, 0.35);
}

.tg-compact__search-wrap {
  position: relative;
  margin-bottom: 12px;
}

.tg-compact__search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.tg-compact__search {
  width: 100%;
  padding: 11px 14px 11px 42px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tg-compact__search:focus {
  outline: none;
  border-color: #229ed9;
  box-shadow: 0 0 0 4px rgba(34, 158, 217, 0.12);
}

.tg-compact__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.tg-compact__grid li {
  animation: tg-compact-chip-in 0.3s ease backwards;
}

.tg-compact__grid li:nth-child(1) { animation-delay: 0.02s; }
.tg-compact__grid li:nth-child(2) { animation-delay: 0.04s; }
.tg-compact__grid li:nth-child(3) { animation-delay: 0.06s; }
.tg-compact__grid li:nth-child(4) { animation-delay: 0.08s; }
.tg-compact__grid li:nth-child(n+5) { animation-delay: 0.1s; }

@keyframes tg-compact-chip-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.tg-compact__grid a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.tg-compact__grid a::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #229ed9;
  opacity: 0.5;
}

.tg-compact__grid a:hover,
.tg-compact__grid a:focus-visible {
  border-color: #229ed9;
  background: #f0f9ff;
  color: #0369a1;
}

.tg-compact__grid a:hover::before {
  opacity: 1;
}

.tg-compact__hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}

@media (max-width: 768px) {
  .tg-compact__bar {
    flex-direction: column;
    align-items: stretch;
  }
  .tg-compact__actions {
    width: 100%;
  }
  .tg-compact__cta {
    flex: 1;
    align-items: center;
    text-align: center;
  }
  .tg-compact__toggle {
    flex: 1;
    justify-content: center;
  }
  .tg-compact__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tg-compact__panel,
  .tg-compact__grid li,
  .tg-compact__panel[data-state="ready"] .tg-compact__picker {
    animation: none;
    transition: none;
  }
}
