.aves-tryon-modal,
.aves-tryon-modal * {
  box-sizing: border-box;
}

.aves-tryon-modal[hidden] {
  display: none;
}

.aves-tryon-modal {
  position: fixed;
  height: 100%;
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  top: 0;
  left: 0;
  z-index: 99999999999;
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.aves-tryon-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.68);
}

.aves-tryon-modal__dialog {
  position: relative;
  background: oklch(14% 0.005 285.823);
  padding: 15px;
  border: 1px solid;
  border-radius: 8px;
  border-color: color-mix(in oklab, oklch(96% 0.001 286.375) 20%, transparent);
  width: 80%;
  max-width: 550px;
  min-height: 25%;
  max-height: 85%;
  overflow-x: auto;
}

.aves-tryon-modal__close {
  display: flex;
  height: 25px;
  width: 25px;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 10px;
  right: 10px;
  color: #f2f2f2;
  border-radius: calc(infinity * 1px);
  background-color: transparent;
  transition: background-color 0.3s ease;
  border: none;
  padding: 0;
  cursor: pointer;
}
.aves-tryon-modal__close:hover {
  background-color: #f8f8f8;
  @supports (color: color-mix(in lab, red, red)) {
    background-color: color-mix(
      in oklab,
      oklch(98% 0 0deg) 10%,
      rgba(0, 0, 0, 0)
    );
  }
}

.aves-tryon-modal__title {
  margin: 0 36px 12px 0;
  font-size: 24px;
  line-height: 1.2;
}

.aves-tryon-modal__hint {
  margin: 0 0 16px;
  /*color: #475569;*/
}

.aves-tryon-modal__step-indicator {
  margin-bottom: 10px;
}

.aves-tryon-modal__result {
  aspect-ratio: 1/1;
  position: relative;
}
.aves-tryon-modal__dialog .aves-tryon-modal__result {
  max-width: 80%;
  margin: 0 auto;
}
.aves-tryon-modal__result img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.aves-tryon-modal__cache-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 20px;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2;
}
.aves-tryon-modal__file-preview {
  margin-bottom: 14px;
  border-radius: 16px;
  overflow: hidden;
  background: #f1f5f9;
  line-height: 0;
  aspect-ratio: 4/5;
  max-height: 500px;
  margin: 0 auto;
  margin-bottom: 15px;
}

.aves-tryon-modal__preview-img {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  display: block;
}

.aves-tryon-modal__quality-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.aves-tryon-modal__quality-badge.is-pass {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.aves-tryon-modal__quality-badge.is-fail {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.aves-tryon-modal__pick-another {
  cursor: pointer;
}

.aves-tryon-modal__pick-another input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.aves-tryon-modal__saved-selfie {
  margin-bottom: 18px;
}

.aves-tryon-modal__saved-selfie-image {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}

.aves-tryon-modal__picker {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 160px;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  cursor: pointer;
  padding: 20px;
  text-align: center;
}

.aves-tryon-modal__picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.aves-tryon-modal__progress {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.aves-tryon-modal__bar {
  display: block;
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, #4f46e5 0%, rgba(255, 119, 194) 100%);
}

.is-animated .aves-tryon-modal__bar {
  animation: aves-tryon-progress 1.2s linear infinite;
}

.aves-tryon-modal__errors {
  margin: 0 0 18px;
  padding-left: 18px;
  color: #b91c1c;
}

.aves-tryon-modal__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  justify-content: center;
  margin-top: 15px;
}

.aves-tryon-modal__primary,
.aves-tryon-modal__secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

.aves-tryon-modal__primary {
  background: #111827;
  color: #fff;
}

.aves-tryon-modal__secondary,
.aves-tryon-modal__back {
  display: block;
  background: #fff;
  color: #111827;
  border-color: #cbd5e1;
  border: none;
  font-size: 14px;
  line-height: 1.5555555556;
  background-color: transparent;
  color: oklch(96% 0.001 286.375deg);
  background-size: 200% auto;
  background-image: linear-gradient(
    102deg,
    oklch(58% 0.233 277.117deg) 0%,
    color-mix(in oklab, oklch(58% 0.233 277.117deg) 80%, black) 51%,
    oklch(58% 0.233 277.117deg) 100%
  );
  border-width: 1px;
  border-style: solid;
  border-color: oklch(58% 0.233 277.117deg);
  transition-property: background-position;
  transition-timing-function: ease-in-out;
  transition-duration: 0.4s;
  padding-inline: 20px;
  padding-block: 5px;
  /* padding-top: 5px;
  padding-bottom: 5px; */
  border-radius: 4px;
  text-decoration: none;
  min-height: initial;
}
.aves-tryon-modal__secondary:hover,
.aves-tryon-modal__back:hover {
  background-position: 99% center !important;
}

.aves-tryon-modal__btn--secondary:disabled {
  background-color: rgb(179, 175, 175);
  background-image: none;
  color: rgb(55, 52, 52);
  border-color: transparent;
  pointer-events: none;
}
.aves-tryon-modal__btn--secondary {
  background-image: linear-gradient(
    102deg,
    transparent 0%,
    color-mix(in oklab, oklch(58% 0.233 277.117deg) 80%, black) 50%,
    transparent 100%
  );
  background-size: 0% 100%;
  background-position: -100% center;
  background-repeat: no-repeat;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding-inline: 15px;
  height: 35px;
  color: #f8f8f8;
  user-select: none;
  background-color: color-mix(
    in oklab,
    oklch(98% 0 0deg) 10%,
    oklch(23.2% 0.006 285.95deg)
  );
  border: 2px solid
    color-mix(
      in oklab,
      color-mix(in oklab, oklch(98% 0 0deg) 10%, oklch(23.2% 0.006 285.95deg)),
      #000 5%
    );
  border-radius: 4px;
  font-weight: 500;
  text-decoration-line: none;
  cursor: pointer;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  text-align: center;
  vertical-align: middle;
  font-size: 1.6rem;
  line-height: 1.5;
  transition:
    background-position 0s,
    background-size 0s;
  @supports (color: color-mix(in lab, red, red)) {
    border-color: color-mix(
      in oklab,
      oklch(96% 0.001 286.375deg) 20%,
      transparent
    );
  }
}

.aves-tryon-modal__btn--secondary:hover {
  background-size: 200% auto;
  background-position: 100% center;
  color: #f8f8f8;
  transition:
    background-position 0.6s ease-in-out,
    background-size 0s,
    box-shadow 0.4s,
    border-color 0.4s,
    background-color 0.4s;
  background-color: #605dff1a;
  box-shadow: 0 4px 15px -2px #605dff;
  border-color: #605dff;
}

.aves-tryon-modal__image {
  width: 100%;
  display: block;
  border-radius: 8px;
  margin-bottom: 16px;
}

.aves-tryon-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.aves-tryon-modal__product-selection {
  display: grid;
  grid-auto-columns: 200px;
  grid-auto-flow: column;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;

  padding-inline: 16px;

  scrollbar-width: thin;
  scrollbar-color: oklch(23.2% 0.006 285.95) oklch(96% 0.001 286.375);

  @supports (color: color-mix(in oklab, black, white)) {
    scrollbar-color: oklch(23.2% 0.006 285.95)
      color-mix(in oklab, oklch(96% 0.001 286.375) 80%, transparent);
  }
}

/* ── Slider wrapper & arrow buttons ────────────────────────────────────────── */
.aves-tryon-modal__slider-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.aves-tryon-modal__slider-wrap .aves-tryon-modal__product-selection {
  flex: 1;
  min-width: 0;
}

.aves-tryon-modal__slider-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid oklch(80% 0.005 286);
  border-radius: 50%;
  background: #cccccc;
  color: oklch(30% 0.01 286);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s,
    opacity 0.15s;
  user-select: none;
  position: relative;
}
.aves-tryon-modal__slider-arrow.is-prev {
  top: -30px;
}
.aves-tryon-modal__slider-arrow.is-next {
  top: -30px;
}

.aves-tryon-modal__slider-arrow.is-prev svg {
  transform: scaleX(-1);
}
.aves-tryon-modal__slider-arrow:hover:not(:disabled) {
  background: oklch(93% 0.008 286);
}

.aves-tryon-modal__slider-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

@media (prefers-color-scheme: dark) {
  .aves-tryon-modal__slider-arrow {
    background: oklch(22% 0.006 286);
    border-color: oklch(40% 0.006 286);
    color: oklch(85% 0.005 286);
  }

  .aves-tryon-modal__slider-arrow:hover:not(:disabled) {
    background: oklch(28% 0.008 286);
  }
}

/* ── Selfie picker grid ─────────────────────────────────────────────────────── */
.aves-tryon-modal__selfie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, max-content));
  justify-content: center;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px 2px;
}

.aves-tryon-selfie-card {
  display: block;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 0.18s,
    transform 0.18s;
  max-width: 150px;
}

.aves-tryon-selfie-card:hover,
.aves-tryon-selfie-card:focus-visible {
  border-color: oklch(58% 0.233 277deg);
  transform: scale(1.03);
  outline: none;
}

.aves-tryon-selfie-card__img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
}

/* ── Guest-product demo note banner ─────────────────────────────────────────── */
.aves-tryon-modal__guest-hint {
  margin: 8px 0 12px;
  padding: 10px 14px;
  background: oklch(96% 0.015 250);
  border-left: 3px solid oklch(58% 0.233 277deg);
  border-radius: 4px;
  font-size: 12px;
  color: oklch(35% 0.02 270);
}

@media (prefers-color-scheme: dark) {
  .aves-tryon-modal__guest-hint {
    background: oklch(22% 0.02 270);
    color: oklch(80% 0.01 270);
  }
}

.aves-tryon-card {
  scroll-snap-align: start;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition:
    border-color 0.2s,
    transform 0.2s;
}

.aves-tryon-card.is-selected {
  border-color: oklch(58% 0.233 277.117deg);
  position: relative;
}

.aves-tryon-card.is-selected::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: oklch(58% 0.233 277.117deg)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3 3 7-7' stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}

@media (hover: hover) {
  .aves-tryon-card:hover {
    border-color: oklch(58% 0.233 277.117deg);
  }
  .aves-tryon-card:hover .aves-tryon-card__image {
    transform: scale(1.05);
  }
}

.aves-tryon-card__title {
  margin: 0;
  font-size: 14px;
  line-height: 1.5555555556;
  color: oklch(96% 0.001 286.375deg);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aves-tryon-card__image {
  width: 100%;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
  transition: transform 0.2s;
}

.aves-tryon-card__select {
  background: transparent;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
}

.aves-tryon-grid__loading {
  margin: 0;
  color: #475569;
}

@keyframes aves-tryon-progress {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(220%);
  }
}

@media (max-width: 480px) {
  .aves-tryon-modal__dialog {
    width: calc(100% - 24px);
    margin: 12px auto;
    padding: 20px;
    border-radius: 16px;
  }
}

/* ── Auth CTA (shown in RESULT state) ──────────────────────────────────────── */

.aves-tryon-modal__auth-cta {
  margin-top: 16px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-align: center;
}

.aves-tryon-modal__auth-cta-title {
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 4px;
  color: #111;
}

.aves-tryon-modal__auth-cta-sub {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 12px;
  line-height: 1.4;
}

.aves-tryon-modal__social-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.aves-tryon-modal__social-btns a,
.aves-tryon-modal__social-btns button {
  width: 100% !important;
  border-radius: 8px !important;
  font-size: 12px !important;
}

.aves-tryon-modal__auth-login-link {
  display: inline-block;
  font-size: 12px;
  color: #6b7280;
  text-decoration: underline;
  margin-top: 4px;
}
.aves-tryon-modal__auth-login-link:hover {
  color: #111;
}

/* Logged-in variant */
.aves-tryon-modal__auth-cta--logged {
  background: transparent;
  border: none;
  padding: 8px 0 0;
}
.aves-tryon-modal__cabinet-link {
  display: inline-block;
  font-size: 14px;
  color: oklch(96% 0.001 286.375);
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.3s;
}
.aves-tryon-modal__cabinet-link:hover {
  color: #605dff;
}

/* ── Inline mode (data-aves-tryon-inline) ── */
.aves-tryon-inline {
  display: block;
  width: 100%;
  height: 100%;
}

.aves-tryon-inline .aves-tryon-modal__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

/* ── Camera capture ──────────────────────────────────────────────────────── */
.aves-tryon-modal__upload-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.aves-tryon-modal__gallery-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-align: center;
}

.aves-tryon-modal__gallery-pick input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Fullscreen camera overlay — поверх всього, включно з модалкою */
.aves-tryon-modal__camera-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #000;
  display: flex;
  flex-direction: column;
}

.aves-tryon-modal__camera-fullscreen .aves-tryon-modal__camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Дзеркало — щоб selfie виглядало природно */
  transform: scaleX(-1);
}

.aves-tryon-modal__camera-fullscreen .aves-tryon-modal__camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.aves-tryon-modal__camera-fullscreen .aves-tryon-modal__camera-guide {
  width: 100%;
  height: 100%;
  display: block;
}

/* Панель керування внизу */
.aves-tryon-modal__camera-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 32px max(24px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 100%);
}

/* Кнопка відміни — зліва */
.aves-tryon-modal__camera-btn-cancel {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.15s;
}
.aves-tryon-modal__camera-btn-cancel svg {
  width: 22px;
  height: 22px;
}
.aves-tryon-modal__camera-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Кнопка шатера — по центру, великий білий круг */
.aves-tryon-modal__camera-btn-shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255, 255, 255, 0.6);
  outline: 2px solid rgba(255, 255, 255, 0.9);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    transform 0.1s,
    background 0.1s;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25);
}
.aves-tryon-modal__camera-btn-shutter:active {
  transform: scale(0.92);
  background: #e0e0e0;
}

/* Порожній placeholder щоб центрувати шатер */
.aves-tryon-modal__camera-btn-placeholder {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

/* Real-time quality hint in camera overlay */
.aves-tryon-modal__camera-hint {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  max-width: 88%;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transition:
    background 0.25s,
    opacity 0.25s;
  margin: 0;
}
.aves-tryon-modal__camera-hint:empty {
  opacity: 0;
}
.aves-tryon-modal__camera-hint[data-state="ok"] {
  background: rgba(34, 197, 94, 0.82);
}
.aves-tryon-modal__camera-hint[data-state="warn"] {
  background: rgba(239, 68, 68, 0.82);
}

.color-error {
  color: oklch(63% 0.237 25.331);
}

.aves-tryon-modal__rate-limit {
  font-size: 13px;
  margin: 0;
  text-align: center;
}
