.wceo-configurator {
  width: 100%;
  min-width: 0;
  flex-basis: 100%;
  padding: 22px 0;
  margin: 0 0 22px;
  border: 0;
  border-top: 1px solid #e5e5e5;
  border-bottom: 1px solid #e5e5e5;
  clear: both;
}

.wceo-configurator legend {
  float: none;
  font-size: 1.12em;
  font-weight: 600;
  padding: 0 0 12px;
}

.wceo-configurator [hidden] {
  display: none !important;
}

.wceo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px 12px;
}

.wceo-field {
  grid-column: 1 / -1;
  min-width: 0;
}

.wceo-power-field {
  grid-column: span 1;
}

.wceo-field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.92em;
  font-weight: 600;
}

.wceo-field select,
.wceo-field input {
  width: 100%;
  margin: 0;
  min-height: 44px;
  border-radius: 5px;
}

.wceo-upload-toggle,
.wceo-upload-panel {
  grid-column: 1 / -1;
}

.wceo-upload-toggle label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 0;
}

.wceo-upload-toggle input {
  margin: 0;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.wceo-upload-panel {
  background: rgba(0, 0, 0, 0.025);
  padding: 16px;
  border: 1px dashed #ccc;
  border-radius: 6px;
}

.wceo-upload-panel input {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 10px 0;
}

.wceo-upload-status {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.wceo-price-summary {
  margin-top: 22px;
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.025);
  border-radius: 6px;
}

.wceo-price-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 7px 0;
}

.wceo-grand {
  border-top: 1px solid #ddd;
  padding-top: 12px;
  font-size: 1.08em;
}

.wceo-price-summary small {
  display: block;
  margin-top: 10px;
  line-height: 1.4;
  font-size: 0.78em;
  opacity: 0.8;
}

.wceo-error {
  padding: 12px;
  margin: 15px 0 0;
  border-left: 3px solid #b32d2e;
  background: #fff1f1;
  color: #842029;
}

.wceo-configurator :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.wceo-configurator .wceo-width-half {
  grid-column: span 2;
}

.wceo-configurator .wceo-width-quarter {
  grid-column: span 1;
}

/* Lens option cards */
.wceo-configurator .wceo-choices-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

.wceo-configurator .wceo-choices-cards > .wceo-choice {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
  gap: 6px;
  margin: 0;
  padding: 12px 10px;
  border: 1px solid #dedede;
  border-radius: 10px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease,
    background-color 0.2s ease, transform 0.2s ease;
}

/* Hide the native radio circle while keeping keyboard access */
.wceo-configurator .wceo-choices-cards > .wceo-choice input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.wceo-configurator .wceo-choices-cards > .wceo-choice img {
  display: block;
  width: 100%;
  height: 82px;
  min-height: 82px;
  margin: 0;
  object-fit: contain;
}

.wceo-configurator .wceo-choices-cards > .wceo-choice .wceo-choice-title {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5em;
  line-height: 1.25;
  font-size: 0.85em;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.wceo-configurator .wceo-choices-cards > .wceo-choice .wceo-choice-price {
  display: block;
  min-height: 1.35em;
  line-height: 1.3;
  font-size: 0.84em;
  font-weight: 500;
  opacity: 0.82;
}

.wceo-configurator .wceo-choices-cards > .wceo-choice:hover {
  border-color: #999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
  transform: translateY(-2px);
}

.wceo-configurator .wceo-choices-cards > .wceo-choice.is-selected {
  border: 2px solid #0095ff;
  padding: 11px 9px;
  background: #faf9f6;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.09);
}

.wceo-configurator
  .wceo-choices-cards
  > .wceo-choice.is-selected::after {
  content: "✓";
  position: absolute;
  top: 3px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0095ff;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.wceo-configurator .wceo-choices-cards > .wceo-choice:focus-within {
  outline: 2px solid #77c6ff;
  outline-offset: 2px;
}

/* Other radio choices and upload details */
.wceo-configurator .wceo-choices-radio {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.wceo-configurator .wceo-choices-radio .wceo-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  padding: 14px;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  cursor: pointer;
  margin: 0;
  text-align: center;
}

.wceo-configurator .wceo-choice.is-selected {
  border-color: currentColor;
  box-shadow: inset 0 0 0 1px currentColor;
  background: rgba(0, 0, 0, 0.035);
}

.wceo-configurator .wceo-choice input,
.wceo-configurator input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex-shrink: 0;
}

.wceo-configurator .wceo-choice img {
  width: 100%;
  height: 110px;
  object-fit: contain;
}

.wceo-configurator .wceo-choice-price,
.wceo-configurator .wceo-choice small {
  font-size: 0.85em;
}

.wceo-configurator .wceo-description {
  display: block;
  margin-top: 6px;
}

.wceo-configurator .wceo-selected-image {
  width: 100px;
  height: 75px;
  object-fit: contain;
  margin-top: 8px;
}

.wceo-configurator .wceo-remove-file {
  margin-top: 8px;
}

/* Upload prescription toggle card */
.wceo-configurator .wceo-field[data-wceo-field="upload_choice"] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  padding: 14px 16px;
  border: 1px solid #e2e5e9;
  border-radius: 10px;
  background: #f8fafc;
}

.wceo-configurator
  .wceo-field[data-wceo-field="upload_choice"]
  .wceo-field-label {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-size: 0.96em;
  font-weight: 600;
  cursor: pointer;
}

/* Styled checkbox toggle */
.wceo-configurator
  .wceo-field[data-wceo-field="upload_choice"]
  input[type="checkbox"] {
  grid-column: 2;
  grid-row: 1;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 46px;
  height: 26px;
  min-height: 26px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background-color: #cbd1d8;
  background-image: radial-gradient(circle, #fff 0 8px, transparent 8.5px);
  background-repeat: no-repeat;
  background-position: 3px center;
  background-size: 20px 20px;
  cursor: pointer;
  transition: background-color 0.2s ease, background-position 0.2s ease;
}

.wceo-configurator
  .wceo-field[data-wceo-field="upload_choice"]
  input[type="checkbox"]:checked {
  background-color: #0095ff;
  background-position: 23px center;
}

.wceo-configurator
  .wceo-field[data-wceo-field="upload_choice"]
  input[type="checkbox"]:focus-visible {
  outline: 2px solid #77c6ff;
  outline-offset: 3px;
}

.wceo-configurator
  .wceo-field[data-wceo-field="upload_choice"]
  .wceo-description:empty {
  display: none;
}

/* Prescription file chooser */
.wceo-configurator .wceo-field[data-wceo-field="prescription_file"] {
  box-sizing: border-box;
  padding: 16px;
  border: 1px dashed #b9c5d1;
  border-radius: 10px;
  background: #fbfcfe;
}

.wceo-configurator
  .wceo-field[data-wceo-field="prescription_file"]
  .wceo-field-label {
  margin-bottom: 10px;
  font-size: 0.96em;
  font-weight: 600;
}

.wceo-configurator
  .wceo-field[data-wceo-field="prescription_file"]
  input[type="file"] {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 7px;
  border: 1px solid #d9dfe6;
  border-radius: 7px;
  background: #fff;
  font-size: 0.9em;
}

.wceo-configurator
  .wceo-field[data-wceo-field="prescription_file"]
  input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 12px;
  border: 0;
  border-radius: 5px;
  background: #0095ff;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.wceo-configurator
  .wceo-field[data-wceo-field="prescription_file"]
  input[type="file"]::file-selector-button:hover {
  background: #007edb;
}

.wceo-configurator
  .wceo-field[data-wceo-field="prescription_file"]
  > small:not(.wceo-description) {
  display: block;
  margin-top: 8px;
  color: #667085;
  font-size: 0.82em;
}

.wceo-configurator
  .wceo-field[data-wceo-field="prescription_file"]
  .wceo-upload-status {
  display: block;
  margin-top: 9px;
  overflow-wrap: anywhere;
}

.wceo-configurator
  .wceo-field[data-wceo-field="prescription_file"]
  .wceo-remove-file {
  margin-top: 10px;
  padding: 7px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

/* Exactly three lens options: three columns on desktop */
@supports selector(.wceo-choices-cards:has(> .wceo-choice)) {
  .wceo-configurator
    .wceo-choices-cards:has(> .wceo-choice:nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Tablet and mobile */
@media (max-width: 767px) {
  .wceo-configurator .wceo-choices-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .wceo-configurator .wceo-choices-cards > .wceo-choice {
    padding: 10px 9px;
  }

  .wceo-configurator .wceo-choices-cards > .wceo-choice img {
    height: 88px;
    min-height: 88px;
  }

  .wceo-configurator
    .wceo-choices-cards
    > .wceo-choice.is-selected {
    padding: 9px 8px;
  }

  @supports selector(.wceo-choices-cards:has(> .wceo-choice)) {
    .wceo-configurator
      .wceo-choices-cards:has(> .wceo-choice:nth-child(3):last-child) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
}

/* Existing small-screen configurator layout */
@media (max-width: 549px) {
  .wceo-configurator {
    padding: 18px 0;
  }

  .wceo-grid {
    gap: 12px 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wceo-price-summary {
    padding: 12px;
  }

  .wceo-field-label {
    font-size: 0.88em;
  }

  .wceo-field[data-wceo-field="prescription_file"] {
    padding: 12px;
  }
}

/* Narrow phones */
@media (max-width: 359px) {
  .wceo-configurator .wceo-choices-cards {
    gap: 8px;
  }

  .wceo-configurator .wceo-choices-cards > .wceo-choice {
    padding: 8px 7px;
  }

  .wceo-configurator .wceo-choices-cards > .wceo-choice img {
    height: 72px;
    min-height: 72px;
  }

  .wceo-configurator
    .wceo-choices-cards
    > .wceo-choice
    .wceo-choice-title {
    font-size: 0.88em;
  }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .wceo-configurator .wceo-choices-cards > .wceo-choice,
  .wceo-configurator .wceo-choices-cards > .wceo-choice:hover {
    transition: none;
    transform: none;
  }

  .wceo-configurator
    .wceo-field[data-wceo-field="upload_choice"]
    input[type="checkbox"] {
    transition: none;
  }
}