/* ==========================================================================
   WorkLab — payment widget (.pay-scope)
   Generated at runtime by payment.js. Fully scoped under .pay-scope and
   themed via the global design tokens (globals.css) so light/dark applies
   to the payment step too. Class names are preserved for payment.js.
   ========================================================================== */

.pay-scope {
  /* Local aliases mapped onto the global token system.
     Names that collide with global tokens (--primary, --primary-hover,
     --border, --danger, --text-muted, --radius-lg, --radius-md) are NOT
     redefined here so they inherit directly and avoid self-reference cycles. */
  --blue: var(--primary);
  --bg-page: var(--bg);
  --bg-card: var(--surface);
  --text-main: var(--text);
  --input-bg: var(--surface-2);
  --shadow: var(--shadow-md);
  --shadow-hover: var(--shadow-lg);
  --green: var(--success);

  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.pay-scope * { box-sizing: border-box; }

/* === Header (inside the payment scope) === */
.pay-scope .header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.pay-scope .headerInner {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pay-scope .logoLink {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}

.pay-scope .logoImg {
  display: block;
  height: 36px;
  width: auto;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 8px;
}

.pay-scope .logoLink span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-main);
}

.pay-scope .phone {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* === Layout === */
.pay-scope .main {
  flex: 1;
  padding: 24px 0 120px;
}

.pay-scope .container {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.pay-scope .mainCol {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* === Cards === */
.pay-scope .card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.pay-scope .orderMobileCard { display: none; }

.pay-scope .cardTitle {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.25;
  color: var(--text-main);
}

.pay-scope .vpnNotice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  border: 1px solid transparent;
  color: var(--warning);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
}

.pay-scope .vpnNotice strong { font-weight: 800; }

.pay-scope .subTitle {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 20px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pay-scope .subTitle:first-of-type { margin-top: 4px; }

/* === T-Bank widget === */
.pay-scope .tbankWidgetWrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 48px;
}

.pay-scope .tbankWidgetWrap[data-disabled='true'] {
  opacity: 0.55;
  pointer-events: none;
}

.pay-scope .tbankWidgetHint { margin: 0; font-size: 14px; color: var(--text-muted); }
.pay-scope .tbankWidgetMount { min-height: 44px; }
.pay-scope .tbankWidgetMount:empty { min-height: 0; }
.pay-scope .tbankWidgetSection { margin-top: 16px; }
.pay-scope .tbankWidgetInactive { display: none; }
.pay-scope .tbankWidgetPayHint {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-muted);
  text-align: center;
}

/* === Order summary === */
.pay-scope .orderInfo { display: flex; flex-direction: column; gap: 8px; }

.pay-scope .paymentDescription {
  margin: 0 0 24px;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 800;
  text-align: left;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.pay-scope .orderRow {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  gap: 12px;
  color: var(--text-muted);
}

.pay-scope .orderRow.discount { color: var(--danger); }

.pay-scope .orderRow.total {
  font-weight: 700;
  font-size: 20px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-main);
}

/* === Form fields === */
.pay-scope .formGroup { display: flex; flex-direction: column; gap: 6px; }

.pay-scope .formLabel {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.pay-scope .formControl {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--input-bg);
  font-size: 16px;
  outline: none;
  font: inherit;
  color: var(--text-main);
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.pay-scope .formControl::placeholder { color: var(--text-subtle); }

.pay-scope .formControl:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: var(--ring);
}

.pay-scope .formControl.invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.pay-scope .helpText { font-size: 13px; color: var(--text-muted); }

.pay-scope .errorText { font-size: 13px; color: var(--danger); font-weight: 600; }

.pay-scope .formBlocksError {
  font-size: 13px;
  color: var(--danger);
  font-weight: 600;
  margin: 0 0 8px;
}

/* === Consent checkboxes === */
.pay-scope .consents {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}

.pay-scope .consentsError {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.pay-scope .checkboxGroup {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: flex-start;
  column-gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.4;
}

.pay-scope .checkboxGroup input {
  margin: 3px 0 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.pay-scope .checkboxGroup a { color: var(--primary); text-decoration: none; }

.pay-scope .consentHighlight { animation: shake 0.4s ease; }

.pay-scope .consentHighlight .checkboxGroup input {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
  border-radius: 3px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* === Methods grid === */
.pay-scope .paymentGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.pay-scope .method {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .2s, box-shadow .2s, transform .2s, background .2s;
  position: relative;
  background: var(--bg-card);
  text-align: left;
  font: inherit;
  color: var(--text-main);
}

.pay-scope .methodRow {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.pay-scope .methodText {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.pay-scope .methodIcon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 2px;
}

.pay-scope .methodDisabled { opacity: 0.55; cursor: not-allowed !important; }

.pay-scope .methodTooltipWrap { position: relative; outline: none; }

.pay-scope .methodTooltipWrap[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  max-width: 240px;
  padding: 8px 12px;
  background: var(--text-main);
  color: var(--bg-card);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s ease, transform .12s ease, visibility .12s ease;
  z-index: 60;
  pointer-events: none;
  white-space: normal;
}

.pay-scope .methodTooltipWrap[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: var(--text-main);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s ease, visibility .12s ease;
  z-index: 61;
  pointer-events: none;
}

.pay-scope .methodTooltipWrap[data-tooltip]:focus-within::after,
.pay-scope .methodTooltipWrap[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.pay-scope .methodTooltipWrap[data-tooltip]:focus-within::before,
.pay-scope .methodTooltipWrap[data-tooltip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

.pay-scope .methodByRequest {
  position: absolute;
  top: -10px;
  right: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pay-scope .method input { position: absolute; opacity: 0; pointer-events: none; }

.pay-scope .method.selected {
  border-color: var(--primary);
  background-color: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary);
}

.pay-scope .methodTitle { font-weight: 700; font-size: 16px; line-height: 1.2; color: var(--text-main); }
.pay-scope .methodDesc { font-size: 13px; color: var(--text-muted); line-height: 1.35; }

.pay-scope .methodBadge {
  position: absolute;
  top: -10px;
  right: 10px;
  background: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--on-primary);
}

.pay-scope .partsGrid .method { background: var(--bg-card); border-color: var(--border); }

.pay-scope .methodSectionError { box-shadow: var(--shadow), 0 0 0 1px var(--danger); }
.pay-scope .methodSectionError .errorText { display: block; margin-top: 10px; }

/* === Sidebar === */
.pay-scope .sidebar { position: sticky; top: 20px; display: flex; flex-direction: column; }

.pay-scope .sidebar .sidebarTotalRow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: 16px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-main);
}

.pay-scope .sidebar .sidebarTotalAmount { font-size: 28px; }

.pay-scope .btnPay {
  width: 100%;
  padding: 16px;
  border: none;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 18px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform .2s, background .2s, box-shadow .2s, opacity .2s;
  margin-top: 16px;
  box-shadow: 0 6px 18px var(--primary-soft);
  font: inherit;
  font-weight: 700;
  font-size: 18px;
}

.pay-scope .btnPay:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

.pay-scope .mobileBar { display: none; }

/* === Hover (fine pointers only) === */
@media (hover: hover) and (pointer: fine) {
  .pay-scope .checkboxGroup a:hover { text-decoration: underline; }

  .pay-scope .methodDisabled:hover {
    border-color: var(--border) !important;
    box-shadow: none !important;
    transform: none !important;
  }

  .pay-scope .methodTooltipWrap[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }

  .pay-scope .methodTooltipWrap[data-tooltip]:hover::before { opacity: 1; visibility: visible; }

  .pay-scope .method:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
  }

  .pay-scope .partsGrid .method:hover { border-color: var(--primary); }

  .pay-scope .btnPay:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px var(--primary-soft);
  }
}

@media (max-width: 860px) {
  .pay-scope .main { padding: 16px 0 136px; }

  .pay-scope .container { grid-template-columns: 1fr; gap: 14px; }

  .pay-scope .mainCol,
  .pay-scope .sidebar,
  .pay-scope .sidebarCard { display: contents; }

  .pay-scope .orderMobileCard { display: block; order: 1; }

  .pay-scope .checkoutFields {
    order: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow);
  }

  .pay-scope .methodsCard { order: 3; }
  .pay-scope .sidebarPay { order: 4; }
  .pay-scope .card { padding: 18px; }
  .pay-scope .cardTitle { margin-bottom: 12px; }
  .pay-scope .subTitle { margin: 16px 0 10px; }
  .pay-scope .paymentGrid { gap: 10px; }
  .pay-scope .method { padding: 14px; }
  .pay-scope .checkoutFields .consents { margin-top: 0; gap: 10px; padding: 10px; }
  .pay-scope .sidebarOrder { display: none; }
  .pay-scope .sidebarPay > .btnPay { display: none; }

  .pay-scope .tbankWidgetActive .sidebarCard {
    box-shadow: none;
    border: none;
    padding: 0;
    background: transparent;
  }

  .pay-scope .tbankWidgetActive .mobileBar { display: none; }

  .pay-scope .mobileBar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 100;
  }

  .pay-scope .mobileBarTopRow {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 14px;
    color: var(--text-muted);
  }

  .pay-scope .mobileBarAmount { font-size: 18px; font-weight: 700; color: var(--text-main); }

  .pay-scope .mobileBar .btnPay { margin-top: 0; padding: 16px; font-size: 17px; }
}

@media (max-width: 480px) {
  .pay-scope .headerInner { padding: 14px 16px; gap: 8px; }
  .pay-scope .logoImg { height: 30px; }
  .pay-scope .phone { font-size: 13px; }
  .pay-scope .card { padding: 14px; }
  .pay-scope .checkoutFields { padding: 14px; }
  .pay-scope .cardTitle { font-size: 18px; margin-bottom: 10px; }
  .pay-scope .subTitle { margin: 14px 0 8px; font-size: 13px; }
  .pay-scope .paymentGrid { gap: 8px; }
  .pay-scope .method { gap: 8px; padding: 12px; }
  .pay-scope .methodRow { gap: 10px; }
  .pay-scope .methodIcon { width: 32px; height: 32px; }
  .pay-scope .methodText { gap: 4px; }
  .pay-scope .consents { gap: 8px; }
  .pay-scope .checkboxGroup { font-size: 13px; }
}

/* === Status screens === */
.pay-scope .statusCard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  max-width: 520px;
  margin: 40px auto;
}

.pay-scope .statusIcon { width: 72px; height: 72px; }
.pay-scope .statusIcon.iconSuccess { color: var(--green); }
.pay-scope .statusIcon.iconError { color: var(--danger); }
.pay-scope .statusIcon.iconMuted { color: var(--text-subtle); }
.pay-scope .statusIcon.iconInfo { color: var(--primary); }

.pay-scope .statusTitle { font-size: 24px; font-weight: 700; margin: 0; line-height: 1.25; color: var(--text-main); }

.pay-scope .statusMessage {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  max-width: 360px;
}

.pay-scope .statusActions {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.pay-scope .statusLink {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px dashed var(--primary-soft);
  padding-bottom: 1px;
}

.pay-scope .statusLink:hover { border-bottom-style: solid; }

.pay-scope .purchaseLayout {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.pay-scope .purchaseCard {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pay-scope .purchaseTotal {
  margin-top: 4px;
}

.pay-scope .purchaseForm {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
