/**
 * Size guide modal — product measurements
 */

/* Trigger */
.stedrino-size-guide__trigger-wrap {
  margin: 0.35rem 0 0.75rem;
}

.stedrino-size-guide__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--st-sky);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15rem;
}

.stedrino-size-guide__trigger:hover {
  color: var(--st-navy);
}

.stedrino-size-guide__trigger svg {
  flex-shrink: 0;
}

/* Modal shell — hidden by default; [hidden] must win over display:flex */
.stedrino-size-guide {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}

.stedrino-size-guide[hidden] {
  display: none !important;
}

.stedrino-size-guide.is-open {
  display: flex;
  pointer-events: auto;
}

.stedrino-size-guide__overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 57, 115, 0.45);
  backdrop-filter: blur(2px);
}

.stedrino-size-guide__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  max-height: min(88vh, 720px);
  background: var(--st-surface);
  border-radius: var(--st-radius-sm);
  box-shadow: 0 20px 50px rgba(13, 57, 115, 0.22);
  overflow: hidden;
}

.stedrino-size-guide__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-block-end: 1px solid var(--st-border);
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

.stedrino-size-guide__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--st-navy);
  line-height: 1.35;
}

.stedrino-size-guide__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--st-bg);
  color: var(--st-navy);
  cursor: pointer;
  flex-shrink: 0;
}

.stedrino-size-guide__close:hover {
  background: var(--st-pink);
  color: #fff;
}

.stedrino-size-guide__body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem 1rem;
  -webkit-overflow-scrolling: touch;
}

.stedrino-size-guide__section {
  margin-block-end: 1.25rem;
}

.stedrino-size-guide__section:last-child {
  margin-block-end: 0;
}

.stedrino-size-guide__section.is-empty {
  display: none;
}

.stedrino-size-guide__section-title {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--st-pink);
}

.stedrino-size-guide__table-wrap {
  overflow-x: auto;
  border: 1px solid var(--st-border);
  border-radius: 10px;
  background: #fff;
}

/* Force real table layout (fixes Flatsome / broken stacks) */
.stedrino-size-guide__table,
#custom-meta-popup .ux-table,
#custom-meta-popup table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  display: table !important;
}

.stedrino-size-guide__table thead,
#custom-meta-popup .ux-table thead {
  display: table-header-group !important;
}

.stedrino-size-guide__table tbody,
#custom-meta-popup .ux-table tbody {
  display: table-row-group !important;
}

.stedrino-size-guide__table tr,
#custom-meta-popup .ux-table tr {
  display: table-row !important;
}

.stedrino-size-guide__table th,
.stedrino-size-guide__table td,
#custom-meta-popup .ux-table th,
#custom-meta-popup .ux-table td {
  display: table-cell !important;
  padding: 0.65rem 0.5rem;
  text-align: center;
  vertical-align: middle;
  font-size: 0.88rem;
  line-height: 1.35;
  border-block-end: 1px solid var(--st-border);
}

.stedrino-size-guide__table th,
#custom-meta-popup .ux-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--st-navy);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
}

.stedrino-size-guide__table tbody tr:nth-child(even) td,
#custom-meta-popup .ux-table tbody tr:nth-child(even) td {
  background: #f5f8fb;
}

.stedrino-size-guide__table tbody tr:last-child td,
#custom-meta-popup .ux-table tbody tr:last-child td {
  border-block-end: none;
}

.stedrino-size-guide__table td:first-child,
#custom-meta-popup .ux-table td:first-child {
  font-weight: 700;
  color: var(--st-navy);
}

.stedrino-size-guide__foot {
  padding: 0.75rem 1rem 1rem;
  border-block-start: 1px solid var(--st-border);
  background: #fff;
}

.stedrino-size-guide__done,
#close-custom-meta-popup.button {
  width: 100%;
  min-height: 46px;
  border: none;
  border-radius: var(--st-radius-pill);
  background: var(--st-navy) !important;
  color: #fff !important;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.stedrino-size-guide__done:hover,
#close-custom-meta-popup.button:hover {
  background: var(--st-pink) !important;
}

/* Legacy Flatsome popup — hidden until opened */
#custom-meta-popup.ux-popup,
#custom-meta-popup.stedrino-size-guide--legacy {
  display: none !important;
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 520px);
  max-height: min(88vh, 720px);
  margin: 0;
  padding: 0;
  border-radius: var(--st-radius-sm);
  box-shadow: 0 20px 50px rgba(13, 57, 115, 0.22);
  overflow: hidden;
  z-index: 10050;
}

#custom-meta-popup .ux-popup-content {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 720px);
  padding: 0;
}

.stedrino-size-guide__close--legacy {
  position: absolute;
  top: 0.65rem;
  inset-inline-end: 0.65rem;
  z-index: 2;
}

#custom-meta-popup .ux-popup-content > h3.uppercase {
  margin: 0;
  padding: 1rem 3rem 0.75rem 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--st-navy);
  text-transform: none;
  border-block-end: 1px solid var(--st-border);
  background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
}

#custom-meta-popup h4 {
  margin: 0.75rem 1rem 0.35rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--st-pink);
}

#custom-meta-popup .ux-table {
  margin: 0 1rem 0.75rem;
  border: 1px solid var(--st-border);
  border-radius: 10px;
  overflow: hidden;
}

#custom-meta-popup #close-custom-meta-popup {
  margin: 0.75rem 1rem 1rem !important;
  width: calc(100% - 2rem);
}

#custom-meta-popup.is-open,
#custom-meta-popup.stedrino-size-guide--legacy.is-open {
  display: block !important;
}

#custom-meta-popup-overlay {
  display: none !important;
}

#custom-meta-popup-overlay.is-open {
  display: block !important;
}

#custom-meta-popup-overlay.ux-popup-overlay {
  z-index: 10049;
  background: rgba(13, 57, 115, 0.45);
  backdrop-filter: blur(2px);
}

body.stedrino-size-guide-open,
body.popup-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .stedrino-size-guide {
    align-items: flex-end;
    padding: 0;
  }

  .stedrino-size-guide__dialog,
  #custom-meta-popup.ux-popup {
    width: 100%;
    max-height: 92vh;
    border-end-start-radius: 0;
    border-end-end-radius: 0;
  }

  .stedrino-size-guide__table th,
  .stedrino-size-guide__table td,
  #custom-meta-popup .ux-table th,
  #custom-meta-popup .ux-table td {
    padding: 0.55rem 0.35rem;
    font-size: 0.82rem;
  }
}
