/* ===========================================================================
   Alien Options — storefront styles. Tokens are declared on shared selectors
   so they reach the V2 panel after it moves into the back face. We only style
   our own `.alien-options__*` / `.ao-*` classes, never the V1 (Bold) markup.
   ========================================================================== */
.alien-options,
.ao-flip {
  --ao-accent: #15a012;
  --ao-accent-d: #0c7a0f;
  --ao-accent-soft: #ecfbea;
  --ao-accent-ring: rgba(21, 160, 18, 0.18);
  --ao-teal: #0bd1a7;
  --ao-border: #dce0e4;
  --ao-border-strong: #c4c9ce;
  --ao-soft: #f7f8f9;
  --ao-text: #1f2430;
  --ao-muted: #6b7280;
  --ao-radius: 12px;
}
.alien-options {
  margin: 1rem 0;
}

/* ── Tabs (alternative to the button) ───────────────────────────────────── */
.alien-options__tabs {
  display: inline-flex;
  margin-bottom: 1rem;
  padding: 4px;
  background: var(--ao-soft);
  border: 1px solid var(--ao-border);
  border-radius: 999px;
}
.alien-options__tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.5rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--ao-muted);
  border-radius: 999px;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.alien-options__tab.is-active {
  background: #fff;
  color: var(--ao-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ── Fields ─────────────────────────────────────────────────────────────── */
.alien-options__fields {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  color: var(--ao-text);
  font-family: inherit;
}
.alien-options__field[hidden] {
  display: none;
}
.alien-options__label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
  color: var(--ao-text);
}
.alien-options__label.is-required::after {
  content: " *";
  color: #e0322d;
}
.alien-options__help {
  font-size: 0.82rem;
  color: var(--ao-muted);
  margin-top: 0.35rem;
  line-height: 1.4;
}
.alien-options__heading {
  margin: 0.75rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--ao-border);
}
.alien-options__input {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--ao-border-strong);
  border-radius: var(--ao-radius);
  font: inherit;
  color: var(--ao-text);
  background: #fff;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.alien-options__input::placeholder {
  color: #9aa1a9;
}
.alien-options__input:hover {
  border-color: var(--ao-accent);
}
.alien-options__input:focus {
  outline: none;
  border-color: var(--ao-accent);
  box-shadow: 0 0 0 3px var(--ao-accent-ring);
}
textarea.alien-options__input {
  resize: vertical;
  min-height: 96px;
}
select.alien-options__input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
}
.alien-options__choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.alien-options__choice {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.alien-options__choice:hover {
  border-color: var(--ao-accent);
}
.alien-options__choice input {
  accent-color: var(--ao-accent);
  width: 18px;
  height: 18px;
  margin: 0;
  flex: none;
}
.alien-options__choice:has(input:checked) {
  border-color: var(--ao-accent);
  background: var(--ao-accent-soft);
  box-shadow: inset 0 0 0 1px var(--ao-accent);
  font-weight: 600;
}
.alien-options__swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.alien-options__swatch {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  border: 1px solid var(--ao-border-strong);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s, box-shadow 0.12s;
}
.alien-options__swatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}
.alien-options__swatch.is-selected {
  outline: 2px solid var(--ao-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--ao-accent-ring);
}
.alien-options__dropzone {
  border: 2px dashed var(--ao-border-strong);
  border-radius: 14px;
  padding: 1.6rem 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--ao-soft);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.alien-options__dropzone:hover {
  border-color: var(--ao-accent);
}
.alien-options__dropzone.is-dragover {
  border-color: var(--ao-accent);
  background: var(--ao-accent-soft);
  transform: scale(1.01);
}
.alien-options__drop-hint {
  color: var(--ao-muted);
  font-size: 0.92rem;
}
.alien-options__files {
  margin-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.alien-options__file {
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--ao-border);
}
.alien-options__file.is-done {
  color: var(--ao-accent-d);
  border-color: var(--ao-accent);
  background: var(--ao-accent-soft);
}
.alien-options__file.is-error {
  color: #c0271f;
  border-color: #f0bdbb;
  background: #fdeceb;
}
.alien-options__file.is-uploading {
  color: var(--ao-muted);
}
.alien-options__error {
  color: #e0322d;
  font-size: 0.82rem;
  margin-top: 0.3rem;
  min-height: 1em;
}
.alien-options__viewer {
  width: 100%;
  height: 240px;
  margin-top: 0.5rem;
  border: 1px solid var(--ao-border);
  border-radius: 12px;
  overflow: hidden;
  background: #f4f6f7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ao-muted);
  font-size: 0.85rem;
  cursor: grab;
}
.alien-options__viewer:active {
  cursor: grabbing;
}
.alien-options__viewer canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.alien-options__price {
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--ao-accent-d);
}
.alien-options__price:not(:empty) {
  padding: 0.5rem 0.85rem;
  background: var(--ao-accent-soft);
  border: 1px solid var(--ao-accent);
  border-radius: 999px;
}

/* ── Layout grid (V2) ───────────────────────────────────────────────────── */
.ao-row {
  display: grid;
  grid-template-columns: var(--ao-cols, 1fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.15rem;
}
.ao-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.ao-grid-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.12);
}
@media (max-width: 600px) {
  .ao-row {
    grid-template-columns: 1fr;
  }
}

/* ── Smart auto layout (default) ────────────────────────────────────────── */
.ao-auto {
  display: flex;
  gap: 1.6rem;
  align-items: flex-start;
}
.ao-auto__form {
  flex: 1 1 auto;
  min-width: 0;
}
.ao-summary {
  flex: 0 0 250px;
  position: sticky;
  top: 1rem;
  background: var(--ao-soft);
  border: 1px solid var(--ao-border);
  border-radius: 14px;
  padding: 1rem;
  box-sizing: border-box;
}
.ao-summary__img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  background: #fff;
}
.ao-summary__title {
  margin-top: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--ao-text);
}
.ao-summary__price {
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  color: var(--ao-accent-d);
}
.ao-summary__price:not(:empty) {
  padding: 0.4rem 0.75rem;
  background: var(--ao-accent-soft);
  border: 1px solid var(--ao-accent);
  border-radius: 999px;
}
.ao-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.ao-cell--full {
  grid-column: 1 / -1;
}
@media (max-width: 780px) {
  .ao-auto {
    flex-direction: column;
  }
  .ao-summary {
    position: static;
    flex-basis: auto;
    width: 100%;
    display: flex;
    gap: 1rem;
    align-items: center;
  }
  .ao-summary__img {
    width: 84px;
    flex: none;
  }
  .ao-summary__title,
  .ao-summary__price {
    margin-top: 0;
  }
  .ao-grid {
    grid-template-columns: 1fr;
  }
}

/* ── V1 → V2 robotic fold transition ───────────────────────────────────── */
.ao-flip {
  position: relative;
  width: 100%;
}
.ao-flip__inner {
  position: relative;
  width: 100%;
  transform-origin: top right;
  will-change: transform, filter;
}
.ao-face {
  width: 100%;
}
.ao-face--back {
  display: none;
}
.ao-flip__inner.ao-folding {
  animation: ao-fold 0.54s cubic-bezier(0.7, 0, 0.2, 1) forwards;
}
.ao-flip__inner.ao-unfolding {
  animation: ao-unfold 0.72s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes ao-fold {
  0% {
    transform: scaleX(1) scaleY(1) skewX(0);
    filter: brightness(1) drop-shadow(0 0 0 rgba(11, 209, 167, 0));
  }
  30% {
    transform: scaleX(0.52) scaleY(1) skewX(-2deg);
    filter: brightness(1.12) drop-shadow(0 0 10px rgba(11, 209, 167, 0.5));
  }
  55% {
    transform: scaleX(0.08) scaleY(1) skewX(2deg);
    filter: brightness(1.25) drop-shadow(0 0 14px rgba(11, 209, 167, 0.7));
  }
  78% {
    transform: scaleX(0.08) scaleY(0.34) skewX(-3deg);
    filter: brightness(1.4) drop-shadow(0 0 16px rgba(20, 255, 160, 0.8));
  }
  100% {
    transform: scaleX(0.05) scaleY(0.04) skewX(0);
    filter: brightness(1.7) drop-shadow(0 0 22px rgba(20, 255, 160, 0.95));
  }
}
@keyframes ao-unfold {
  0% {
    transform: scaleX(0.05) scaleY(0.04);
    filter: brightness(1.7) drop-shadow(0 0 22px rgba(20, 255, 160, 0.9));
  }
  28% {
    transform: scaleX(0.5) scaleY(0.18);
    filter: brightness(1.35) drop-shadow(0 0 14px rgba(11, 209, 167, 0.6));
  }
  55% {
    transform: scaleX(1) scaleY(0.55) skewX(1.5deg);
    filter: brightness(1.15) drop-shadow(0 0 8px rgba(11, 209, 167, 0.4));
  }
  80% {
    transform: scaleX(1) scaleY(1.04);
    filter: brightness(1.05);
  }
  100% {
    transform: scaleX(1) scaleY(1);
    filter: brightness(1) drop-shadow(0 0 0 rgba(11, 209, 167, 0));
  }
}

/* V2 panel card */
.ao-back-inner {
  position: relative;
  background: #fff;
  border: 1px solid var(--ao-border-strong);
  border-radius: 16px;
  padding: 1.6rem;
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.09);
  overflow: hidden;
}
.ao-back-inner::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--ao-accent), var(--ao-teal));
}
.ao-thumb {
  display: block;
  width: 92px;
  height: auto;
  border-radius: 10px;
  margin: 0 0 1.1rem;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}

/* Toggle buttons (V1 header + V2 back) */
.ao-toggle-btn {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid rgba(95, 240, 208, 0.85);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #aaffe9;
  background: linear-gradient(180deg, #0e1626 0%, #0a0f18 100%);
  text-shadow: 0 0 8px rgba(95, 240, 208, 0.5);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45), 0 0 12px rgba(11, 209, 167, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 0.12s ease, box-shadow 0.2s ease, color 0.2s ease;
  animation: ao-btn-pulse 2.8s ease-in-out infinite;
}
.ao-toggle-btn:hover {
  transform: translateY(-1px);
  color: #eafff8;
  border-color: #aaffe9;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.5), 0 0 20px rgba(11, 209, 167, 0.75);
}
.ao-toggle-btn:active {
  transform: translateY(0);
}
.ao-toggle-btn:focus-visible {
  outline: 2px solid #5ff0d0;
  outline-offset: 2px;
}
.ao-toggle-btn--back {
  top: 14px;
  right: 14px;
}
.ao-toggle-btn__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5ff0d0;
  box-shadow: 0 0 8px #5ff0d0;
  animation: ao-dot 1.4s ease-in-out infinite;
}
@keyframes ao-btn-pulse {
  0%,
  100% {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45), 0 0 10px rgba(11, 209, 167, 0.4),
      inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
  50% {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45), 0 0 20px rgba(11, 209, 167, 0.85),
      inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
}
@keyframes ao-dot {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.6;
  }
}

/* Image fade / column reflow when V2 is shown */
.ao-col-expanded {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100% !important;
  transition: width 0.45s ease, max-width 0.45s ease;
}
.ao-col-hidden {
  display: none !important;
}
.ao-img-managed {
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.ao-img-collapsed {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .ao-toggle-btn,
  .ao-toggle-btn__dot {
    animation: none;
  }
}
