/* /widgets — gallery + configurator. Extends marketing_home.css tokens (--m-*). */

.wgx-hero {
  padding-bottom: 20px;
}

.wgx-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.wgx-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--m-surface);
  border: 1px solid var(--m-line);
  font-size: 13px;
  font-weight: 600;
  color: var(--m-ink-soft);
}

.wgx-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--m-up);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15);
}

.wgx-builder {
  padding-top: 12px;
}

.wgx-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

/* Menu */
.wgx-menu {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wgx-menu__title {
  margin: 0 0 4px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--m-ink-soft);
}

.wgx-menu__item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 14px;
  text-align: left;
  font-family: inherit;
  background: var(--m-surface);
  border: 1px solid var(--m-line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, background 0.15s;
}

.wgx-menu__item:hover {
  border-color: var(--m-line-strong);
  transform: translateY(-1px);
}

.wgx-menu__item.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.25), 0 8px 24px rgba(37, 99, 235, 0.08);
}

.wgx-menu__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--m-bg-soft);
  color: var(--m-ink-soft);
}

.wgx-menu__item.is-active .wgx-menu__icon {
  background: var(--m-accent);
  color: #fff;
}

.wgx-menu__icon svg {
  width: 20px;
  height: 20px;
}

.wgx-menu__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.wgx-menu__text strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--m-ink);
}

.wgx-menu__text span {
  font-size: 13px;
  line-height: 1.45;
  color: var(--m-ink-soft);
}

.wgx-menu__tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--m-accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wgx-menu__foot {
  margin-top: 8px;
  padding: 14px;
  border-radius: 14px;
  background: var(--m-bg-soft);
  border: 1px dashed var(--m-line-strong);
  font-size: 13px;
  color: var(--m-ink-soft);
}

.wgx-menu__foot p {
  margin: 0 0 4px;
}

/* Main */
.wgx-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.wgx-stage-head {
  scroll-margin-top: 84px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.wgx-stage-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wgx-stage-lede {
  margin: 0;
  font-size: 0.95rem;
  color: var(--m-ink-soft);
  max-width: 60ch;
}

.wgx-open {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--m-accent-bright);
  white-space: nowrap;
}

.wgx-open:hover {
  text-decoration: underline;
}

.wgx-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 28px;
  border-radius: var(--m-radius);
  border: 1px solid var(--m-line);
  background-color: #f8fafc;
  background-image: radial-gradient(rgba(15, 23, 42, 0.12) 1px, transparent 1px);
  background-size: 18px 18px;
  transition: background-color 0.2s;
  overflow: auto;
}

.wgx-stage.is-dark {
  background-color: #1e293b;
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  border-color: #334155;
}

.wgx-preview {
  display: block;
  max-width: 100%;
  width: 360px;
  height: 480px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14);
  transition: width 0.2s ease, height 0.2s ease;
}

.wgx-stage.is-transparent .wgx-preview {
  box-shadow: none;
}

/* Controls */
.wgx-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 18px;
  background: var(--m-surface);
  border: 1px solid var(--m-line);
  border-radius: var(--m-radius);
}

.wgx-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.wgx-control[hidden],
.wgx-toggle[hidden] {
  display: none;
}

.wgx-control--toggles {
  grid-column: 1 / -1;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px 22px;
  padding-top: 4px;
  border-top: 1px solid var(--m-line);
}

.wgx-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.wgx-label small {
  font-weight: 500;
  color: var(--m-ink-soft);
  font-size: 12px;
}

.wgx-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 42px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--m-ink);
  background: #f8fafc;
  border: 1px solid var(--m-line-strong);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}

.wgx-input:focus {
  border-color: var(--m-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #fff;
}

.wgx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wgx-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--m-line);
  background: var(--m-surface);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--m-ink-soft);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.wgx-chip:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: var(--m-accent);
}

.wgx-segment {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--m-bg-soft);
  border: 1px solid var(--m-line);
  width: fit-content;
}

.wgx-segment__btn {
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--m-ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.wgx-segment__btn.is-active {
  background: var(--m-ink);
  color: #fff;
}

.wgx-color {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wgx-color input[type='color'] {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--m-line-strong);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.wgx-color input[type='color']::-webkit-color-swatch-wrapper {
  padding: 4px;
}

.wgx-color input[type='color']::-webkit-color-swatch {
  border: 0;
  border-radius: 7px;
}

.wgx-color__hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--m-ink-soft);
}

.wgx-color__reset {
  margin-left: auto;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--m-accent-bright);
  cursor: pointer;
}

.wgx-color__reset:hover {
  text-decoration: underline;
}

.wgx-size {
  display: flex;
  gap: 8px;
}

.wgx-size__full {
  flex-shrink: 0;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--m-line-strong);
  background: var(--m-surface);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--m-ink-soft);
  cursor: pointer;
}

.wgx-size__full:hover {
  border-color: #93c5fd;
  color: var(--m-accent);
}

.wgx-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.wgx-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--m-accent);
}

/* Code */
.wgx-code {
  background: #0f1629;
  border-radius: var(--m-radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.wgx-code__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wgx-code__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.wgx-copy {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.wgx-copy:hover {
  background: rgba(255, 255, 255, 0.12);
}

.wgx-copy.is-done {
  background: var(--m-up);
  border-color: var(--m-up);
}

.wgx-code__pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre;
}

.wgx-code__note {
  margin: 0;
  padding: 10px 16px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.wgx-code__note code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Responsive */
@media (max-width: 980px) {
  .wgx-layout {
    grid-template-columns: 1fr;
  }

  .wgx-menu {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wgx-menu__title,
  .wgx-menu__foot {
    grid-column: 1 / -1;
  }

  .wgx-stage {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .wgx-menu {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .wgx-menu__item {
    padding: 12px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .wgx-menu__icon {
    width: 34px;
    height: 34px;
  }

  .wgx-menu__text span {
    display: none;
  }

  .wgx-hero__badges {
    gap: 6px;
  }

  .wgx-badge {
    padding: 5px 10px;
    font-size: 12px;
  }

  .wgx-controls {
    padding: 14px;
  }

  .wgx-code__pre {
    font-size: 11.5px;
  }

  .wgx-controls {
    grid-template-columns: 1fr;
  }

  .wgx-stage-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .wgx-preview {
    width: 100% !important;
  }
}
