/* gg_social popup for gg_theme (layout A, phone first). Loaded only when config_theme is gg_theme.
   Colours, radii and fonts come from gg_theme's critical.css tokens only: no colour literals here. */

.ggs-overlay {
  position: fixed;
  inset: 0;
  /* Above every floating widget a store may run (gg_ai_suite's chat bubble is 99998, its window 999999), so
     nothing covers the popup's buttons; the page behind is inert anyway while the popup is open. */
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--gt-ink) 55%, transparent);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.ggs-pop {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid var(--gt-line);
  border-radius: var(--gt-radius-xl);
  background: var(--gt-surface);
  color: var(--gt-text);
  font-family: var(--gt-font-text);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 18px 48px -12px color-mix(in srgb, var(--gt-ink) 40%, transparent);
}
.ggs-pop *, .ggs-pop *::before, .ggs-pop *::after { box-sizing: border-box; }
.ggs-pop[data-mode="page"] { box-shadow: none; margin-top: 32px; margin-bottom: 32px; }
.ggs-page { padding: 8px 0 24px; }

.ggs-pop [hidden] { display: none; }

.ggs-pop :focus-visible {
  outline: 2px solid var(--gt-link);
  outline-offset: 2px;
}

.ggs-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--gt-radius-m);
  background: transparent;
  color: var(--gt-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.ggs-close:hover { color: var(--gt-ink); background: var(--gt-well); }

.ggs-title {
  margin: 0 40px 4px 0;
  color: var(--gt-ink);
  font-family: var(--gt-font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}
.ggs-sub { margin: 0 0 16px; color: var(--gt-muted); font-size: 13px; }
.ggs-note { margin: 12px 0 0; color: var(--gt-muted); font-size: 12px; line-height: 1.4; }
/* admin-only (test) mode marker: admins only, small and out of the way */
.ggs-testmode { display: inline-block; margin: 0 0 8px; padding: 2px 8px; border: 1px dashed var(--gt-line); border-radius: var(--gt-radius-s); color: var(--gt-muted); background: var(--gt-well); font-size: 11px; line-height: 1.4; }

.ggs-label { display: block; margin: 0 0 6px; color: var(--gt-ink); font-size: 12px; font-weight: 600; }
.ggs-label__opt { color: var(--gt-muted); font-weight: 400; } /* «(необовʼязково)» next to the onboarding phone label (C6) */
.ggs-form .ggs-label + .ggs-input,
.ggs-form .ggs-label + .ggs-phone { margin-bottom: 12px; }

.ggs-input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--gt-line);
  border-radius: var(--gt-radius-m);
  background: var(--gt-surface);
  color: var(--gt-text);
  font-family: inherit;
  font-size: 16px; /* 16px stops iOS zooming into the field */
}
.ggs-input::placeholder { color: var(--gt-muted); opacity: 1; }
.ggs-input:focus { border-color: var(--gt-navy); }
.ggs-input[aria-invalid="true"] { border-color: var(--gt-sale); }

/* password field + its show/hide eye: a real <button>, 44x44 target inside the field's right edge */
.ggs-pass { position: relative; }
.ggs-form .ggs-label + .ggs-pass { margin-bottom: 12px; }
.ggs-pass .ggs-input { padding-right: 48px; }
.ggs-pop .ggs-eye {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--gt-radius-m);
  background: transparent;
  color: var(--gt-muted);
  line-height: 1;
  cursor: pointer;
}
.ggs-pop .ggs-eye[hidden] { display: none; }
.ggs-pop .ggs-eye:hover { color: var(--gt-ink); }
.ggs-pop .ggs-eye:focus-visible { outline-offset: -2px; }
.ggs-eye__i { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ggs-eye__slash { display: none; }
.ggs-eye[aria-pressed="true"] .ggs-eye__slash { display: inline; }

.ggs-phone {
  display: flex;
  align-items: stretch;
  min-height: 44px;
  border: 1px solid var(--gt-line);
  border-radius: var(--gt-radius-m);
  background: var(--gt-surface);
  overflow: hidden;
}
.ggs-phone:focus-within { border-color: var(--gt-navy); }
.ggs-prefix {
  display: flex;
  align-items: center;
  padding: 0 10px 0 12px;
  background: var(--gt-well);
  color: var(--gt-ink);
  font-size: 16px;
  font-weight: 600;
  border-right: 1px solid var(--gt-line);
}
.ggs-phone .ggs-input { border: 0; border-radius: 0; flex: 1 1 auto; min-width: 0; }
.ggs-phone .ggs-input:focus-visible { outline-offset: -2px; }

.ggs-input--full { width: 100%; max-width: none; }
.ggs-code,
.ggs-input--code {
  /* One real input drawn as six slots: a tabular monospace digit + .8ch spacing = a 1.8ch pitch; the background
     paints six 1.4ch underlines on that pitch (a 10.8ch tile, no repeat, so exactly six show); text-indent centres the
     digit (1ch wide) over each underline. Every length is in ch so it tracks whatever monospace face resolves. */
  box-sizing: content-box;
  display: block;
  width: 11ch;
  max-width: calc(100% - 2em);
  min-height: 52px;
  height: 52px;
  margin: 0 auto 14px;
  padding: 0 .6em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .8ch;
  text-indent: .2ch;
  text-align: left;
  font-variant-numeric: tabular-nums;
  --ggs-slot: var(--gt-muted);
  /* layer 1 = the six slots (content box only), layer 2 = the field's own fill (whole box) */
  background-color: transparent;
  background-image: repeating-linear-gradient(90deg, var(--ggs-slot) 0 1.4ch, transparent 1.4ch 1.8ch), linear-gradient(var(--gt-surface), var(--gt-surface));
  background-size: 10.8ch 3px, auto;
  background-repeat: no-repeat;
  background-position: 0 calc(100% - 9px), 0 0;
  background-origin: content-box, padding-box;
  background-clip: content-box, border-box;
}
.ggs-code:focus,
.ggs-input--code:focus { --ggs-slot: var(--gt-navy); }
.ggs-code[aria-invalid="true"] { --ggs-slot: var(--gt-sale); }

/* same metrics as the theme's .gt-btn (48 px, radius 10, weight 600): both sit side by side on the direct login page (C13) */
.ggs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.ggs-btn--primary { background: var(--gt-cta); color: var(--gt-on-cta); margin-top: 14px; }
.ggs-btn--primary:hover { background: var(--gt-cta-hover); }
.ggs-btn[disabled] { opacity: .6; cursor: default; }
.ggs-pop [aria-busy="true"] { cursor: progress; }
.ggs-pop .ggs-social [aria-busy="true"] { opacity: .6; pointer-events: none; }

/* the popup could not be fetched (C4): one line + a close button, same card */
.ggs-pop--fallback { text-align: center; }
.ggs-fallback__msg { margin: 8px 0 0; color: var(--gt-ink); font-size: 14px; font-weight: 600; }

/* session notices on the direct login/register page (popupPage) */
.ggs-msgs { margin: 0 40px 14px 0; }
.ggs-pop[data-mode="page"] .ggs-msgs { margin-right: 0; }
.ggs-msg {
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--gt-line);
  border-left: 4px solid var(--gt-navy);
  border-radius: var(--gt-radius-m);
  background: var(--gt-well);
  color: var(--gt-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.ggs-msg--error { border-left-color: var(--gt-sale); }
.ggs-msg a { color: var(--gt-link); text-decoration: underline; }
.ggs-msg--success { border-left-color: var(--gt-cta); }

.ggs-err { margin: 10px 0 0; color: var(--gt-sale); font-size: 13px; font-weight: 600; }
/* outcome that is not an error (approval pending, C9): a focusable status line */
.ggs-ok { margin: 10px 0 0; color: var(--gt-ink); font-size: 14px; font-weight: 600; outline-offset: 4px; }

.ggs-check { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 0; font-size: 13px; color: var(--gt-text); }
.ggs-check input { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; }
.ggs-check a { color: var(--gt-link); text-decoration: underline; }

.ggs-or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--gt-muted); font-size: 12px; }
.ggs-or::before, .ggs-or::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--gt-line); }

.ggs-social .ggs-prov { margin: 12px 0 0; }
.ggs-social .ggs-prov__divider { margin: 4px 0 12px; }

.ggs-links { margin: 12px 0 0; text-align: center; }
.ggs-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--gt-link);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.ggs-link:hover { text-decoration: underline; }
.ggs-sub .ggs-link { min-height: 0; padding: 0; }
.ggs-captcha-slot { margin-top: 12px; }

body.ggs-open { overflow: hidden; }

@media (max-width: 480px) {
  /* full-width bottom sheet with a 16px gutter */
  .ggs-overlay { align-items: flex-end; padding: 16px; }
  .ggs-pop { max-width: none; padding: 20px 18px; }
  .ggs-pop[data-mode="page"] { margin-top: 16px; margin-bottom: 16px; }
}

@media (prefers-reduced-motion: no-preference) {
  .ggs-overlay { animation: ggs-fade .15s ease-out; }
  @keyframes ggs-fade { from { opacity: 0; } to { opacity: 1; } }
}

/* ------------------------------------------------------------------------------------------------
   Task 10: provider buttons, onboarding / state pages and account-page prompts (gg_theme twins).
   Page classes (.ggs-card, .ggs-field, .ggs-cta, ...) are used by complete / pending / merge / emailconfirm
   and by the account prompts; the popup keeps its own .ggs-pop rules above.
   ------------------------------------------------------------------------------------------------ */

/* ---- provider buttons (buttons.twig) ---- */
.ggs-prov { margin: 20px 0; font-family: var(--gt-font-text); }
.ggs-prov__divider { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--gt-muted); font-size: 12px; }
.ggs-prov__divider::before, .ggs-prov__divider::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--gt-line); }
.ggs-prov__list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ggs-prov__list--icon { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
.ggs-prov__btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--gt-line);
  border-radius: var(--gt-radius-m);
  background: var(--gt-surface);
  color: var(--gt-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}
.ggs-prov__list--icon .ggs-prov__btn { justify-content: center; padding: 0; }
.ggs-prov__btn:hover { border-color: var(--gt-navy); background: var(--gt-well); color: var(--gt-ink); text-decoration: none; }
.ggs-prov__btn:focus-visible { outline: 2px solid var(--gt-link); outline-offset: 2px; }
.ggs-prov__icon { display: block; flex: 0 0 auto; }
.ggs-prov__label { flex: 1 1 auto; min-width: 0; }
@media (min-width: 640px) { .ggs-prov__list:not(.ggs-prov__list--icon) { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

/* ---- page shell + card ---- */
.ggs-page { color: var(--gt-text); font-family: var(--gt-font-text); font-size: 14px; line-height: 1.45; }
.ggs-page > .gt-container { padding-top: 16px; padding-bottom: 32px; }
.ggs-card {
  box-sizing: border-box;
  width: 100%;
  max-width: 480px;
  margin: 16px auto;
  padding: 22px 18px;
  border: 1px solid var(--gt-line);
  border-radius: var(--gt-radius-xl);
  background: var(--gt-surface);
  color: var(--gt-text);
}
.ggs-card *, .ggs-card *::before, .ggs-card *::after { box-sizing: border-box; }
.ggs-card :focus-visible, .ggs-ap :focus-visible { outline: 2px solid var(--gt-link); outline-offset: 2px; }
.ggs-card--state { text-align: center; }
.ggs-card__title { margin: 0 0 8px; color: var(--gt-ink); font-family: var(--gt-font-display); font-size: 22px; font-weight: 700; line-height: 1.25; }
.ggs-card__lead { margin: 0 0 16px; color: var(--gt-muted); font-size: 14px; }
.ggs-card__lead--strong { color: var(--gt-ink); }
.ggs-card__lead--small { margin: 16px 0 0; font-size: 12px; }
.ggs-card__who { margin: 0 0 16px; color: var(--gt-ink); }
.ggs-card__email {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: var(--gt-radius-m);
  background: var(--gt-well);
  color: var(--gt-ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.ggs-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--gt-well);
  color: var(--gt-navy);
}
.ggs-card__icon svg { display: block; }
.ggs-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 4px 10px;
  border: 1px solid var(--gt-line);
  border-radius: 999px;
  background: var(--gt-well);
  color: var(--gt-muted);
  font-size: 12px;
  font-weight: 600;
}
.ggs-alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--gt-sale);
  border-radius: var(--gt-radius-m);
  background: color-mix(in srgb, var(--gt-sale) 8%, var(--gt-surface));
  color: var(--gt-ink);
  font-size: 13px;
  font-weight: 600;
}

/* ---- form fields (shared by complete + prompts; .ggs-input / .ggs-label / .ggs-err come from the popup block) ---- */
.ggs-card .ggs-form, .ggs-card .ggs-form .ggs-field { text-align: left; }
.ggs-field { margin: 0 0 16px; }
.ggs-field .ggs-label { margin-bottom: 6px; }
.ggs-field .ggs-input + .ggs-err { margin-top: 6px; }
.ggs-field--error .ggs-input { border-color: var(--gt-sale); }
.ggs-input:focus-visible { outline: 2px solid var(--gt-link); outline-offset: 2px; }
.ggs-input--area { min-height: 96px; padding-top: 10px; padding-bottom: 10px; resize: vertical; }
select.ggs-input { appearance: auto; }
.ggs-req { color: var(--gt-sale); font-weight: 700; }
.ggs-field .ggs-check { display: flex; align-items: center; min-height: 44px; margin: 0; font-weight: 500; }
.ggs-field .ggs-check input { margin: 0; }

/* phone + send-code (otp.js wraps the field in intl-tel-input's .iti and rewrites the message element's class) */
.ggs-otp { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.ggs-otp .ggs-input, .ggs-otp .iti { flex: 1 1 100%; min-width: 0; }
.ggs-otp .iti { display: block; }
.ggs-otp .iti .ggs-input { width: 100%; }
.ggs-otp .ggs-ghost { flex: 1 1 100%; }
@media (min-width: 481px) { .ggs-otp .ggs-input, .ggs-otp .iti { flex: 1 1 0; } .ggs-otp .ggs-ghost { flex: 0 0 auto; } }
.ggs-page .gg-social-otp-msg { margin-top: 6px; font-size: 13px; line-height: 1.4; }
.ggs-page .gg-social-otp-msg.is-error { color: var(--gt-sale); font-weight: 600; }
.ggs-page .gg-social-otp-msg.is-ok { color: var(--gt-ink); font-weight: 600; }

/* ---- buttons ---- */
.ggs-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--gt-radius-l);
  background: var(--gt-cta);
  color: var(--gt-on-cta);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.ggs-cta:hover { background: var(--gt-cta-hover); }
.ggs-cta[disabled] { opacity: .6; cursor: default; }
.ggs-cta--inline { width: auto; flex: 0 0 auto; }
.ggs-ghost {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--gt-navy);
  border-radius: var(--gt-radius-l);
  background: transparent;
  color: var(--gt-navy);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.ggs-ghost:hover:not(:disabled) { background: var(--gt-navy); color: var(--gt-surface); }
.ggs-ghost:disabled { opacity: .55; cursor: not-allowed; }
.ggs-linkbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--gt-link);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ggs-linkbtn:hover { text-decoration: underline; }

/* ---- account-page prompts (account_prompts.twig, injected into the default account page) ---- */
.ggs-ap-wrap { margin: 0 0 16px; font-family: var(--gt-font-text); }
.ggs-ap[hidden] { display: none; }
.ggs-ap {
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--gt-line);
  border-left: 4px solid var(--gt-navy);
  border-radius: var(--gt-radius-m);
  background: var(--gt-well);
  color: var(--gt-text);
  font-size: 14px;
  line-height: 1.45;
}
.ggs-ap__title { display: block; margin: 0 0 4px; color: var(--gt-ink); font-size: 15px; }
.ggs-ap__lead { margin: 0 0 10px; color: var(--gt-muted); }
.ggs-ap__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin: 0 0 8px; }
.ggs-ap__row .ggs-input { flex: 1 1 200px; width: auto; max-width: 320px; }
.ggs-ap__row .ggs-input.ggs-code { flex: 0 0 auto; width: 11ch; margin: 0; }
.ggs-ap__row .ggs-cta { flex: 1 1 100%; }
@media (min-width: 481px) { .ggs-ap__row .ggs-cta { flex: 0 0 auto; } }
/* «Не зараз» (C3): a quiet link-button after the card's action */
.ggs-ap__actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.ggs-ap__later { min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--gt-muted); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.ggs-ap__later:hover { color: var(--gt-ink); text-decoration: underline; }
.ggs-ap__captcha { margin: 0 0 8px; }
.ggs-ap__captcha[hidden] { display: none; }
.ggs-ap__msg { margin-top: 6px; color: var(--gt-ink); font-size: 13px; font-weight: 600; }
.ggs-ap__msg:empty { display: none; }
.ggs-ap > .ggs-cta--inline { max-width: 100%; }

@media (min-width: 640px) { .ggs-card { padding: 28px; } }
@media (prefers-reduced-motion: no-preference) {
  .ggs-prov__btn, .ggs-cta, .ggs-ghost { transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
}

/* onboarding (complete.twig): the code field sits left, aligned with its label; the popup keeps it centred */
.ggs-field .ggs-input--code { margin: 0 0 14px; }
