/**
 * GhostGuard VPN — TradeMC buy widget shell (модалка + слоты .gg-trademc-slot).
 * Подключение на любом сайте:
 *   <link rel="stylesheet" href="https://ваш-домен/trademc-widget.css">
 * Скрипт TradeMC подгружает buyform.css — ниже переопределения для .gg-trademc-slot.
 */

.gg-trademc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(5, 0, 17, 0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  animation: gg-trademc-fade-in 0.22s ease-out;
}

@keyframes gg-trademc-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes gg-trademc-pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gg-trademc-dialog {
  position: relative;
  z-index: 9999;
  width: 100%;
  max-width: 480px;
  max-height: min(90vh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: linear-gradient(
      165deg,
      rgba(15, 23, 42, 0.96) 0%,
      rgba(5, 0, 24, 0.98) 100%
    );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 24px 80px rgba(0, 0, 0, 0.65),
    0 0 60px rgba(6, 182, 212, 0.12);
  animation: gg-trademc-pop-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.gg-trademc-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  flex-shrink: 0;
}

.gg-trademc-dialog__title {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #e2e8f0;
  line-height: 1.25;
}

.gg-trademc-dialog__close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.6);
  color: #94a3b8;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.gg-trademc-dialog__close:hover {
  color: #f1f5f9;
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(6, 182, 212, 0.12);
}

.gg-trademc-dialog__body {
  padding: 14px 18px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Переключатель: новая подписка / продление */
.gg-trademc-mode {
  display: flex;
  gap: 8px;
  padding: 5px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(100, 116, 139, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.gg-trademc-mode__btn {
  flex: 1;
  margin: 0;
  padding: 11px 12px;
  border: none;
  border-radius: 11px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #94a3b8;
  background: transparent;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.gg-trademc-mode__btn:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04);
}

.gg-trademc-mode__btn--active {
  color: #020617;
  background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.gg-trademc-mode__btn:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.8);
  outline-offset: 2px;
}

.gg-trademc-widget-host {
  position: relative;
  min-height: 100px;
}

/* Неактивный слот: остаётся в DOM для ответов TradeMC, но не виден и не мешает */
.gg-trademc-slot--inactive {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  pointer-events: none !important;
}

/* ─── TradeMC buy form: тёмная тема + аккуратный select товаров ─── */
.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #e2e8f0;
}

/* Заголовок внутри виджета дублирует модалку — убираем */
.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-title {
  display: none;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-input,
.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select select {
  width: 100%;
  margin-bottom: 0;
  padding: 14px 44px 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(100, 116, 139, 0.45);
  outline: none;
  font-size: 0.9375rem;
  line-height: 1.35;
  color: #f8fafc;
  background: rgba(2, 6, 23, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-input::placeholder {
  color: rgba(148, 163, 184, 0.92);
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-input:focus,
.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select select:focus {
  border-color: rgba(34, 211, 238, 0.65);
  background: rgba(15, 23, 42, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 3px rgba(6, 182, 212, 0.22);
}

/* Блок выбора товара: подпись + «карточка» с градиентной обводкой + стрелка */
.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 10px;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.2) 0%,
    rgba(99, 102, 241, 0.16) 48%,
    rgba(34, 211, 238, 0.1) 100%
  );
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select::before {
  content: "Товар";
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(165, 243, 252, 0.88);
  padding: 0 4px;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select select {
  padding-right: 48px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(34, 211, 238, 0.85);
  border-bottom: 2px solid rgba(34, 211, 238, 0.85);
  right: 26px;
  top: calc(50% + 12px);
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
  opacity: 0.95;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select select:hover {
  border-color: rgba(148, 163, 184, 0.55);
}

/* Плейсхолдер-строка и группы в выпадающем списке */
.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select select option:disabled {
  color: rgba(148, 163, 184, 0.75);
  background: #020617;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select select option,
.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select select optgroup {
  background: #0f172a;
  color: #e2e8f0;
  font-weight: 500;
  padding: 0.5rem 0;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-select select optgroup {
  font-weight: 700;
  color: #94a3b8;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-userfields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-userfields .trademc-buyform-input {
  padding-left: 16px;
  padding-right: 16px;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-button {
  display: block;
  width: 100%;
  margin-top: 2px;
  padding: 16px 20px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #020617;
  cursor: pointer;
  background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 45%, #0891b2 100%);
  box-shadow:
    0 8px 28px rgba(6, 182, 212, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition:
    transform 0.15s ease,
    filter 0.15s ease,
    box-shadow 0.15s ease;
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow:
    0 12px 32px rgba(6, 182, 212, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-button.load:before {
  background: rgba(8, 145, 178, 0.92);
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-button.load:after {
  border-color: #fff rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.2);
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-error {
  color: #fda4af;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(127, 29, 29, 0.35);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-error:empty {
  display: none;
  padding: 0;
  border: none;
  background: none;
}

@media (prefers-reduced-motion: reduce) {
  .gg-trademc-backdrop,
  .gg-trademc-dialog {
    animation: none;
  }

  .gg-trademc-widget-host .gg-trademc-slot .trademc-buyform-button:hover {
    transform: none;
  }
}
