/* ============================================================
   Ring Size Guide — scoped styles for WooCommerce / Woodmart
   All modal styles scoped under .rsg-modal to avoid conflicts.
   ============================================================ */

/* ============================================================
   Trigger button
   ============================================================ */
.rsg-wrapper .ring-sizer__trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1.5;
  border: 2px solid #c1925a;
  background: transparent;
  color: black;
  border-radius: 0;
}

.rsg-wrapper .ring-sizer__trigger:active {
  opacity: 0.8;
}

.rsg-wrapper .ring-sizer__trigger:hover {
  background: #c1925a;
  color: white;
  font-weight: 700;
  border-color: #c1925a;
}

@media (hover: hover) {
  .rsg-wrapper .ring-sizer__trigger:hover {
    opacity: 0.9;
  }
}

.rsg-wrapper .ring-sizer__trigger-icon {
  flex-shrink: 0;
}

/* ============================================================
   Modal — scoped under .rsg-modal
   ============================================================ */
.rsg-modal {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100000;
  /* above Woodmart elements */
  /* Force GPU layer — fix pentru z-index pe Safari cand parintii au transform */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.rsg-modal.rsg-modal--open {
  display: block;
}

/* Overlay */
.rsg-modal .modal__overlay {
  position: absolute;
  inset: 0;
  background-color: hsla(0, 0%, 0%, 0.5);
  animation: rsg-fadeIn 250ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Panel — mobile drawer */
.rsg-modal .modal__panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  /* svh = small viewport height (exclude browser chrome iOS) */
  max-height: 90svh;
  max-height: 90vh;
  /* fallback pentru browsere mai vechi */
  background-color: #ffffff;
  border-radius: 1rem 1rem 0 0;
  box-shadow: 0 8px 40px hsla(0, 0%, 0%, 0.18);
  display: flex;
  flex-direction: column;
  animation: rsg-slideUp 350ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  overflow: hidden;
  /* Safari scroll fix */
  -webkit-overflow-scrolling: touch;
}

/* Panel — desktop dialog */
@media (min-width: 640px) {
  .rsg-modal .modal__panel {
    position: absolute;
    top: 50%;
    left: 50%;
    bottom: auto;
    right: auto;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 448px;
    max-height: 85vh;
    border-radius: 1rem;
    animation: rsg-scaleIn 250ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }
}

/* Header */
.rsg-modal .modal__header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 16px 0;
  flex-shrink: 0;
  position: relative;
}

/* Drag handle on mobile */
@media (max-width: 639px) {
  .rsg-modal .modal__header::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 9999px;
    background-color: hsl(220, 13%, 91%);
  }
}

/* Close button */
.rsg-modal .modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: hsl(220, 9%, 46%);
  transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.rsg-modal .modal__close svg {
  width: 24px;
  height: 24px;
}

.rsg-modal .modal__close:active {
  background-color: hsl(220, 14%, 96%);
  color: hsl(220, 26%, 14%);
}

@media (hover: hover) {
  .rsg-modal .modal__close:hover {
    background-color: hsl(220, 14%, 96%);
    color: hsl(220, 26%, 14%);
  }
}

/* Body — scrollable */
.rsg-modal .modal__body {
  padding: 12px 16px 20px;
  overflow-y: auto;
  flex: 1;
}

/* ============================================================
   Instructions
   ============================================================ */
.rsg-modal .instructions {
  background-color: hsla(220, 14%, 96%, 0.5);
  border-radius: 0.75rem;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.rsg-modal .instructions__text {
  font-size: 11px;
  color: hsl(220, 9%, 46%);
  line-height: 1.6;
  margin: 0;
}

.rsg-modal .instructions__highlight {
  font-weight: 600;
  color: hsl(220, 26%, 14%);
}

/* ============================================================
   Ring Preview
   ============================================================ */
.rsg-modal .ring-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  margin-bottom: 12px;
}

@media (min-width: 640px) {
  .rsg-modal .ring-preview {
    height: 150px;
  }
}

.rsg-modal .ring-preview__circle {
  border-radius: 50%;
  border: 2px dashed hsl(41, 47%, 56%);
  display: flex;
  align-items: center;
  justify-content: center;
  /* width & height set via JS */
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rsg-modal .ring-preview__label {
  font-size: 10px;
  color: hsl(220, 9%, 46%);
  user-select: none;
  pointer-events: none;
}

/* ============================================================
   Size Table
   ============================================================ */
.rsg-modal .size-table {
  border-radius: 0.75rem;
  border: 1px solid hsl(220, 13%, 91%);
  overflow: hidden;
  margin-bottom: 12px;
}

.rsg-modal .size-table__table {
  font-size: 12px;
  border-collapse: collapse;
  width: 100%;
}

.rsg-modal .size-table__head-row {
  background-color: hsl(220, 14%, 96%);
}

.rsg-modal .size-table__th {
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 600;
  color: hsl(220, 9%, 46%);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rsg-modal .size-table__th--left {
  text-align: left;
}

.rsg-modal .size-table__th--center {
  text-align: center;
}

.rsg-modal .size-table__row {
  cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.rsg-modal .size-table__row--selected {
  background-color: hsla(41, 47%, 56%, 0.15);
  font-weight: 600;
}

.rsg-modal .size-table__row:active {
  background-color: hsla(41, 47%, 56%, 0.08);
}

@media (hover: hover) {
  .rsg-modal .size-table__row:not(.size-table__row--selected):hover {
    background-color: hsla(220, 14%, 96%, 0.6);
  }
}

.rsg-modal .size-table__cell {
  padding: 8px 12px;
  color: hsl(220, 26%, 14%);
}

.rsg-modal .size-table__cell--center {
  text-align: center;
}

.rsg-modal .size-table__row+.size-table__row>.size-table__cell {
  border-top: 1px solid hsl(220, 13%, 91%);
}

/* ============================================================
   Cart Button (inside modal)
   ============================================================ */
.rsg-modal .rsg-cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 0.75rem;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  background-color: hsl(220, 26%, 14%);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.rsg-modal .rsg-cart-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.rsg-modal .rsg-cart-btn:active:not(:disabled) {
  opacity: 0.8;
}

@media (hover: hover) {
  .rsg-modal .rsg-cart-btn:hover:not(:disabled) {
    opacity: 0.9;
  }
}

.rsg-modal .cart-btn__icon {
  flex-shrink: 0;
  transition: opacity 150ms ease;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes rsg-fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes rsg-slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes rsg-scaleIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}