/* ============================================================
   WS Custom Size - Frontend Styles
   ============================================================ */

/* ---------------- Popup Overlay & Container ---------------- */
.ws-popup {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ws-popup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ws-popup.ws-popup--active .ws-popup-overlay {
  opacity: 1;
}

.ws-popup-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  margin: 0 16px;
  background: #fff;
  border-radius: 0;
  overflow: hidden;
  transform: translateY(30px);
  opacity: 0;
  transition:
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.3s ease;
}

.ws-popup.ws-popup--active .ws-popup-container {
  transform: translateY(0);
  opacity: 1;
}

.ws-popup-inner {
  max-height: 90vh;
  overflow-y: auto;
  padding: 40px;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.ws-popup-inner::-webkit-scrollbar {
  width: 4px;
}

.ws-popup-inner::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

/* ---------------- Popup Header ---------------- */
.ws-popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #333;
  padding: 0;
  z-index: 3;
  transition: color 0.2s;
}

.ws-popup-close:hover {
  color: #000;
}

.ws-popup-title {
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  line-height: 20px;
  letter-spacing: 0.5px;
  vertical-align: middle;
  text-transform: uppercase;
  margin-bottom: 2.75rem;
}

/* ---------------- Fields Grid ---------------- */
.ws-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 16px;
}

.ws-field-group {
  display: flex;
  flex-direction: column;
}

.ws-field-group.ws-field-full {
  grid-column: 1 / -1;
}

.ws-field-label {
  font-weight: 700;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.5px;
  vertical-align: middle;
  color: #0e1010;
  margin-bottom: 10px;
}

.ws-field-label .ws-required {
  color: #e74c3c;
  margin-left: 2px;
}

/* Number / Text input with unit dropdown */
.ws-field-input-wrapper {
  display: flex;
  border: 1px solid #d3d3d3;
  border-radius: 0;
  overflow: hidden;
  transition: border-color 0.2s;
  background: #fff;
  position: relative;
  height: 60px;
}

.ws-field-input-wrapper:focus-within {
  border-color: #a6a5a5;
}

.ws-field-input-wrapper.ws-field-error {
  border-color: #e74c3c;
}

.ws-field-input-wrapper input[type="number"],
.ws-field-input-wrapper input[type="text"] {
  flex: 1;
  border: none;
  padding: 10px 12px;
  color: #a6a5a5;
  background: transparent;
  outline: none;
  min-width: 0;
  appearance: textfield;
  -moz-appearance: textfield;
}

.ws-field-input-wrapper input::-webkit-outer-spin-button,
.ws-field-input-wrapper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ws-field-input-wrapper input::placeholder {
  color: #a6a5a5;
}

.ws-field-unit-select {
  border: none;
  padding: 8px 30px 8px 10px;
  color: #a6a5a5;
  background: transparent;
  cursor: pointer;
  outline: none;
  min-width: 55px;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  z-index: 2;
}
.ws-field-group:not(.ws-field-full) .ws-field-input-wrapper::after {
  content: url('data:image/svg+xml,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M18 9L12 15L6 9" stroke="%23504B4C" stroke-width="1.5" stroke-linecap="round"/></svg>');
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  z-index: 1;
}

.ws-field-unit-static {
  display: flex;
  align-items: center;
  padding: 0 24px;
  color: #a6a5a5;
  background: transparent;
  white-space: nowrap;
}

/* Radio group */
.ws-field-radio-group {
  display: flex;
  gap: 16px;
  padding-top: 4px;
}

.ws-field-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: #a6a5a5;
  cursor: pointer;
}

.ws-field-radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: #0a7aff;
  margin: 0;
}

/* Textarea */
.ws-field-textarea {
  width: 100%;
  border: 1px solid #d3d3d3;
  border-radius: 0;
  padding: 10px 12px;
  font-size: 16px;
  color: #a6a5a5;
  resize: vertical;
  min-height: 80px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.ws-field-textarea:focus {
  border-color: #333;
}

/* Select dropdown */
.ws-field-select {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: #333;
  background: #fff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.ws-field-select:focus {
  border-color: #333;
}

/* ---------------- Popup Footer ---------------- */
.ws-popup-footer {
  margin-top: 12px;
  padding-top: 20px;
}

.ws-save-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  cursor: pointer;
  font-size: 13px;
  color: #555;
}

.ws-save-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #333;
  margin: 0;
}

.ws-popup-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #fff;
  background: #222;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 48px;
}

.ws-popup-submit:hover {
  background: #000;
}

.ws-popup-submit:disabled {
  background: #999;
  cursor: not-allowed;
}

.ws-spinner {
  animation: ws-spin 0.8s linear infinite;
}

@keyframes ws-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ---------------- Cart Edit Button ---------------- */
.ws-edit-size-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 6px;
  transition: color 0.2s;
}

.ws-edit-size-btn:hover {
  color: #222;
}

.ws-edit-icon {
  font-size: 12px;
}

/* ---------------- My Account Form ---------------- */
.ws-myaccount-measurements h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.ws-myaccount-desc {
  color: #666;
  font-size: 14px;
  margin-bottom: 24px;
}

.ws-myaccount-form .ws-fields-grid {
  margin-bottom: 24px;
}

.ws-form-actions {
  margin-top: 0;
}

.ws-form-actions .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ---------------- Cart item data display ---------------- */
dl.variation dt {
  font-weight: 600;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 480px) {
  .ws-popup-container {
    max-width: 100%;
    margin: 0;
    max-height: 100vh;
    border-radius: 0;
  }

  .ws-popup-inner {
    max-height: 100vh;
    padding: 25px 16px 20px;
  }

  .ws-fields-grid {
    gap: 14px 12px;
    grid-template-columns: 1fr;
  }

  .ws-popup-title {
    font-size: 14px;
  }
}

/* ---------------- Success toast ---------------- */
.ws-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #222;
  color: #fff;
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 13px;
  z-index: 100000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.ws-toast.ws-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.ws-field-group input .ws-field-group.ws-field-disabled input {
  /* opacity: 0.5; */
  color: #8e8e93;
  pointer-events: none;
}

/* ---------------- Order Measurements Table (Frontend / Fancybox) ---------------- */
.ws-measurements-title {
  font-family: "Playfair Display", "Georgia", serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  color: #222;
  margin: 0 0 30px;
  padding-bottom: 0;
}

.ws-order-measurements-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}

.ws-order-measurements-table tr {
  border-bottom: 1px solid #e8e8e8;
}

.ws-order-measurements-table tr:last-child {
  border-bottom: 1px solid #e8e8e8;
}

.ws-order-measurements-table td {
  padding: 14px 12px;
  vertical-align: top;
  color: #555;
  line-height: 1.5;
}

.ws-order-measurements-table .ws-m-label {
  width: 45%;
  padding-left: 16px;
  color: #333;
  font-weight: 400;
}

.ws-order-measurements-table .ws-m-value {
  width: 35%;
  color: #333;
}

.ws-order-measurements-table .ws-m-unit {
  width: 20%;
  text-align: right;
  padding-right: 16px;
  color: #999;
  font-size: 13px;
}

/* Fancybox content wrapper override */
.fancybox-content .ws-order-measurements-table,
[id^="ws-order-measurements-"] {
  max-width: 700px;
  margin: 0 auto;
}

/* Link trigger style */
.ws-view-measurements {
  display: inline-block;
  margin-bottom: 5px;
  color: #2271b1;
  text-decoration: underline;
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.2s;
}

.ws-view-measurements:hover {
  color: #135e96;
}
