.thh-gc-root {
  --thh-gc-bg: #ffffff;
  --thh-gc-text: #334155;
  --thh-gc-heading: #0f172a;
  --thh-gc-muted: #64748b;
  --thh-gc-border: #e2e8f0;
  --thh-gc-border-input: #d1d5db;
  --thh-gc-focus: #2563eb;
  --thh-gc-ring: rgba(57, 120, 201, 0.08);
  --thh-gc-primary: linear-gradient(105deg, #008ac8, #2460ed);
  --thh-gc-soft: #f4f7ff;
  --thh-gc-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);

  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1040px;
  width: 100%;
  margin: 32px auto;
  background: var(--thh-gc-bg);
  border: 1px solid var(--thh-gc-border);
  border-radius: 24px;
  box-shadow: var(--thh-gc-shadow);
  color: var(--thh-gc-text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  position: relative;
}
.thh-gc-root *, .thh-gc-root *::before, .thh-gc-root *::after { box-sizing: border-box; }
.thh-gc-root [hidden] { display: none !important; }

/* Theme reset & Flatsome normalization */
.thh-gc-root button, .thh-gc-root input, .thh-gc-root a {
  margin: 0; text-transform: none; letter-spacing: normal; line-height: normal; font-family: inherit; font-size: 15px;
}
.thh-gc-root button { cursor: pointer; border: none; background: none; box-shadow: none; padding: 0; min-height: initial; }
.thh-gc-root button:focus-visible, .thh-gc-root a:focus-visible { outline: 2px solid var(--thh-gc-focus); outline-offset: 2px; }

/* Left column (Form) */
.thh-gc-root .thh-gc-col-form {
  background: #ffffff; padding: 40px; border-radius: 24px 0 0 24px;
  border-right: 1px solid var(--thh-gc-border); display: flex; flex-direction: column; position: relative; z-index: 10;
}

/* Language switch for the entire widget */
.thh-gc-root .thh-gc-language {
  position: absolute; z-index: 11; inset-block-start: 28px; inset-inline-end: 34px;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px; border: 1px solid #dbe4f2; border-radius: 999px; background: var(--thh-gc-bg);
}
.thh-gc-root .thh-gc-language button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 32px; padding: 0 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--thh-gc-text); background: transparent;
  transition: color 150ms ease, background 150ms ease;
}
.thh-gc-root .thh-gc-language button[aria-pressed="true"] {
  background: var(--thh-gc-primary); color: #ffffff;
}
.thh-gc-root .thh-gc-language button[aria-pressed="false"]:hover { background: var(--thh-gc-soft); color: var(--thh-gc-heading); }
.thh-gc-root .thh-gc-language button:focus-visible {
  outline-offset: -2px;
}
.thh-gc-root .thh-gc-language button[aria-pressed="true"]:focus-visible { outline-color: #fff; }
.thh-gc-root .thh-gc-language:not([hidden]) ~ .thh-gc-col-form { padding-top: 56px; }

/* Typography */
.thh-gc-root .thh-gc-title { margin: 0 0 8px; font-size: 30px; line-height: 1.25; font-weight: 700; color: var(--thh-gc-heading); }
/* Both translations share a grid cell so the taller one sets the height. */
.thh-gc-root .thh-gc-lang-stack { display: grid; grid-template-columns: minmax(0, 1fr); overflow-wrap: anywhere; }
.thh-gc-root .thh-gc-lang-stack > span { grid-area: 1 / 1; }
.thh-gc-root[lang="vi"] .thh-gc-lang-stack > [lang="en"],
.thh-gc-root[lang="en"] .thh-gc-lang-stack > [lang="vi"] { visibility: hidden; }
.thh-gc-root[data-forced-lang="vi"][lang="vi"] .thh-gc-lang-stack > [lang="en"],
.thh-gc-root[data-forced-lang="en"][lang="en"] .thh-gc-lang-stack > [lang="vi"] { display: none; }
.thh-gc-root .thh-gc-subtitle { color: var(--thh-gc-muted); margin: 0 0 24px; font-size: 14px; line-height: 1.5; white-space: pre-line; }
.thh-gc-root .thh-gc-field { margin-bottom: 18px; min-width: 0; }
.thh-gc-root .thh-gc-label { display: block; font-size: 13px; font-weight: 500; color: #283548; margin-bottom: 7px; }

/* Form inputs & combobox trigger */
.thh-gc-root input.thh-gc-email,
.thh-gc-root input.thh-gc-pass,
.thh-gc-root button.thh-gc-combobox {
  width: 100%; min-width: 0; height: 48px; min-height: 48px; margin: 0; padding: 11px 13px;
  border: 1px solid var(--thh-gc-border-input); border-radius: 7px; background: #ffffff;
  color: var(--thh-gc-heading); box-shadow: none; line-height: 1.5; font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.thh-gc-root input.thh-gc-email::placeholder, .thh-gc-root input.thh-gc-pass::placeholder { color: #94a3b8; }
:is(body, #main) .thh-gc-root input.thh-gc-email:focus,
:is(body, #main) .thh-gc-root input.thh-gc-email:focus-visible,
:is(body, #main) .thh-gc-root input.thh-gc-pass:focus,
:is(body, #main) .thh-gc-root input.thh-gc-pass:focus-visible,
:is(body, #main) .thh-gc-root button.thh-gc-combobox:focus,
:is(body, #main) .thh-gc-root button.thh-gc-combobox:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  border: 1px solid #93b4df;
  box-shadow: 0 0 0 2px var(--thh-gc-ring);
}

/* Service picker & dropdown */
.thh-gc-root .thh-gc-service, .thh-gc-root .thh-gc-picker { position: relative; }
.thh-gc-root button.thh-gc-combobox { display: flex; align-items: center; gap: 10px; text-align: left; }
.thh-gc-root button.thh-gc-combobox:disabled { background: #f1f5f9; color: var(--thh-gc-muted); cursor: wait; }
.thh-gc-root .thh-gc-selected { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.thh-gc-root .thh-gc-dropdown-label { display: inline-flex; align-items: center; color: var(--thh-gc-muted); margin-left: auto; flex-shrink: 0; }
.thh-gc-root .thh-gc-dropdown-label svg { transition: transform 0.2s ease; }
.thh-gc-root button.thh-gc-combobox[aria-expanded="true"] .thh-gc-dropdown-label svg { transform: rotate(180deg); }
.thh-gc-root .thh-gc-selected-logo, .thh-gc-root .thh-gc-option-logo {
  width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; border-radius: 0; background: transparent;
}
.thh-gc-root .thh-gc-options {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 100;
  max-height: 280px; overflow-y: auto; list-style: none; margin: 0; padding: 6px;
  border: 1px solid var(--thh-gc-border-input); border-radius: 12px; background: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14); scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
}
.thh-gc-root .thh-gc-options::-webkit-scrollbar { width: 6px; }
.thh-gc-root .thh-gc-options::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.thh-gc-root .thh-gc-option {
  display: flex; align-items: center; gap: 10px; margin: 2px 0; padding: 8px 12px;
  border-radius: 8px; cursor: pointer; color: var(--thh-gc-text); font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}
.thh-gc-root .thh-gc-option span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thh-gc-root .thh-gc-option:hover, .thh-gc-root .thh-gc-option-active { background: #eff6ff; color: #1d4ed8; }
.thh-gc-root .thh-gc-option[aria-selected="true"] {
  background: #eff6ff; color: var(--thh-gc-focus); font-weight: 700;
}
.thh-gc-root .thh-gc-option[aria-selected="true"]::after {
  content: ""; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--thh-gc-focus); margin-left: auto; flex-shrink: 0;
}

/* Icon-only password visibility control */
.thh-gc-root .thh-gc-password-control { position: relative; }
.thh-gc-root .thh-gc-password-control input.thh-gc-pass { padding-right: 48px; }
.thh-gc-root button.thh-gc-toggle {
  position: absolute; right: 4px; top: 4px; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 4px; color: #5b6472;
}
.thh-gc-root button.thh-gc-toggle:not(:disabled):hover { background: #f3f4f6; color: #202b3c; }
.thh-gc-root .thh-gc-toggle svg { width: 16px; height: 16px; }
.thh-gc-root .thh-gc-eye-slash { display: none; }
.thh-gc-root .thh-gc-toggle[aria-pressed="true"] .thh-gc-eye-slash { display: block; }
.thh-gc-root input[aria-invalid="true"] { border-color: #c65b55; }

/* Submit button */
.thh-gc-root .thh-gc-submit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 48px; min-height: 48px; margin: 0; padding: 12px 24px;
  border: none; border-radius: 7px; background: var(--thh-gc-primary); color: #ffffff;
  font-weight: 600; font-size: 14px; text-align: center; box-shadow: 0 3px 8px rgba(37, 99, 235, 0.13);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.thh-gc-root .thh-gc-submit:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35); }
.thh-gc-root .thh-gc-submit:not(:disabled):active { transform: translateY(0); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25); }
.thh-gc-root .thh-gc-submit:disabled, .thh-gc-root button:disabled { cursor: not-allowed; }
.thh-gc-root .thh-gc-submit:disabled { background: #a3b3c9; box-shadow: none; transform: none; opacity: 1; }
.thh-gc-root .thh-gc-form[aria-busy="true"] .thh-gc-submit:disabled { cursor: wait; }
.thh-gc-root .thh-gc-form[aria-busy="true"] .thh-gc-submit {
  background: var(--thh-gc-primary); opacity: .75;
}
.thh-gc-root .thh-gc-form[aria-busy="true"] .thh-gc-submit::before {
  content: ""; width: 14px; height: 14px; border: 2px solid #ffffff65; border-top-color: #fff;
  border-radius: 50%; animation: thh-gc-spin .7s linear infinite;
}
.thh-gc-root .thh-gc-note { font-size: 13px; color: var(--thh-gc-muted); text-align: center; margin: 12px 0 0; line-height: 1.4; }

/* Status messages & Alerts */
.thh-gc-root .thh-gc-service-status { color: var(--thh-gc-muted); font-size: 13px; margin: 6px 0 0; }
.thh-gc-root .thh-gc-service-status:empty { display: none; }
.thh-gc-root .thh-gc-feedback { min-height: 34px; }
.thh-gc-root .thh-gc-error {
  display: flex; align-items: flex-start; gap: 7px; color: #b33e36; background: none; border: none;
  border-radius: 0; padding: 0; margin: -7px 0 12px; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere;
}
.thh-gc-root .thh-gc-error svg { flex-shrink: 0; margin-top: 2px; }
.thh-gc-root .thh-gc-retry-status { color: #b45309; font-size: 13px; margin: 0 0 14px; }
.thh-gc-root .thh-gc-retry { margin-top: 10px; }

/* Secondary / Chip buttons */
.thh-gc-root .thh-gc-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  background: #ffffff; color: #475569; border: 1px solid var(--thh-gc-border);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 600;
  min-height: 38px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); text-decoration: none;
  white-space: nowrap; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.thh-gc-root .thh-gc-secondary:not(:disabled):hover { background: #f8fafc; color: var(--thh-gc-heading); border-color: #cbd5e1; }
.thh-gc-root .thh-gc-secondary:not(:disabled):active { background: #f1f5f9; }

/* Right column (Result) */
.thh-gc-root .thh-gc-col-result {
  background: var(--thh-gc-soft); padding: 40px 34px; border-radius: 0 24px 24px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; z-index: 1;
}
.thh-gc-root .thh-gc-language:not([hidden]) ~ .thh-gc-col-result { padding-top: 80px; }
.thh-gc-root .thh-gc-illustration { display: flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.thh-gc-root .thh-gc-envelope-svg { width: 96px; height: 96px; max-width: 100%; }
.thh-gc-root .thh-gc-result-card {
  width: 100%; max-width: 410px; background: #ffffff; border: 1px solid var(--thh-gc-border);
  border-radius: 14px; padding: 20px; display: flex; overflow: hidden;
  flex-direction: column; justify-content: flex-start; min-height: 322px;
  box-shadow: 0 5px 18px rgba(26, 51, 85, 0.03);
}

/* Waiting placeholder */
.thh-gc-root .thh-gc-placeholder { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px 8px; }
.thh-gc-root .thh-gc-placeholder-icon {
  width: 56px; height: 56px; border-radius: 50%; background: #eff6ff; border: 2px solid #dbeafe;
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.thh-gc-root .thh-gc-placeholder-title { font-size: 18px; font-weight: 600; color: var(--thh-gc-heading); margin: 0 0 8px; line-height: 1.3; }
.thh-gc-root .thh-gc-placeholder-desc { font-size: 14px; color: var(--thh-gc-muted); margin: 0; }
.thh-gc-root .thh-gc-placeholder > .thh-gc-lang-stack { align-self: stretch; }

/* Result block */
.thh-gc-root .thh-gc-result { width: 100%; display: flex; flex-direction: column; flex: 1; min-height: 280px; }
.thh-gc-root .thh-gc-result-status {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 20px;
  background: #edf3ff; color: var(--thh-gc-focus); font-size: 10px; font-weight: 600; line-height: 14px;
}
.thh-gc-root .thh-gc-status-dot { width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.thh-gc-root .thh-gc-result-title {
  font-size: 20px; font-weight: 600; text-transform: none; letter-spacing: -.4px;
  color: var(--thh-gc-heading); margin: 10px 0 14px; line-height: 1.35;
}
.thh-gc-root .thh-gc-code-row {
  display: flex; align-items: center; justify-content: center; min-height: 68px;
  background: var(--thh-gc-soft); border: 1px solid var(--thh-gc-border); border-radius: 10px;
  padding: 14px 10px; margin-bottom: 12px;
}
.thh-gc-root .thh-gc-code {
  font-family: inherit; font-size: 30px; font-weight: 600; color: var(--thh-gc-heading); letter-spacing: 2px;
  margin: 0; min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-all;
  font-variant-numeric: tabular-nums; user-select: all; text-align: center; line-height: 1.2;
}
.thh-gc-root .thh-gc-digit { display: inline-block; min-width: .75em; letter-spacing: 0; }
.thh-gc-root .thh-gc-digit.thh-gc-digit-gap { margin-right: 10px; }
.thh-gc-root button.thh-gc-action, .thh-gc-root a.thh-gc-action {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 46px; min-height: 46px;
  padding: 12px 16px; margin: 0; border-radius: 7px; background: var(--thh-gc-primary);
  color: #ffffff; font-weight: 600; font-size: 14px; text-align: center; text-decoration: none;
  box-shadow: 0 3px 8px rgba(37, 99, 235, .13);
}
.thh-gc-root .thh-gc-action:not(:disabled):hover { filter: brightness(.97); color: #fff; }
.thh-gc-root .thh-gc-action:not([hidden]) + .thh-gc-action { margin-top: 10px; }
.thh-gc-root .thh-gc-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; padding-top: 12px; }
.thh-gc-root .thh-gc-metric { padding: 10px 12px; border: 1px solid var(--thh-gc-border); border-radius: 10px; background: var(--thh-gc-soft); }
.thh-gc-root .thh-gc-metric-label { display: block; font-size: 12px; color: var(--thh-gc-muted); margin-bottom: 3px; }
.thh-gc-root .thh-gc-expiry, .thh-gc-root .thh-gc-remaining { display: block; min-height: 24px; font-size: 20px; font-weight: 600; color: var(--thh-gc-heading); line-height: 1.2; font-variant-numeric: tabular-nums; }
.thh-gc-root .thh-gc-copy-status { color: #16a34a; font-size: 13px; font-weight: 500; margin: 8px 0 0; }
.thh-gc-root .thh-gc-copy-buffer { position: fixed; top: 0; left: -9999px; }
.thh-gc-root.thh-gc-expired .thh-gc-result-status { color: #a65d11; background: #fff4e7; }
.thh-gc-root.thh-gc-expired .thh-gc-expiry { color: #a65d11; }
.thh-gc-root.thh-gc-expired .thh-gc-copy-status { color: var(--thh-gc-muted); }
.thh-gc-root.thh-gc-loading .thh-gc-code-row { position: relative; }
.thh-gc-root.thh-gc-loading .thh-gc-code-row::after,
.thh-gc-root.thh-gc-loading .thh-gc-expiry::after,
.thh-gc-root.thh-gc-loading .thh-gc-remaining::after {
  content: ""; position: absolute; height: 14px; border-radius: 4px;
  background: linear-gradient(90deg, #e5eaf3, #f3f6fc, #e5eaf3); background-size: 200% 100%;
  animation: thh-gc-skeleton 1.1s linear infinite;
}
.thh-gc-root.thh-gc-loading .thh-gc-code-row::after { width: 58%; }
.thh-gc-root.thh-gc-loading .thh-gc-code { visibility: hidden; }
.thh-gc-root.thh-gc-loading .thh-gc-expiry,
.thh-gc-root.thh-gc-loading .thh-gc-remaining { position: relative; min-height: 24px; }
.thh-gc-root.thh-gc-loading .thh-gc-expiry::after,
.thh-gc-root.thh-gc-loading .thh-gc-remaining::after { left: 0; top: 5px; width: 45px; }
.thh-gc-root.thh-gc-loading .thh-gc-action { cursor: wait; }
.thh-gc-root.thh-gc-loading .thh-gc-action svg { display: none; }
.thh-gc-root.thh-gc-loading .thh-gc-action::before {
  content: ""; width: 14px; height: 14px; border: 2px solid #ffffff65; border-top-color: #fff;
  border-radius: 50%; animation: thh-gc-spin .7s linear infinite;
}
.thh-gc-root.thh-gc-loading .thh-gc-status-dot { animation: thh-gc-pulse 1s ease-in-out infinite; }
@keyframes thh-gc-spin { to { transform: rotate(360deg); } }
@keyframes thh-gc-skeleton { to { background-position: -200% 0; } }
@keyframes thh-gc-pulse { 50% { opacity: .35; } }

/* Responsive adjustments */
@media (max-width: 800px) {
  .thh-gc-root { grid-template-columns: 1fr; margin: 20px auto; border-radius: 20px; }
  .thh-gc-root .thh-gc-language { inset-block-start: 18px; inset-inline-end: 24px; }
  .thh-gc-root .thh-gc-language button { min-width: 44px; height: 44px; }
  .thh-gc-root .thh-gc-col-form { border-radius: 20px 20px 0 0; border-right: none; border-bottom: 1px solid var(--thh-gc-border); padding: 32px 24px; }
  .thh-gc-root .thh-gc-col-result { border-radius: 0 0 20px 20px; padding: 32px 24px; }
  .thh-gc-root .thh-gc-language:not([hidden]) ~ .thh-gc-col-form { padding-top: 82px; }
  .thh-gc-root .thh-gc-language:not([hidden]) ~ .thh-gc-col-result { padding-top: 32px; }
  .thh-gc-root .thh-gc-envelope-svg { width: 88px; height: 88px; }
  .thh-gc-root input.thh-gc-email, .thh-gc-root input.thh-gc-pass { font-size: 16px; }
}
@media (max-width: 480px) {
  .thh-gc-root { margin: 12px auto; border-radius: 16px; }
  .thh-gc-root .thh-gc-language { inset-block-start: 14px; inset-inline-end: 16px; }
  .thh-gc-root .thh-gc-col-form { padding: 24px 16px; border-radius: 16px 16px 0 0; }
  .thh-gc-root .thh-gc-col-result { padding: 24px 16px; border-radius: 0 0 16px 16px; }
  .thh-gc-root .thh-gc-language:not([hidden]) ~ .thh-gc-col-form { padding-top: 76px; }
  .thh-gc-root .thh-gc-language:not([hidden]) ~ .thh-gc-col-result { padding-top: 24px; }
  .thh-gc-root .thh-gc-title { font-size: 24px; }
  .thh-gc-root .thh-gc-result-card { padding: 18px; }
  .thh-gc-root .thh-gc-placeholder-title { font-size: 18px; }
  .thh-gc-root .thh-gc-code-row { padding: 14px 10px; }
  .thh-gc-root .thh-gc-copy { width: 100%; }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .thh-gc-root *, .thh-gc-root *::before, .thh-gc-root *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
