/* v1.7 — ตารางไซส์ (storefront table + studio editor). Loaded after muse.css. */

/* ---------- Read-only table ---------- */
.size-chart {
  margin: 4px 0 6px;
}
.size-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.size-table th,
.size-table td {
  padding: 9px 10px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.size-table thead th {
  background: var(--brand-tint);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2px;
}
.size-table tbody th {
  text-align: left;
  font-weight: 700;
  background: #fff;
  color: var(--ink);
}
.size-table tbody tr:last-child th,
.size-table tbody tr:last-child td {
  border-bottom: 0;
}
.size-table tr.is-selected th,
.size-table tr.is-selected td {
  background: var(--brand-soft);
}
.size-table tr.is-selected th {
  color: var(--brand-dark);
}
.size-picked {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.size-unit-note,
.size-note,
.size-measurements {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.size-measurements {
  color: var(--ink);
  white-space: pre-line;
}
.size-howto {
  margin-top: 10px;
  border: 1px dashed #f0cfdb;
  border-radius: 12px;
  background: var(--brand-tint);
  padding: 8px 12px;
}
.size-howto summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
}
.size-howto p {
  margin: 8px 0 2px;
  font-size: 13px;
  white-space: pre-line;
}
.size-guide-btn {
  margin-left: auto;
  font-size: 12.5px;
}
.variant-label-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.size-guide h2 {
  margin-bottom: 4px;
}
.size-guide .size-table th,
.size-guide .size-table td {
  white-space: normal;
}
/* Guide page */
.size-guide-section .size-table {
  margin-top: 12px;
}

/* ---------- Editor ---------- */
.size-box {
  border: 1px dashed #f0cfdb;
  background: var(--brand-tint);
  border-radius: 16px;
  padding: 12px 14px;
}
.size-box > label:first-child {
  font-weight: 700;
}
.size-box textarea {
  margin-top: 6px;
}
.size-editor {
  margin: 10px 0 4px;
}
.size-editor-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.size-unit-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.size-unit-field input {
  width: 90px;
  min-height: 38px;
}
.size-editor-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.size-editor-tools .text-btn {
  font-size: 12.5px;
  min-height: 34px;
}
.size-edit-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
}
.size-edit-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  table-layout: fixed;
}
.size-edit-table th,
.size-edit-table td {
  padding: 0;
  vertical-align: middle;
}
.size-edit-table thead th {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}
.size-edit-table .size-corner {
  width: 84px;
  padding-left: 6px;
}
.size-edit-table .size-row-tools {
  width: 38px;
  text-align: center;
}
.size-edit-table input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 6px 8px;
  font-size: 13px;
  text-align: center;
}
.size-edit-table th[scope="row"] input {
  font-weight: 700;
  text-align: left;
}
.size-col {
  display: flex;
  align-items: center;
  gap: 2px;
}
.size-col input {
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 4px;
}
.size-editor .icon-btn.small {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.size-editor .icon-btn.small .icon {
  width: 14px;
  height: 14px;
}
.size-empty td {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 14px 0;
}
.size-shop-panel .size-editor {
  margin-top: 4px;
}

/* ---------- Phones: one card per size, no sideways scrolling ---------- */
@media (max-width: 650px) {
  .size-table,
  .size-table tbody,
  .size-table tr,
  .size-table td,
  .size-table tbody th {
    display: block;
    width: 100%;
    white-space: normal;
  }
  .size-table {
    border: 0;
    background: transparent;
    border-radius: 0;
    overflow: visible;
  }
  .size-table thead {
    display: none;
  }
  .size-table tbody tr {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    margin-bottom: 10px;
    overflow: hidden;
  }
  .size-table tbody th {
    background: var(--brand-tint);
    padding: 9px 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--line);
  }
  .size-table tr.is-selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand-soft);
  }
  .size-table tr.is-selected td {
    background: #fff;
  }
  .size-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
    text-align: right;
    font-size: 14px;
    border-bottom: 1px solid #f7edf1;
  }
  .size-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12.5px;
    text-align: left;
    flex-shrink: 0;
  }
  .size-table tbody tr:last-child td:last-child,
  .size-table td:last-child {
    border-bottom: 0;
  }

  /* editor */
  .size-edit-wrap {
    padding: 0;
    border: 0;
    background: transparent;
  }
  .size-edit-table,
  .size-edit-table thead,
  .size-edit-table tbody,
  .size-edit-table tr,
  .size-edit-table td,
  .size-edit-table th {
    display: block;
    width: 100%;
  }
  .size-edit-table {
    border-spacing: 0;
  }
  .size-edit-table thead tr {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    margin-bottom: 10px;
  }
  .size-edit-table thead tr::before {
    content: "ช่องวัด (หัวตาราง)";
    flex-basis: 100%;
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 700;
  }
  .size-edit-table thead th {
    width: auto;
    flex: 1 1 calc(50% - 6px);
  }
  .size-edit-table .size-corner,
  .size-edit-table thead .size-row-tools {
    display: none;
  }
  .size-edit-table tbody tr {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    margin-bottom: 10px;
    padding: 10px 10px 6px;
  }
  .size-edit-table th[scope="row"] {
    padding-right: 44px;
    margin-bottom: 6px;
  }
  .size-edit-table th[scope="row"] input {
    font-size: 15px;
  }
  .size-edit-table td[data-label] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 0;
  }
  .size-edit-table td[data-label]::before {
    content: attr(data-label);
    font-size: 13px;
    color: var(--muted);
    flex: 1 1 auto;
    text-align: left;
  }
  .size-edit-table td[data-label] input {
    flex: 0 0 46%;
    min-height: 42px;
    font-size: 16px;
  }
  .size-edit-table tbody .size-row-tools {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto;
  }
  .size-editor .icon-btn.small {
    width: 36px;
    height: 36px;
  }
  .size-unit-field input {
    min-height: 42px;
    font-size: 16px;
  }
  .size-col input {
    min-height: 42px;
    font-size: 15px;
  }
  .size-guide-btn {
    margin-left: 0;
  }
}

/* Accordion body on the product page (details > div instead of details > p) */
.accordion-body {
  padding-top: 12px;
}
.accordion-body > p {
  padding-top: 0;
}
.size-howto[open] summary::after {
  content: "−";
}
