/* ============================================================
   ATG Jewelry - Virtual Try-On Viewer
   ============================================================ */

body.atg-tryon-lock {
  overflow: hidden !important;
}

.atg-tryon-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  color: #f8f4ea;
  font-family: inherit;
}

.atg-tryon-modal[hidden] {
  display: none !important;
}

.atg-tryon-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(201, 162, 39, 0.18), transparent 32%),
    rgba(7, 6, 4, 0.88);
  backdrop-filter: blur(10px);
}

.atg-tryon-dialog {
  position: relative;
  width: min(1180px, 96vw);
  height: min(760px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(201, 162, 39, 0.32);
  border-radius: 22px;
  background: #12100c;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
}

.atg-tryon-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(90deg, rgba(201, 162, 39, 0.12), transparent 48%);
}

.atg-tryon-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #d8b95e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.atg-tryon-header h3 {
  margin: 0;
  color: #fffaf0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.atg-tryon-close {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff7e5;
  font-size: 18px;
  cursor: pointer;
  transition: 0.2s ease;
}

.atg-tryon-close:hover {
  background: rgba(201, 162, 39, 0.2);
  border-color: rgba(201, 162, 39, 0.55);
  transform: rotate(90deg);
}

.atg-tryon-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 342px;
}

.atg-tryon-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, #28231a 0%, #0b0a08 68%);
}

.atg-tryon-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.14), transparent 22%, transparent 76%, rgba(0, 0, 0, 0.28));
}

.atg-tryon-stage-media {
  position: absolute;
  inset: 0;
  transform-origin: center;
}

.atg-tryon-stage-media.is-mirrored {
  transform: scaleX(-1);
}

.atg-tryon-stage video,
.atg-tryon-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.atg-tryon-stage video {
  object-fit: cover;
  background: #070604;
}

.atg-tryon-canvas {
  display: none;
  pointer-events: none;
}

.atg-tryon-canvas.is-active {
  display: block;
}

.atg-tryon-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  pointer-events: none;
}

.atg-tryon-start-panel {
  width: min(360px, 88%);
  padding: 28px 24px 24px;
  border: 1px solid rgba(201, 162, 39, 0.34);
  border-radius: 20px;
  background: rgba(13, 11, 8, 0.82);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.atg-tryon-start-panel[hidden] {
  display: none !important;
}

.atg-tryon-start-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(201, 162, 39, 0.42);
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.12);
  color: #dfc16b;
  font-size: 24px;
}

.atg-tryon-start-panel h4 {
  margin: 0 0 8px;
  color: #fff9ec;
  font-size: 20px;
}

.atg-tryon-start-panel p {
  margin: 0 auto 18px;
  max-width: 290px;
  color: rgba(255, 249, 236, 0.68);
  font-size: 13px;
  line-height: 1.65;
}

.atg-tryon-start-panel small {
  display: block;
  margin-top: 12px;
  color: rgba(255, 249, 236, 0.42);
  font-size: 11px;
}

.atg-tryon-loading {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(10, 9, 7, 0.82);
  color: #f6edd7;
  font-size: 12px;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.atg-tryon-loading[hidden] {
  display: none !important;
}

.atg-tryon-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #d8b95e;
  border-radius: 50%;
  animation: atg-tryon-spin 0.8s linear infinite;
}

@keyframes atg-tryon-spin {
  to { transform: rotate(360deg); }
}

.atg-tryon-message {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 36px));
  padding: 13px 16px;
  border: 1px solid rgba(255, 184, 92, 0.35);
  border-radius: 12px;
  background: rgba(23, 15, 7, 0.9);
  color: #ffe5bd;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.atg-tryon-message[hidden] {
  display: none !important;
}

.atg-tryon-message.is-error {
  border-color: rgba(255, 110, 110, 0.45);
  color: #ffd4d4;
}

.atg-tryon-tracking-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(10, 9, 7, 0.68);
  color: rgba(255, 249, 236, 0.74);
  font-size: 11px;
  backdrop-filter: blur(8px);
}

.atg-tryon-tracking-badge[hidden] {
  display: none !important;
}

.atg-tryon-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d8b95e;
  box-shadow: 0 0 0 4px rgba(216, 185, 94, 0.12);
}

.atg-tryon-tracking-badge.is-ready .atg-tryon-dot {
  background: #6fdc9b;
  box-shadow: 0 0 0 4px rgba(111, 220, 155, 0.12);
}

.atg-tryon-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: #17140f;
  overflow-y: auto;
}

.atg-tryon-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.atg-tryon-side-label {
  color: #f4ead2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.atg-tryon-count {
  color: rgba(255, 249, 236, 0.4);
  font-size: 11px;
}

.atg-tryon-items {
  display: grid;
  gap: 10px;
}

.atg-tryon-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: #f8f2e4;
  text-align: left;
  cursor: pointer;
  transition: 0.18s ease;
}

.atg-tryon-item:hover {
  border-color: rgba(201, 162, 39, 0.42);
  background: rgba(201, 162, 39, 0.08);
}

.atg-tryon-item.is-active {
  border-color: rgba(201, 162, 39, 0.75);
  background: rgba(201, 162, 39, 0.13);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.18);
}

.atg-tryon-item-thumb {
  width: 54px;
  height: 54px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d8b95e;
  font-size: 18px;
}

.atg-tryon-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.atg-tryon-item-name {
  display: block;
  overflow: hidden;
  color: #fbf4e4;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atg-tryon-item-meta {
  display: block;
  margin-top: 3px;
  color: rgba(255, 249, 236, 0.44);
  font-size: 10px;
  text-transform: capitalize;
}

.atg-tryon-item-check {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: transparent;
  font-size: 9px;
}

.atg-tryon-item.is-active .atg-tryon-item-check {
  border-color: #d8b95e;
  background: #d8b95e;
  color: #17140f;
}

.atg-tryon-empty {
  padding: 28px 12px;
  color: rgba(255, 249, 236, 0.5);
  text-align: center;
}

.atg-tryon-empty[hidden] {
  display: none !important;
}

.atg-tryon-empty i {
  display: block;
  margin-bottom: 10px;
  color: #d8b95e;
  font-size: 28px;
}

.atg-tryon-empty p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.atg-tryon-controls {
  display: grid;
  gap: 9px;
  margin-top: auto;
  padding-top: 20px;
}

.atg-tryon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: #f8f2e4;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.atg-tryon-btn:hover:not(:disabled) {
  border-color: rgba(201, 162, 39, 0.55);
  background: rgba(201, 162, 39, 0.12);
}

.atg-tryon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.atg-tryon-btn--primary {
  border-color: #d8b95e;
  background: #d8b95e;
  color: #18130b;
}

.atg-tryon-btn--primary:hover:not(:disabled) {
  background: #e6ca7d;
  border-color: #e6ca7d;
}

.atg-tryon-btn--gold {
  border-color: rgba(201, 162, 39, 0.55);
  background: rgba(201, 162, 39, 0.15);
  color: #f3db99;
}

.atg-tryon-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  color: rgba(255, 249, 236, 0.38);
  font-size: 10px;
  line-height: 1.55;
}

.atg-tryon-note i {
  margin-top: 2px;
  color: #a98d45;
}

/* .atg-tryon-open hanya hook JS pembuka modal; tampilannya mengikuti
   class rts-btn btn-primary seperti tombol Tambah ke Keranjang. */
.atg-tryon-open:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

/* Baris aksi sejajar (varian + try-on + qty + keranjang) pada detail produk try-on.
   tryon.css hanya dimuat saat tryon_eligible, jadi tidak memengaruhi produk lain.
   Tombol try-on memakai class rts-btn btn-primary (sama dgn Tambah ke Keranjang);
   .atg-tryon-open dipertahankan murni sebagai hook JS pembuka modal. */
.rts-product-details-section .details-product-area .detail-action-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.rts-product-details-section .details-product-area .detail-action-row .product-varian {
  flex: 0 1 auto;
  min-width: 190px;
  margin-bottom: 0 !important;
}

.rts-product-details-section .details-product-area .detail-action-row .product-varian label {
  margin-bottom: 6px !important;
  white-space: nowrap;
}

.rts-product-details-section .details-product-area .detail-action-row .product-varian .form-select,
.rts-product-details-section .details-product-area .detail-action-row .product-varian .nice-select {
  width: auto;
  max-width: 100%;
}

.rts-product-details-section .details-product-area .detail-action-row .rts-btn {
  white-space: nowrap;
  flex: 0 0 auto;
  padding: 0 14px;
  font-size: 14px;
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
}

.rts-product-details-section .details-product-area .detail-action-row .rts-btn .btn-text {
  display: inline-block;
  line-height: 1;
}

/* Tombol ikon + tooltip (keranjang & try-on): teks jadi tooltip saat hover */
.rts-product-details-section .details-product-area .detail-action-row .atg-icon-btn {
  position: relative;
  width: 44px;
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.rts-product-details-section .details-product-area .detail-action-row .atg-icon-btn .arrow-icon {
  margin: 0;
}

.rts-product-details-section .details-product-area .detail-action-row .atg-icon-btn .atg-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  background: #2c3b28;
  color: #fff;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.22s ease;
  pointer-events: none;
}

.rts-product-details-section .details-product-area .detail-action-row .atg-icon-btn .atg-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #2c3b28;
}

.rts-product-details-section .details-product-area .detail-action-row .atg-icon-btn:hover .atg-tip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.rts-product-details-section .details-product-area .detail-action-row .rts-btn .arrow-icon {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.rts-product-details-section .details-product-area .detail-action-row .cart-edits {
  margin-right: 0;
}

.rts-product-details-section .details-product-area .detail-action-row .cart-edits .quantity-edit {
  width: 150px;
  height: 44px;
  box-sizing: border-box;
  padding-left: 4px;
  padding-right: 4px;
  align-items: center;
}

.rts-product-details-section .details-product-area .detail-action-row .cart-edits .quantity-edit input {
  max-width: 70px;
}

/* Select2 varian: samakan tinggi 44px dgn tombol & qty */
.rts-product-details-section .details-product-area .detail-action-row .select2-container .select2-selection--single {
  height: 44px !important;
  box-sizing: border-box;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: #fff;
}

.rts-product-details-section .details-product-area .detail-action-row .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 42px;
  font-size: 14px;
  color: #000;
  padding-left: 12px;
  padding-right: 28px;
}

.rts-product-details-section .details-product-area .detail-action-row .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 42px;
  right: 6px;
}

@media (max-width: 600px) {
  .rts-product-details-section .details-product-area .detail-action-row > * {
    flex: 1 1 100%;
    max-width: none;
  }

  .rts-product-details-section .details-product-area .detail-action-row .product-varian .form-select,
  .rts-product-details-section .details-product-area .detail-action-row .product-varian .nice-select {
    width: 100%;
    max-width: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .atg-tryon-dialog {
    width: min(760px, 96vw);
    height: min(860px, 94vh);
  }

  .atg-tryon-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .atg-tryon-stage {
    min-height: 380px;
  }

  .atg-tryon-side {
    max-height: 42vh;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .atg-tryon-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .atg-tryon-controls .atg-tryon-btn {
    padding-inline: 8px;
    font-size: 11px;
  }
}

@media (max-width: 620px) {
  .atg-tryon-modal {
    padding: 0;
  }

  .atg-tryon-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: 0;
  }

  .atg-tryon-header {
    padding: 14px 16px;
  }

  .atg-tryon-header h3 {
    font-size: 18px;
  }

  .atg-tryon-stage {
    min-height: 46vh;
  }

  .atg-tryon-side {
    max-height: 46vh;
    padding: 15px;
  }

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

  .atg-tryon-controls .atg-tryon-btn--gold {
    grid-column: 1 / -1;
  }

  .atg-tryon-start-panel {
    padding: 20px 18px;
  }
}
