/* ==========================================================
   Corneal Lens order form (Contact Form 7)

   Every rule starts with #clc-form (the id on the form's outer div)
   so it outranks theme styling (Bridge / WPBakery restyle CF7 forms
   with long selectors) and never touches anything else on the site.
   ========================================================== */

#clc-form {
  --clc-line: #999;          /* outer + heavy borders */
  --clc-rule: #999;          /* inner cell borders */
  --clc-label: #333;
  --clc-bg: #fff;
  --clc-focus: #1a6fd6;
  --clc-pad: 16px;

  box-sizing: border-box;
  border: 3px solid var(--clc-line);
  background: var(--clc-bg);
  color: #111;
  font-size: 14px;
  line-height: 1.35;
  text-align: left;

  /* Stacking is based on the form's own width, not the screen's */
  container-type: inline-size;
}

/* ---------- Full page width ----------
   Breaks out of the theme's content column so the form spans the
   window (16px gutter each side, capped at 1600px) and R / L sit 50/50.
   If the page template is already full width, delete this block. */
/*
#clc-form {
  --clc-max: 1600px;
  --clc-gutter: 16px;
  width: min(var(--clc-max), 100vw - 2 * var(--clc-gutter));
  max-width: none;
  margin-left: calc(50% - min(var(--clc-max) / 2, 50vw - var(--clc-gutter)));
  margin-right: 0;
}

#clc-form *,
#clc-form *::before,
#clc-form *::after { box-sizing: border-box; }
*/
/* ---------- Undo theme / CF7 extras ----------
   CF7 wraps lines in <p> and adds <br>; these make them invisible to the layout. */

#clc-form p { display: contents; }
#clc-form br { display: none; }

#clc-form label {
  font-weight: inherit;
  letter-spacing: normal;
  text-transform: none;
}

/* ---------- Generic cells / labels ---------- */

#clc-form .clc-label {
  display: block;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--clc-label);
  margin: 0 0 4px;
}

#clc-form .clc-cell,
#clc-form .clc-block {
  display: block;
  padding: var(--clc-pad);
  margin: 0;
}

#clc-form .wpcf7-form-control-wrap { display: block; position: relative; }

/* Inputs: one plain look, whatever the theme does */
#clc-form input[type="text"],
#clc-form input[type="email"],
#clc-form input[type="number"],
#clc-form input[type="date"],
#clc-form textarea {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 5px 6px;
  border: 1px solid #c8c8c8;
  border-radius: 2px;
  background: #fff;
  box-shadow: none;
  font: inherit;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.3;
  color: inherit;
}

#clc-form textarea { height: auto; min-height: 4.5em; resize: vertical; }

#clc-form input:focus,
#clc-form textarea:focus {
  outline: 2px solid var(--clc-focus);
  outline-offset: -1px;
  border-color: var(--clc-focus);
}

/* ---------- Header (practice / patient) ---------- */

#clc-form .clc-header {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 3px solid var(--clc-line);
}
#clc-form .clc-header .clc-cell {
  border-right: 1px solid var(--clc-rule);
  border-bottom: 1px solid var(--clc-rule);
}
#clc-form .clc-header .clc-span-2 { grid-column: span 2; }
#clc-form .clc-header .clc-h-last { border-bottom: 0; }
/* last cell in each row: Date Required, Quantity, Practice Email */
#clc-form .clc-header .clc-h-end { border-right: 0; }

/* ---------- R / L columns ---------- */

#clc-form .clc-eyes {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* centre divider drawn as an overlay so both columns stay exactly 50/50 */
#clc-form .clc-eyes::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  background: var(--clc-line);
  z-index: 1;
  pointer-events: none;
}

#clc-form .clc-eye { min-width: 0; margin: 0; padding: 0; }

#clc-form .clc-eye > * { border-bottom: 1px solid var(--clc-rule); }
#clc-form .clc-eye > *:last-child { border-bottom: 0; }

/* Base / Diameter / Optic and Power / Material / Tint rows */
#clc-form .clc-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
}
#clc-form .clc-row--spec { grid-template-columns: auto 2fr 1fr 1fr; }
#clc-form .clc-row .clc-cell { border-left: 1px solid var(--clc-rule); }
#clc-form .clc-row .clc-f-power { border-left: 0; }

#clc-form .clc-eye-badge {
  display: flex;
  align-items: flex-start;
  padding: 6px 12px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
}

/* ---------- Checkbox / radio groups ---------- */

#clc-form .wpcf7-checkbox,
#clc-form .wpcf7-radio {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

#clc-form .wpcf7-list-item { display: inline-block; margin: 0; }

#clc-form .wpcf7-list-item label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}

#clc-form .wpcf7-list-item-label { font-weight: 400; }

#clc-form .wpcf7-list-item input {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: #111;
}

#clc-form .clc-lens-types .wpcf7-checkbox { justify-content: center; }

#clc-form .clc-barcode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 16px;
  margin-top: 10px;
}
#clc-form .clc-barcode-row .clc-inline { display: block; flex: 1 1 180px; margin: 0; }
#clc-form .clc-barcode-row > .wpcf7-form-control-wrap { display: inline-block; padding-bottom: 6px; }

/* ---------- 'On Eye' zone-lift dial ----------
   3x3 grid: 90 on top, 180 left, circle centre, 0 right, 270 bottom */

#clc-form .clc-dial {
  display: grid;
  grid-template-columns: minmax(70px, 110px) 150px minmax(70px, 110px);
  grid-template-rows: auto 150px auto;
  grid-template-areas:
    ".    top    ."
    "left dial   right"
    ".    bottom .";
  justify-content: center;
  align-items: center;
  gap: 4px 10px;
  margin-top: 6px;
}

/* circle with four short ticks on the diagonals */
#clc-form .clc-dial-circle {
  grid-area: dial;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 1.5px solid #444;
  border-radius: 50%;
}
#clc-form .clc-dial-circle::before,
#clc-form .clc-dial-circle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1.5px;
  margin-top: -0.75px;
  background: linear-gradient(to right,
    #444 0 11%, transparent 11% 89%, #444 89% 100%);
  transform: rotate(45deg);
}
#clc-form .clc-dial-circle::after { transform: rotate(-45deg); }

#clc-form .clc-dial-pos {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin: 0;
  font-size: 12px;
  color: var(--clc-label);
}
#clc-form .clc-dial-pos .wpcf7-form-control-wrap { width: 100%; }
#clc-form .clc-dial-pos input { text-align: center; }

#clc-form .clc-dial-90  { grid-area: top; }
#clc-form .clc-dial-270 { grid-area: bottom; }
#clc-form .clc-dial-180 { grid-area: left; }
#clc-form .clc-dial-0   { grid-area: right; }

/* ---------- Zones / Sphere table ---------- */

#clc-form .clc-zones { padding: 0; }

#clc-form .clc-zones-title {
  margin: 0;
  padding: 10px var(--clc-pad) 8px;
  font-family: inherit;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  text-align: center;
  color: inherit;
  border-bottom: 1px solid var(--clc-rule);
}

#clc-form .clc-table-scroll { overflow-x: auto; }

#clc-form .clc-zones table {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  background: none;
}

#clc-form .clc-zones tr { border: 0; background: none; }

#clc-form .clc-zones th,
#clc-form .clc-zones td {
  border: 1px solid var(--clc-rule);
  padding: 3px;
  background: none;
  color: inherit;
  vertical-align: middle;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: normal;
}
/* drop the outer edges; the column border already draws them */
#clc-form .clc-zones tr > :first-child { border-left: 0; }
#clc-form .clc-zones tr > :last-child  { border-right: 0; }
#clc-form .clc-zones tbody tr:last-child > * { border-bottom: 0; }
#clc-form .clc-zones thead th { border-top: 0; }

#clc-form .clc-zones th {
  font-size: 11px;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
}
#clc-form .clc-zones thead th:first-child,
#clc-form .clc-zones tbody th { width: 36px; text-align: center; }

#clc-form .clc-zones td input {
  border-color: transparent;
  padding: 6px 4px;
  text-align: center;
}
#clc-form .clc-zones td input:hover { border-color: #ddd; }

/* ---------- Footer ---------- */

#clc-form .clc-footer { border-top: 3px solid var(--clc-line); }

#clc-form .clc-submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 0 var(--clc-pad) var(--clc-pad);
}

#clc-form .wpcf7-submit {
  width: auto;
  height: auto;
  margin: 0;
  padding: 10px 24px;
  border: 0;
  border-radius: 3px;
  background: #111;
  color: #fff;
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  cursor: pointer;
}
#clc-form .wpcf7-submit:hover { background: #333; }
#clc-form .wpcf7-spinner { margin: 0; }

/* CF7 validation messages */
#clc-form .wpcf7-not-valid-tip { font-size: 12px; margin-top: 3px; }
#clc-form .wpcf7-not-valid { border-color: #c00; }

/* ---------- Stack R above L once the form is narrower than 760px ---------- */

@container (max-width: 760px) {
  #clc-form .clc-eyes { grid-template-columns: 1fr; }
  #clc-form .clc-eyes::before { display: none; }
  #clc-form .clc-eye--r { border-bottom: 3px solid var(--clc-line); }
}

/* ---------- Phone-width form ---------- */

@container (max-width: 520px) {
  #clc-form .clc-header { grid-template-columns: 1fr 1fr; }
  #clc-form .clc-header .clc-span-2 { grid-column: 1 / -1; }
  #clc-form .clc-header .clc-h-spare { display: none; }
  #clc-form .clc-header .clc-cell { border-right: 0; }
  #clc-form .clc-header .clc-h-date,
  #clc-form .clc-header .clc-h-ordered { border-right: 1px solid var(--clc-rule); }

  #clc-form .clc-row,
  #clc-form .clc-row--spec { grid-template-columns: 1fr 1fr; }
  #clc-form .clc-eye-badge { grid-column: 1 / -1; padding: 8px var(--clc-pad) 0; }
  #clc-form .clc-row .clc-cell { border-top: 1px solid var(--clc-rule); }
  #clc-form .clc-row .clc-f-base,
  #clc-form .clc-row .clc-f-power { grid-column: 1 / -1; border-left: 0; border-top: 0; }
  #clc-form .clc-row .clc-f-diameter,
  #clc-form .clc-row .clc-f-material { border-left: 0; }

  #clc-form .clc-lens-types .wpcf7-checkbox { justify-content: flex-start; }

  #clc-form .clc-dial {
    grid-template-columns: 1fr 110px 1fr;
    grid-template-rows: auto 110px auto;
  }

  #clc-form .clc-zones table { min-width: 290px; }
  #clc-form .clc-zones th { font-size: 10px; white-space: normal; }
  #clc-form .clc-zones thead th:first-child,
  #clc-form .clc-zones tbody th { width: 26px; }
  #clc-form .clc-zones td input { padding: 6px 2px; }
}
