/* === Cleaned and Consolidated styles.css === */

:root {
  --primary-color: #344966;
  --accent-color: #f9aa33;
  --background-color: #f4f7f9;
  --card-background: #ffffff;
  --border-radius: 12px;
  --text-color: #2b2b2b;
  --font-stack: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --light-gray: #e6eef6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-stack);
  background-color: var(--background-color);
  color: var(--text-color);
  padding: 0 1rem;
}

.container {
  max-width: 960px;
  margin: auto;
  padding: 0.5rem 0;
}

header.header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: var(--border-radius);
}

#acculens-logo {
  width: 120px;
  height: auto;
}

header.header h1 {
  font-size: 1.25rem;
  margin: 0;
}

.title-group {
  display: flex;
  flex-direction: column;
}

header.header h1 {
  font-size: 1.4rem;
  margin: 0;
  font-weight: 700;
}

.subheader {
  font-size: 0.85rem;
  color: #ddd;
}

.logo-wrapper {
  background-color: white;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

#acculens-logo {
  width: 200px;
  height: auto;
}


.input-section {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.4rem;
  background: white;
  padding: 0.5rem 1rem;
  margin-top: 1rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  align-items: flex-end;
  justify-content: flex-start;
}

#lens-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  font-weight: 500;
  color: #555;
}

.form-group + .form-group {
  margin-left: 0.25rem;
}

/* Add larger spacing between K's and Refraction group */
#steep-K {
  margin-right: 1rem;
}


.form-group label {
  margin-bottom: 0.25rem;
  font-size: 0.7rem;
  color: #666;
}

.form-group:nth-child(6) {
  margin-left: 1rem;
}

.form-group input {
  padding: 0.3rem 0.4rem;
  font-size: 0.9rem;
  width: 72px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

button {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  margin-left: 1rem;
  transition: background-color 0.2s ease;
  align-self: center;
}

button:hover {
  background-color: #ef8f0e;
}

#generate.results:not(.visible) {
  display: none;
}

.results.visible {
  display: block;
}

/* .card {
  margin: 0 auto 1rem auto;
  padding: 0.75rem 1rem;
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: nowrap;
} */



.card {
  margin: 0 auto 1rem auto;
  padding: 0.75rem 1rem;
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: grid;
  grid-template-columns: 250px 1fr 260px; /* updated from 280px */
  gap: 1rem;
  align-items: flex-start;
}

  .card .notes {
  font-size: 0.8rem;          /* reduced from 0.85rem */
  line-height: 1.25;          /* slightly tighter */
  word-break: break-word;     /* ensures long lines don’t overflow */
}


.card h3 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.card small {
  font-weight: 400;
  color: #666;
}

.card-header-stacked {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1 1 auto;
  min-width: 240px;
}

.lens-output {
  font-size: 1.1rem;
  font-weight: 600;
  background-color: #f8fbfd;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  border: 1px solid #d6e3ec;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  text-align: center;
  margin: 0.5rem 0;
  min-width: 440px;
  max-width: 440px;
  flex: 0 0 auto;
}

.spec-group {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.confirmation-box {
  position: relative;
  background-color: #e3eef7;
  padding: 0.75rem 1rem;
  border: 1px solid #c0d7e8;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.confirmation-box div {
  margin-bottom: 0.25rem;
  white-space: nowrap;
}

.rx-line {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.rx-line .label {
  width: 100px;
  font-weight: 600;
  color: #333;
}

.rx-values.stacked {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 0.2rem 1.25rem;
  align-items: end;
  margin-top: 0.3rem;
}

.rx-header {
  font-size: 0.75rem;
  font-weight: 500;
  color: #666;
}

.rx-cell {
  font-weight: 600;
}

.rx-sub-label {
  grid-column: 1 / span 3;
  font-size: 0.8rem;
  font-weight: 400;
  color: #777;
  margin: 0.3rem 0 0.1rem 0;
  text-align: left;
  display: block;
  padding: 0.25rem 0;
  width: 100%;
}

.subheader-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: bold;
  font-size: 0.85rem;
  color: white;
}

.badge.green {
  background-color: #28a745;
}

.badge.red {
  background-color: #dc3545;
}

.reload-btn {
  background-color: #c62828;
  color: white;
  font-weight: 500;
  display: block;
  margin: 2rem auto 0;
}

.reload-btn:hover {
  background-color: #a91d1d;
}

.hidden {
  display: none;
}

.lens-toggle-header {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: #344966;
  margin-bottom: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  user-select: none;
}

.switch-style {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
}
.switch {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 16px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0;
  right: 0; bottom: 0;
  background-color: #ccc;
  transition: 0.2s;
  border-radius: 10px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #f9aa33;
}
input:checked + .slider:before {
  transform: translateX(14px);
}
.switch-label {
  font-weight: 500;
}


.chevron {
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.collapsed {
  display: none;
}

.chevron.rotate {
  transform: rotate(180deg);
}

.bitoric-spec-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}


@media (max-width: 600px) {
  .header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .input-section {
    flex-direction: column;
    align-items: flex-start;
  }
  .rx-inputs,
  .card,
  .confirmation-box {
    flex-direction: column;
    align-items: flex-start;
  }
  .card .notes,
  .card h3 {
    text-align: left;
    font-size: 1rem;
  }



  .lens-output {
    font-size: 0.95rem;
    margin: 0.5rem 0;
  }
  button {
    width: 100%;
    margin-left: 0;
  }
}

/* === End Cleaned Styles === */

/* === Enhanced Mobile Responsiveness === */
@media (max-width: 768px) {
  .input-section {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  #lens-form {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

  .form-group {
    width: 100%;
  }

  button {
    width: 100%;
    margin-left: 0;
  }

  .switch-style {
    justify-content: space-between;
  }

  .header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .logo-wrapper {
    margin-bottom: 0.5rem;
  }

  .card {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .lens-output {
    flex-direction: column;
    align-items: center;
    min-width: unset;
    max-width: 100%;
    width: 100%;
  }

  .confirmation-box {
    width: 100%;
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  .lens-output {
    flex-direction: row !important;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .confirmation-box {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
  }

  .confirmation-box .rx-line {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .confirmation-box .rx-line .label {
    min-width: 80px;
  }

  .confirmation-box .rx-line {
  flex-wrap: wrap;
  gap: 0.4rem;
}

.confirmation-box .rx-line .label {
  min-width: 80px;
  word-break: break-word;
}

.confirmation-box {
  overflow-x: auto;
  word-wrap: break-word;
  white-space: normal;
}

}

.copy-k-rx {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 0.8rem;
  color: #344966;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.copy-k-rx a {
  font-size: 0.75rem;
  font-weight: 400;
  color: #344966;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.copy-k-rx a:hover {
  text-decoration: underline;
}

.input-error {
  border: 2px solid red;
}

.tooltip {
  font-size: 0.7rem;
  color: #b00020;
  background-color: #fff3f3;
  border: 1px solid #f5c2c2;
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  margin-top: 0.3rem;
  box-shadow: 0 0 3px rgba(0,0,0,0.05);
}

.hidden {
  display: none;
}


.inline-tooltip {
  font-size: 0.75rem;
  color: #b00020;
  background-color: #fff3f3;
  border: 1px solid #f5c2c2;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 0 3px rgba(0,0,0,0.05);
  opacity: 0;
  transition: opacity 0.3s ease;
}


.inline-tooltip:not(.hidden) {
  opacity: 1;
}


.button-wrapper {
  position: relative;
  display: inline-block;
}

.floating-tooltip {
  position: absolute;
  top: 50%;
  left: 110%;
  transform: translateY(-50%);
  background-color: #fff3f3;
  color: #b00020;
  border: 1px solid #f5c2c2;
  border-radius: 6px;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.05);
  z-index: 10;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.floating-tooltip:not(.hidden) {
  opacity: 1;
}

.copy-toast {
  font-size: 0.75rem;
  color: #2e7d32;
  margin-left: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.copy-toast:not(.hidden) {
  opacity: 1;
}
