/* =====================================================================
   NGHELPER/pro/pro.css
   Сторінка PRO-підписки: 4px сітка, tabular-nums, нейтральні поверхні,
   responsive-table з @container та copy-button без вимкнення стану.
   ===================================================================== */

:root {
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
}

:where(a:any-link, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

svg.ico {
  display: block;
  flex-shrink: 0;
}

.loading-svg-spin {
  animation: ngProSpin 0.9s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes ngProSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .loading-svg-spin {
    animation: none;
  }
}

.tabular-nums,
.plan-amount,
.pro-status-value,
.pro-status-detail,
.nfh-code,
.tx-amount,
.tx-date {
  font-variant-numeric: tabular-nums;
}

.pro-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 12px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 8px;
  font: 500 14px/1.2 var(--f-body);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink, #05080d);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-secondary {
  background: var(--raised);
  color: var(--fg);
  border-color: var(--line2, var(--line));
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Банер гостя ---------- */
.guest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: var(--raised);
  border: 1px solid var(--line2, var(--line));
  border-radius: 12px;
}

.guest-banner-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
  font-size: 14px;
}

.guest-banner-text .ico {
  color: var(--accent);
}

/* ---------- Блок 1: Hero + Статус ---------- */
.pro-hero {
  padding: 24px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: center;
}

.pro-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pro-brand-name {
  font: 700 22px/1.1 var(--f-body);
  letter-spacing: 0.02em;
  color: var(--fg);
}

.pro-tag.pro-tag-hero {
  font-size: 13px !important;
  padding: 4px 10px 3px !important;
  border-radius: 7px !important;
}

.pro-hero-title {
  margin: 0 0 8px;
  font: 600 28px/1.2 var(--f-body);
  color: var(--fg);
}

.pro-hero-sub {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 52ch;
}

.pro-status-box {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pro-status-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pro-status-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.pro-status-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}

.pro-status-value.is-pro {
  color: var(--good, #34c778);
}

.pro-status-detail {
  font-size: 13px;
  color: var(--muted);
}

.pro-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Заголовки секцій ---------- */
.pro-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-title {
  margin: 0;
  font: 600 20px/1.3 var(--f-body);
}

.section-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- Блок 2: Тарифи ---------- */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.plan-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.plan-card:hover {
  border-color: var(--line2, var(--line));
  transform: translateY(-2px);
}

.plan-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 12px 28px -14px rgba(246, 196, 69, 0.35);
}

.plan-card-featured {
  background: linear-gradient(180deg, rgba(246, 196, 69, 0.08) 0%, var(--raised) 52%);
  border-color: rgba(246, 196, 69, 0.42);
  box-shadow: 0 10px 26px -16px rgba(246, 196, 69, 0.35);
}

.plan-card-best {
  background: linear-gradient(180deg, rgba(52, 199, 120, 0.07) 0%, var(--panel) 55%);
  border-color: rgba(52, 199, 120, 0.35);
}

.plan-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 26px;
}

.plan-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.plan-duration {
  font: 600 16px/1.2 var(--f-body);
  color: var(--fg);
}

.plan-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--well, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--line);
  color: var(--muted);
  font: 500 11px/1.4 var(--f-body);
}

.plan-badge {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(246, 196, 69, 0.14);
  border: 1px solid rgba(246, 196, 69, 0.4);
  color: var(--accent);
  font: 600 12px/1.4 var(--f-mono);
}

.plan-price-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plan-old-price {
  font: 500 14px/1.2 var(--f-body);
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.plan-amount {
  font: 700 34px/1.08 var(--f-body);
  color: var(--fg);
  letter-spacing: -0.02em;
}

.plan-currency {
  font: 500 15px/1.2 var(--f-body);
  color: var(--muted);
}

.plan-note {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  flex: 1;
  line-height: 1.45;
}

.plan-saving {
  color: var(--good, #34c778);
  font-weight: 500;
}

/* ---------- Панель оплати ---------- */
.payment-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: linear-gradient(180deg, rgba(246, 196, 69, 0.04) 0%, var(--panel) 40%);
  border-color: var(--line2, var(--line));
}

.payment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.payment-head-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.payment-title {
  margin: 0;
  font: 600 19px/1.3 var(--f-body);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-plan-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--raised);
  border: 1px solid var(--line2, var(--line));
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.payment-sub {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.payment-amount-strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}

.payment-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.85fr);
  gap: 20px;
  align-items: stretch;
}

.payment-actions-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.payment-box {
  flex: 1 1 0;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.payment-box-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--line2, var(--line));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 600 12px/1 var(--f-mono);
  color: var(--accent);
  flex-shrink: 0;
}

.step-title {
  margin: 0;
  font: 600 14.5px/1.35 var(--f-body);
  color: var(--fg);
}

.step-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.mono-inline {
  font-family: var(--f-mono);
  font-weight: 600;
  color: var(--fg);
}

.code-copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nfh-code {
  flex: 1 1 auto;
  min-width: 180px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px dashed var(--accent);
  font: 600 16px/1.2 var(--f-mono);
  color: var(--fg);
  letter-spacing: 0.03em;
  user-select: all;
  text-align: center;
}

.copy-tip {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--good, #34c778);
  opacity: 0;
  transition: opacity 150ms ease;
}

.copy-tip.is-visible {
  opacity: 1;
}

.payment-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 10px;
}

.jar-link {
  flex: 1 1 210px;
  min-height: 42px;
  padding: 9px 18px;
  font-weight: 600;
}

#btnCheckPayment {
  flex: 0 1 auto;
  min-height: 42px;
}

.payment-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.payment-check-status {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.payment-check-status.is-paid {
  color: var(--good, #34c778);
  font-weight: 500;
}

.payment-check-status.is-warn {
  color: var(--bad, #ef4444);
}

.payment-qr-col {
  display: flex;
}

.qr-card {
  width: 100%;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}

.qr-title {
  margin: 0;
  font: 600 14px/1.3 var(--f-body);
  color: var(--fg);
}

.qr-frame {
  background: #ffffff;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px -10px rgba(0, 0, 0, 0.5);
  line-height: 0;
}

.qr-frame svg {
  display: block;
  width: 184px;
  height: 184px;
  max-width: 100%;
}

.qr-caption {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  max-width: 30ch;
}

.payment-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(246, 196, 69, 0.06);
  border: 1px solid rgba(246, 196, 69, 0.28);
}

.payment-notice-ico {
  color: var(--accent);
  margin-top: 2px;
}

.payment-notice-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.payment-notice-title {
  margin: 0;
  font: 600 13.5px/1.35 var(--f-body);
  color: var(--fg);
}

.payment-notice-list {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

.payment-notice-list strong {
  color: var(--fg);
  font-weight: 600;
}

.payment-notice-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.payment-notice-link:hover {
  filter: brightness(1.1);
}

/* ---------- Блок 3: Порівняльна таблиця ---------- */
.table-scroll {
  container-type: inline-size;
  overflow: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.compare-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.compare-table th,
.compare-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.compare-table .col-feat {
  width: 52%;
}

.compare-table .col-free,
.compare-table .col-pro {
  width: 24%;
}

.compare-table .cmp-title {
  font-weight: 500;
  color: var(--fg);
  line-height: 1.35;
}

.compare-table .cmp-sub {
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}

.compare-table .col-free {
  color: var(--fg);
}

.compare-table .col-free-muted {
  color: var(--muted);
}

.compare-table thead th {
  font: 600 13px/1.3 var(--f-body);
  color: var(--muted);
  background: var(--raised);
}

.compare-table .col-pro {
  color: var(--accent);
  font-weight: 500;
}

.compare-table thead .col-pro {
  color: var(--accent);
}

.compare-table .group-row th {
  background: var(--well, rgba(255, 255, 255, 0.04));
  font: 600 13px/1.3 var(--f-body);
  color: var(--fg);
  letter-spacing: 0.02em;
}

.compare-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- Блок 4: Історія транзакцій (responsive-table) ---------- */
.tx-scroll {
  container-type: inline-size;
  overflow: auto;
}

.tx-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.responsive-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
  --label-1: "Дата";
  --label-2: "Тариф";
  --label-3: "Сума";
  --label-4: "Код";
  --label-5: "Статус";
}

.responsive-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.responsive-table th,
.responsive-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.responsive-table thead th {
  font: 600 13px/1.3 var(--f-body);
  color: var(--muted);
  background: var(--raised);
}

.responsive-table tbody tr:last-child td {
  border-bottom: 0;
}

.tx-code {
  font-family: var(--f-mono);
  font-size: 13px;
}

.tx-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--raised);
  border: 1px solid var(--line);
}

.tx-status.is-paid {
  color: var(--good, #34c778);
}

.tx-status.is-pending {
  color: var(--accent);
}

.tx-status.is-expired {
  color: var(--muted);
}

@container (width < 600px) {
  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }

  .responsive-table tbody tr:last-child {
    border-bottom: 0;
  }

  .responsive-table td {
    padding: 4px 0;
    border-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }

  .responsive-table td::before {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
  }

  .responsive-table td:nth-child(1)::before { content: var(--label-1) ": "; }
  .responsive-table td:nth-child(2)::before { content: var(--label-2) ": "; }
  .responsive-table td:nth-child(3)::before { content: var(--label-3) ": "; }
  .responsive-table td:nth-child(4)::before { content: var(--label-4) ": "; }
  .responsive-table td:nth-child(5)::before { content: var(--label-5) ": "; }
}

/* ---------- Адаптивність ---------- */
@media (max-width: 860px) {
  .pro-hero {
    grid-template-columns: 1fr;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }

  .payment-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .pro-shell {
    padding: 10px 12px 24px;
    gap: 20px;
  }

  .pro-hero,
  .payment-panel {
    padding: 16px;
  }

  .pro-hero-title {
    font-size: 22px;
  }

  .guest-banner {
    flex-direction: column;
    align-items: stretch;
  }
}
