/* GalleryOS — In-app testing dock */

.gos-testing {
  position: fixed;
  z-index: 9400;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  font-family: var(--gos-font, 'Figtree', system-ui, sans-serif);
  pointer-events: none;
}

.gos-testing__dock,
.gos-testing__pill,
.gos-testing__panel,
.gos-testing__stop {
  pointer-events: auto;
}

.gos-testing__dock {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.gos-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gos-testing__pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gos-border, rgba(28, 28, 26, 0.12)) 80%, transparent);
  background: color-mix(in srgb, var(--gos-surface, #F8F9FC) 92%, #fff);
  color: var(--gos-text-primary, #1C1C1A);
  box-shadow:
    0 1px 2px rgba(28, 28, 26, 0.04),
    0 12px 28px -16px rgba(28, 28, 26, 0.35);
  cursor: pointer;
  transition:
    transform 220ms var(--gos-ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
    box-shadow 220ms ease;
}

.gos-testing__pill:hover {
  transform: translateY(-1px);
}

.gos-testing__pill:focus-visible,
.gos-testing__stop:focus-visible,
.gos-testing__icon-btn:focus-visible {
  outline: 2px solid var(--gos-accent, #1B4DFF);
  outline-offset: 2px;
}

.gos-testing__stop {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, #c2410c 28%, transparent);
  background: color-mix(in srgb, #c2410c 10%, #fff);
  color: #9a3412;
  font-weight: 650;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.gos-testing__stop:hover {
  background: color-mix(in srgb, #c2410c 16%, #fff);
  border-color: color-mix(in srgb, #c2410c 40%, transparent);
}

.gos-testing__stop--compact {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  justify-content: center;
  box-shadow:
    0 1px 2px rgba(28, 28, 26, 0.04),
    0 12px 28px -16px rgba(28, 28, 26, 0.35);
}

.dark .gos-testing__stop {
  background: color-mix(in srgb, #fb923c 14%, #1a1a1a);
  border-color: color-mix(in srgb, #fb923c 35%, transparent);
  color: #fdba74;
}

.gos-testing__head-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.gos-testing__pill-mark {
  font-family: var(--gos-auth-brand, 'Syne', system-ui, sans-serif);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gos-testing__pill-count {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--gos-accent, #1B4DFF);
  font-variant-numeric: tabular-nums;
}

.gos-testing__panel {
  width: min(380px, calc(100vw - 28px));
  max-height: min(72vh, 640px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--gos-border, rgba(28, 28, 26, 0.10));
  background:
    linear-gradient(165deg,
      color-mix(in srgb, var(--gos-accent, #1B4DFF) 5%, #fff) 0%,
      var(--gos-surface, #F8F9FC) 38%,
      #fff 100%);
  box-shadow:
    0 2px 8px rgba(28, 28, 26, 0.05),
    0 24px 48px -20px rgba(28, 28, 26, 0.28);
  padding: 0.95rem 1rem 1rem;
  animation: gos-testing-in 280ms var(--gos-ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}

@keyframes gos-testing-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dark .gos-testing__panel {
  background:
    linear-gradient(165deg,
      color-mix(in srgb, var(--gos-accent, #1B4DFF) 12%, #121212) 0%,
      #141414 45%,
      #101010 100%);
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .gos-testing__pill {
  background: rgba(20, 20, 20, 0.94);
  color: #f5f5f4;
  border-color: rgba(255, 255, 255, 0.12);
}

.dark .gos-testing__stop--compact {
  background: color-mix(in srgb, #fb923c 14%, #1a1a1a);
}

.gos-testing__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.gos-testing__eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gos-text-soft, rgba(28, 28, 26, 0.48));
}

.gos-testing__title {
  margin: 0;
  font-family: var(--gos-auth-brand, 'Syne', system-ui, sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--gos-text-primary, #1C1C1A);
}

.dark .gos-testing__title { color: #f5f5f4; }

.gos-testing__goal,
.gos-testing__why {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--gos-text-soft, rgba(28, 28, 26, 0.62));
}

.gos-testing__icon-btn,
.gos-testing__back {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
}

.gos-testing__back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0;
}

.gos-testing__progress {
  height: 3px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--gos-text-primary, #1C1C1A) 8%, transparent);
  margin: 0 0 0.85rem;
  overflow: hidden;
}

.gos-testing__progress i {
  display: block;
  height: 100%;
  background: var(--gos-accent, #1B4DFF);
  border-radius: inherit;
  transition: width 360ms var(--gos-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

.gos-testing__flows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.gos-testing__flow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  background: color-mix(in srgb, var(--gos-text-primary, #1C1C1A) 2.5%, transparent);
  cursor: pointer;
  color: inherit;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.gos-testing__flow:hover,
.gos-testing__flow.is-active {
  border-color: color-mix(in srgb, var(--gos-accent, #1B4DFF) 28%, transparent);
  background: color-mix(in srgb, var(--gos-accent, #1B4DFF) 6%, transparent);
}

.gos-testing__flow-idx {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gos-text-soft, rgba(28, 28, 26, 0.45));
}

.gos-testing__flow.is-sandbox .gos-testing__flow-meta {
  color: #9a3412;
}

.gos-testing__sandbox-pill {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: color-mix(in srgb, #c2410c 18%, transparent);
  color: #9a3412;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.05em;
}

.gos-testing__why--warn {
  color: #9a3412;
}

.gos-testing__group-label {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gos-text-soft, rgba(28, 28, 26, 0.45));
}

.gos-testing__section-title {
  margin: 0.15rem 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--gos-text-primary, #1C1C1A);
}

.gos-testing__checklist {
  margin-bottom: 0.65rem;
}

.gos-testing__all-checklists {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.gos-testing__flow-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
}

.gos-testing__flow-meta {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.74rem;
  color: var(--gos-text-soft, rgba(28, 28, 26, 0.5));
}

.gos-testing__flow-status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--gos-text-primary, #1C1C1A) 18%, transparent);
}

.gos-testing__flow-status.is-done {
  background: #1f9d63;
  animation: gos-testing-pulse 520ms var(--gos-ease-out, cubic-bezier(0.16, 1, 0.3, 1)) 1;
}

.gos-testing__flow-status.is-in_progress { background: var(--gos-accent, #1B4DFF); }
.gos-testing__flow-status.is-blocked { background: #c2410c; }
.gos-testing__flow-status.is-skipped { background: #a8a29e; }

@keyframes gos-testing-pulse {
  0% { transform: scale(0.6); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

.gos-testing__steps {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.gos-testing__step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  font-size: 0.88rem;
}

.gos-testing__step p {
  margin: 0.2rem 0 0;
  color: var(--gos-text-soft, rgba(28, 28, 26, 0.58));
  font-size: 0.82rem;
  line-height: 1.4;
}

.gos-testing__step-n {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--gos-accent, #1B4DFF) 12%, transparent);
  color: var(--gos-accent, #1B4DFF);
}

.gos-testing__success-hint {
  color: #1f9d63 !important;
}

.gos-testing__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.gos-testing__primary,
.gos-testing__secondary,
.gos-testing__ghost,
.gos-testing__danger {
  border-radius: 10px;
  font-weight: 650;
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.gos-testing__primary {
  background: var(--gos-accent, #1B4DFF);
  color: #fff;
}

.gos-testing__secondary {
  background: color-mix(in srgb, var(--gos-text-primary, #1C1C1A) 5%, transparent);
  border-color: var(--gos-border, rgba(28, 28, 26, 0.1));
  color: inherit;
}

.gos-testing__ghost {
  background: transparent;
  color: var(--gos-text-soft, rgba(28, 28, 26, 0.65));
}

.gos-testing__danger {
  background: color-mix(in srgb, #c2410c 10%, transparent);
  color: #c2410c;
  border-color: color-mix(in srgb, #c2410c 22%, transparent);
}

.gos-testing__foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--gos-border, rgba(28, 28, 26, 0.1)) 90%, transparent);
}

.gos-testing__foot-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.gos-testing__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0;
}

.gos-testing__chip {
  border-radius: 999px;
  border: 1px solid var(--gos-border, rgba(28, 28, 26, 0.12));
  background: transparent;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
}

.gos-testing__chip.is-on {
  border-color: color-mix(in srgb, var(--gos-accent, #1B4DFF) 40%, transparent);
  background: color-mix(in srgb, var(--gos-accent, #1B4DFF) 12%, transparent);
  color: var(--gos-accent, #1B4DFF);
}

.gos-testing__label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  margin-bottom: 0.75rem;
  color: var(--gos-text-soft, rgba(28, 28, 26, 0.55));
}

.gos-testing__label input,
.gos-testing__label textarea {
  border-radius: 10px;
  border: 1px solid var(--gos-border, rgba(28, 28, 26, 0.12));
  background: color-mix(in srgb, #fff 80%, transparent);
  color: var(--gos-text-primary, #1C1C1A);
  padding: 0.55rem 0.65rem;
  font: inherit;
  font-weight: 500;
}

.dark .gos-testing__label input,
.dark .gos-testing__label textarea {
  background: rgba(0, 0, 0, 0.35);
  color: #f5f5f4;
  border-color: rgba(255, 255, 255, 0.12);
}

.gos-testing__run-meta {
  margin: 0.75rem 0 0;
  font-size: 0.74rem;
  color: var(--gos-text-soft, rgba(28, 28, 26, 0.5));
}

.gos-testing__fixed {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: color-mix(in srgb, #1f9d63 10%, transparent);
  border: 1px solid color-mix(in srgb, #1f9d63 22%, transparent);
}

.gos-testing__fixed-title {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #1f9d63;
}

.gos-testing__fixed ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--gos-text-primary, #1C1C1A);
}

body.gos-testing-focus .gos-tips-root,
body.gos-testing-focus #gos-journey-panel {
  opacity: 0.35;
  pointer-events: none;
}

@media (max-width: 640px) {
  .gos-testing {
    right: 10px;
    bottom: 10px;
    left: 10px;
    align-items: stretch;
  }

  .gos-testing__dock {
    align-self: flex-end;
  }

  .gos-testing__head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .gos-testing__panel {
    width: 100%;
    max-height: 68vh;
  }
}
