/* ========================
   Base Styling
======================== */
body {
  margin: auto;
  width: 98%;
  font-size: 14px;
  line-height: 1.6;
  font-family: 'Rubik', sans-serif;
  background-color: #f8f8ef;
  color: #1e293b;
}

.parent {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(6, auto);
  grid-row-gap: 6px;
  margin: auto;
  max-width: 900px;
  padding: 10px;
}

.div1 {
  background-color: #1C3879;
  padding: 4px 8px;
  border-radius: 20px 20px 0 0;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.div2, .div4, .div5 {
  padding: 10px;
  background-color: #FAFAFA;
  border-radius: 14px;
  border-top: 3px solid #1C3879;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

h1 {
  font-size: 1.6rem;
  color: #FFFFFF;
  margin-bottom: 2px;
}
h2, h3 {
  color: #1C3879;
}
h4 {
  color: #ffffff;
  font-size: 0.75rem;
  text-align: right;
}

.header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  flex-wrap: wrap;
}

.header-title {
  flex-grow: 1;
  text-align: center;
  margin-top: -8px;
}

.header-title h1 {
  font-size: 1.3rem;
  margin: 2px 0 4px 0;
  color: #ffffff;
}

.header-title h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
}

.header-logo {
  max-height: 100px;
  width: auto;
}

.left-logo {
  max-height: 40px;
  margin-right: auto;
  background-color: white;
  padding: 10px;
  border-radius: 5px;
}

.right-logo {
  margin-left: auto;
}



/* ========================
   Input Section (div2)
======================== */
.input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

#div2-id label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e40af;
}

#div2-id input,
#div2-id select {
  font-size: 0.85rem;
  padding: 5px 8px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  max-width: 70px;
  text-align: center;
}

#get-lens-btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  background-color: #e2e8f0;
  border: 1px solid #94a3b8;
  color: #1e293b;
  cursor: pointer;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#get-lens-btn:hover {
  background-color: #cbd5e1;
  border-color: #64748b;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#get-lens-btn .btn-icon {
  font-size: 1rem;
  margin-right: 2px;
}

#confirmation {
  margin-top: 4px;
  font-size: 0.85rem;
  line-height: 1.3;
}

.conf-text {
  font-weight: 600;
  color: #1e3a8a;
}

.instructions-wrapper {
  margin-top: 4px;
}
.instructions-toggle {
  font-size: 0.75rem;
  color: #334155;
  cursor: pointer;
  text-decoration: underline;
}
.instructions-text {
  font-size: 0.75rem;
  color: #1e293b;
  margin-top: 4px;
  line-height: 1.3;
}




/* ========================
   Zone Layout & Output
======================== */
.zone-input-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 12px;
}

.zone-block, .bc-block {
  display: inline-block;
  text-align: center;
  padding: 10px;
  margin: 4px;
  min-width: 80px;
  max-width: 100px;
  border-radius: 10px;
  background-color: #e0efff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  vertical-align: top;
  min-height: 100px;
}

.zone-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
  color: #1e40af;
}

.zone-output {
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.labels-small {
  font-size: 0.75rem;
  color: #64748b;
  font-style: italic;
}

.output-curve-font {
  font-size: 1rem;
  font-weight: 500;
  color: #1e293b;
}

.sag-pair {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 6px;
}

.sag-label {
  font-size: 0.7rem;
  font-style: italic;
  color: #555;
  margin-bottom: 2px;
}

input.sag-input {
  max-width: 60px;
  font-size: 0.85rem;
  padding: 4px 6px;
}

/* Target ONLY the OR inputs by ID */
#or-sphere::-webkit-inner-spin-button,
#or-sphere::-webkit-outer-spin-button,
#or-cyl::-webkit-inner-spin-button,
#or-cyl::-webkit-outer-spin-button,
#or-axis::-webkit-inner-spin-button,
#or-axis::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#or-sphere,
#or-cyl,
#or-axis {
  -moz-appearance: textfield; /* Firefox */
}

#div2-id input.sag-input {
  max-width: 60px;
  font-size: 0.85rem;
  padding: 4px 6px;
  height: 27.2px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  text-align: center;
}

.input-row .sag-input {
  height: 27.2px;
  line-height: 1;
  font-size: 0.85rem;
  padding: 4px 6px;
  box-shadow: none;
}




/* ========================
   Section Headers & Callout
======================== */
.readout-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0 1rem;
  flex-wrap: wrap;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-title-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1C3879;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.section-subtitle {
  font-size: 0.75rem;
  font-style: italic;
  color: #64748b;
  margin: 0;
  padding: 0;
  line-height: 1;
}

.lens-readout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: bold;
  background-color: #f5f7fa;
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.lens-callout-helper-inline {
  font-size: 0.75rem;
  font-style: italic;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.8;
}

.hover-icon, .pin-icon {
  font-size: 0.75rem;
  color: #1e40af;
}

.lens-callout {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #ffffff;
  border: 1px solid #ccc;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  max-width: 600px;
  min-width: 300px;
  z-index: 1001;
  pointer-events: auto;
}

.lens-callout.active,
.lens-callout.visible,
.lens-callout.pinned {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.lens-callout-subline {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  font-family: monospace;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}

.lens-callout-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}

.lens-callout-table th,
.lens-callout-table td {
  border: 1px solid #cbd5e1;
  padding: 14px 16px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a;
  background-color: #e0efff;
}

.lens-callout-table th {
  background-color: #f0f9ff;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.lens-callout-table .width-row td {
  font-size: 0.95rem;
  font-weight: 500;
  color: #64748b;
  background-color: #f9fafb;
}

.lens-part {
  font-family: 'Rubik', sans-serif;
  white-space: nowrap;
}

.bc-part {
  color: #1e40af;
  font-weight: 700;
}

.rx-part {
  color: #0f172a;
}

.dia-part {
  color: #475569;
}

#overlay-dim {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 5;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
  pointer-events: none; 
}

#overlay-dim.active {
  opacity: 1;
  pointer-events: none;
  z-index: 1000;
}

#spherical-callout .lens-callout-table tbody tr:first-child td {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a;
  background-color: #e0efff;
}

.lens-callout-table td:first-child {
  font-size: 0.95rem;
  font-weight: 500;
  color: #64748b;
  background-color: #f9fafb;
}


/* ========================
   Reset Buttons
======================== */
.reset-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
  margin-bottom: 0;
  padding-right: 6px;
}

.reset-container button {
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  background-color: #e2e8f0;
  border: 1px solid #94a3b8;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-container button:hover {
  background-color: #cbd5e1;
  border-color: #64748b;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bottom-reset {
  display: flex;
  justify-content: center;
  margin-top: 2px;
  margin-bottom: 0;
  padding-right: 6px;
}

.footer-credit {
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: center;
  margin-top: 20px;
  padding: 10px;
  font-style: italic;
}

@media (max-width: 600px) {
  .parent {
    padding: 6px;
    overflow-x: hidden;
  }

  /* INPUT LAYOUT TWEAKS */
  .input-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
  }

  .input-row select,
  .input-row input.sag-input {
    max-width: 70px;
    font-size: 0.75rem;
    padding: 4px 6px;
    flex: 1 0 auto;
  }

  #get-lens-btn {
    font-size: 0.75rem;
    padding: 4px 10px;
    flex-grow: 1;
    margin-left: auto;
    margin-right: 0;
    margin-top: 0;
  }

  .input-row label {
    width: 100%;
    font-size: 0.75rem;
  }

  /* SUMMARY + READOUT LINE */
  .lens-readout {
    font-size: 0.75rem;
    padding: 4px 8px;
    flex-wrap: wrap;
    gap: 4px;
    line-height: 1.2;
    overflow-x: auto;
    font-family: monospace;
    justify-content: flex-start;
    max-width: 100%;
  overflow-wrap: break-word;
  display: inline-block;
  white-space: normal;
  }

  .lens-callout-subline {
    font-size: 0.9rem;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    white-space: normal;
    word-break: break-word;
  }

  .lens-callout-table td,
  .lens-callout-table th {
    font-size: 1rem;
    padding: 8px;
  }


  .zone-input-row {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
  }

  .zone-block,
  .bc-block {
    min-width: 47%;
    max-width: 48%;
    padding: 6px;
    margin: 2px;
  }

  .sag-pair {
    margin-bottom: 4px;
  }

  .output-curve-font {
    font-size: 0.95rem;
  }

  .labels-small {
    font-size: 0.7rem;
  }

  .lens-callout {
    max-width: 92vw;
    padding: 1rem;
    overflow-x: auto;
  }

  .header-flex {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .header-logo {
    max-height: 40px;
  }

  .header-title h1 {
    font-size: 1.15rem;
  }

  .header-title h4 {
    font-size: 0.7rem;
  }

  .input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
  }

  /* Flex group for label + input on one line */
  .input-pair {
    display: flex;
    flex-direction: column;
    flex: 1 1 48%;
  }

  .input-pair label {
    font-size: 0.75rem;
    margin-bottom: 2px;
  }

  .input-pair select {
    width: 100%;
    max-width: 100%;
    font-size: 0.75rem;
    height: 28px;
  }

    .readout-header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header {
    width: 100%;
  }

  .lens-readout-wrapper {
    width: 100%;
    margin-top: 4px;
  }

   .lens-callout-helper-inline {
    font-size: 0.7rem;
  }

  #summary-text {
  max-width: 100%;
  overflow-wrap: break-word;
  display: inline-block;
  white-space: normal;
}
}
