/* Calculator page styles. The shared frame (header, navigation, footer) is in site.css;
   reotemp-ds/tokens.css and reotemp-ds/bundle.css come from the design system unchanged.
   This file covers the form, the results and the few pieces the system does not define. */

/* Part number auto-fill */
.wf-partnumber {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wf-partnumber h2 {
  margin: 0;
}

.wf-partnumber-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.wf-partnumber-row .rt-field {
  flex: 1 1 280px;
  max-width: 420px;
}


/* What the part number filled in, shown in the box after a fill */
.wf-fill-status {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: var(--space-1) 0 0;
  color: var(--ink);
}

.wf-fill-status svg {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  color: var(--green-700);
}

.wf-fill-status .wf-code {
  color: var(--green-700);
}

/* Form: the sections on the left and, on wide screens, the dimension drawing in a right rail
   that stays in view through the Thermowell, Process and Report sections. On narrow screens
   the drawing sits above the form as a collapsible panel. */
.wf-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
}

.wf-form-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.wf-rail {
  order: -1;
}

.wf-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.wf-section .rt-section {
  margin: 0;
}

.wf-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: var(--hairline) solid var(--grey-100);
}

.wf-section-head .rt-section {
  padding-bottom: 0;
  border-bottom: 0;
}

.wf-units {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-5) var(--space-4);
}

.wf-drawing-panel {
  padding: var(--space-3);
  border: var(--hairline) solid var(--grey-100);
  border-radius: var(--radius-lg);
  background: var(--white);
}

.wf-drawing-panel summary {
  cursor: pointer;
}

.wf-drawing-panel[open] summary {
  margin-bottom: var(--space-3);
}

.wf-drawing {
  max-width: 340px;
  margin: 0 auto;
}

.wf-legend {
  margin-top: var(--space-3);
}

.wf-legend td:first-child {
  color: var(--green-700);
  font-weight: 600;
  white-space: nowrap;
}

.wf-legend th,
.wf-legend td {
  padding: var(--space-1) var(--space-2);
}

.wf-legend th {
  white-space: nowrap;
}

.wf-drawing-panel .rt-hint {
  margin: var(--space-2) 0 0;
}

@media (min-width: 1000px) {
  .wf-form-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
  }

  /* Three columns throughout the form beside the rail */
  .wf-form-main .wf-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }

  .wf-rail {
    order: 0;
    position: sticky;
    top: var(--space-4);
  }
}

.rt-field .rt-input,
.rt-field .rt-select {
  width: 100%;
}

.rt-input:focus,
.rt-select:focus {
  outline: var(--focus-ring) solid var(--focus);
  outline-offset: 2px;
}

.rt-input:hover:disabled,
.rt-select:hover:disabled {
  border-color: var(--grey-100);
}

.rt-input:disabled,
.rt-select:disabled,
input.auto-filled {
  background: var(--grey-25);
  color: var(--gray-500);
  border-color: var(--grey-100);
  cursor: not-allowed;
}

/* A value and its unit read as one control. The system has no input group, so this
   joins its rt-input and rt-select. Validation messages wrap to their own line. */
.wf-unit-group {
  display: flex;
  flex-wrap: wrap;
}

.wf-unit-group .rt-input {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.wf-unit-group .rt-select {
  flex: none;
  width: auto;
  max-width: 50%;
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  background: var(--grey-25);
}

.wf-unit-group .rt-input:focus,
.wf-unit-group .rt-select:focus {
  position: relative;
  z-index: 1;
}

.wf-unit-group .error-text {
  order: 3;
  flex-basis: 100%;
  margin-top: var(--space-1);
}

/* Validation errors (classes set by script.js), following the system's Input error state */
.rt-select.is-error {
  border: 2px solid var(--coral-600);
  padding: 6px calc(var(--space-3) - 1px);
}

/* Calculate button: busy and done states. The system has none, so the button keeps its
   green fill while it works rather than showing the disabled grey. */
.rt-btn svg.wf-spin {
  animation: wf-spin 0.9s linear infinite;
}

@keyframes wf-spin {
  to {
    transform: rotate(360deg);
  }
}

#submit-btn.loading,
#submit-btn.complete {
  background: var(--green-700);
  border-color: var(--green-700);
  color: var(--white);
}

#submit-btn.loading {
  cursor: wait;
}

/* Results */
.results-section #test-status-message.hidden {
  display: none;
}

.wf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Under the results: PDF report, Add to batch and the saved-wells line */
.wf-result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wf-batch-status {
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--gray-500);
}

.table-container {
  overflow-x: auto;
}

.wf-results {
  min-width: 720px;
}

/* Reduced Diameter columns (5 to 7) only apply to stepped shanks; script.js sets is-stepped */
.wf-results:not(.is-stepped) {
  min-width: 480px;
}

.wf-results:not(.is-stepped) th:nth-child(n + 5),
.wf-results:not(.is-stepped) td:nth-child(n + 5) {
  display: none;
}

.wf-caption {
  display: block;
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  color: var(--gray-500);
}

/* The pass or fail result is the page's main output, so it reads larger than a standard alert.
   A deliberate step past the system's alert size; colors and glyphs are unchanged. */
.rt-alert.wf-verdict {
  align-items: center;
  padding: var(--space-4) var(--space-5);
  font-size: 16px;
  line-height: 24px;
}

.rt-alert.wf-verdict .glyph {
  width: 28px;
  height: 28px;
}

.rt-alert.wf-verdict .glyph svg {
  width: 14px;
  height: 14px;
}

.rt-alert.wf-verdict strong {
  font-size: 20px;
  line-height: 28px;
  margin-right: var(--space-2);
}

.wf-results td,
.wf-results th {
  vertical-align: middle;
}

.wf-results td:first-child {
  color: var(--ink);
  font-weight: 600;
}

.wf-results .wf-na {
  color: var(--gray-500);
}

/* Suggested changes */
.wf-family-link {
  margin: var(--space-2) 0 0;
  padding-top: var(--space-3);
  border-top: var(--hairline) solid var(--grey-100);
}

.suggested-changes-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.suggested-changes-section h2 {
  margin: 0;
}

#suggestions-content > p,
#suggestions-list p {
  margin: 0 0 var(--space-2);
}

#suggestions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

#suggestions-list h4 {
  margin: 0 0 var(--space-1);
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}

#suggestions-list ul {
  margin: 0 0 var(--space-2);
  padding-left: var(--space-5);
}

#suggestions-list strong {
  color: var(--ink);
}
