/* Gardenia Lab — patient results module. Shared by index.html, reference.html and results.html. */
:root {
  --results-red: #ad0018;
  --results-dark: #73000e;
  --results-gold: #d5a12d;
  --results-ink: #35141a;
  --rail-safe-offset: 56px;
}

.patient-results {
  background: linear-gradient(155deg, #fffaf4 0%, #fff 54%, #fff8f2 100%);
  padding-top: clamp(32px, 6vw, 84px);
  padding-bottom: clamp(36px, 6.5vw, 90px);
  padding-right: max(16px, calc((100vw - 1320px) / 2));
  padding-left: max(var(--rail-safe-offset, 56px), calc((100vw - 1320px) / 2));
  color: var(--results-ink);
  scroll-margin-top: 20px;
}

.results-panel {
  max-width: 1220px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(24px, 4.5vw, 44px);
  align-items: center;
}

.results-copy {
  min-width: 0;
}

.results-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #ad0018;
  font-size: clamp(13px, 1.5vw, 17px);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.results-kicker::before {
  content: "";
  width: 27px;
  height: 3px;
  background: linear-gradient(90deg, #b27e11, #f6d878);
  border-radius: 10px;
  flex-shrink: 0;
}

.results-copy h2 {
  font-size: clamp(26px, 5.2vw, 56px);
  line-height: 1.25;
  color: #ad0018;
  margin: clamp(10px, 2vw, 18px) 0;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.results-copy h2 em {
  font-style: normal;
  color: #b38b28;
}

.results-copy p {
  font-size: clamp(14px, 1.6vw, 19px);
  color: #624b4a;
  line-height: 1.85;
  margin: 0 0 18px;
  max-width: 580px;
}

.results-points {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
  color: #5a3a3c;
  font-size: clamp(13.5px, 1.4vw, 16px);
  line-height: 1.6;
}

.results-points li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.results-points .tick {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border-radius: 100%;
  background: #fff1d6;
  color: #a60017;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 15px;
}

.results-access {
  background: #fff;
  box-shadow: 0 14px 46px #65001114;
  border: 1px solid #f1dfe0;
  border-top: 4px solid #c39934;
  border-radius: clamp(16px, 2.5vw, 25px);
  padding: clamp(18px, 4vw, 38px);
  min-width: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.results-access::after {
  content: "";
  position: absolute;
  left: -65px;
  top: -65px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, #faeabf84, transparent 70%);
  pointer-events: none;
}

.results-access h3 {
  font-size: clamp(20px, 2.6vw, 30px);
  color: #a80019;
  margin: 0 0 6px;
  font-weight: 900;
}

.results-access .description {
  font-size: clamp(13px, 1.4vw, 15px);
  color: #7b6667;
  margin: 0 0 20px;
  line-height: 1.75;
}

.results-field {
  margin: 0 0 16px;
  position: relative;
}

.results-field label {
  display: block;
  font-size: clamp(14px, 1.4vw, 15px);
  font-weight: 800;
  color: #552e32;
  margin-bottom: 8px;
}

.results-field input {
  display: block;
  width: 100%;
  background: #fff;
  border: 1.5px solid #e6d5d4;
  border-radius: 12px;
  padding: 13px 16px;
  font: inherit;
  font-size: 16px;
  color: #35141a;
  outline: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
  direction: ltr;
  text-align: right;
  min-height: 54px;
}

.results-field input:focus {
  border-color: #b28827;
  box-shadow: 0 0 0 3px #d9ab382b;
}

.results-field input::placeholder {
  color: #a39494;
  font-size: 14px;
  text-align: right;
}

.results-password-box {
  position: relative;
}

.results-password-box input {
  padding-left: 78px;
  padding-right: 16px;
}

.results-toggle {
  position: absolute;
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 44px;
  min-width: 64px;
  padding: 0 12px;
  border: 0;
  background: #fff1e3;
  border-radius: 9px;
  color: #920019;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.results-toggle:hover {
  background: #fde5cc;
}

.results-primary {
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(95deg, #920013, #c00020);
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 900;
  box-shadow: 0 5px 18px #ad00172d;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  transition: filter 0.2s, transform 0.15s;
}

.results-primary:hover {
  filter: brightness(1.07);
}

.results-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.results-meta {
  font-size: 12px;
  color: #8b7373;
  line-height: 1.75;
  margin: 14px 0 0;
}

.results-message {
  font-size: 14px;
  line-height: 1.75;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 14px 0 0;
  background: #faf2ec;
  color: #7b3c12;
  border: 1px solid #efd9c5;
}

.results-message:empty {
  display: none;
}

.results-message[data-type="error"] {
  background: #fff2f1;
  color: #a31521;
  border-color: #edc3c7;
}

.results-message[data-type="success"] {
  background: #eef9f1;
  color: #155a33;
  border-color: #c9e6d1;
}

.results-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  color: #970019;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  margin: 10px auto 0;
  cursor: pointer;
  font-size: clamp(12.5px, 1.3vw, 14px);
  text-align: center;
}

.results-access button:focus-visible,
.patient-results button:focus-visible,
.patient-results a:focus-visible {
  outline: 3px solid #b18a24;
  outline-offset: 3px;
}

.results-viewer {
  max-width: 1220px;
  margin: 32px auto 0;
  padding: clamp(16px, 3vw, 30px);
  background: #fff;
  border-radius: clamp(16px, 2.2vw, 22px);
  border: 1px solid #eadbce;
  box-shadow: 0 12px 35px #40000512;
}

.results-viewer[hidden] {
  display: none;
}

.results-viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.results-viewer-top h3 {
  margin: 6px 0 4px;
  color: #a00016;
  font-size: clamp(20px, 2.5vw, 26px);
}

.results-demo-label {
  font-weight: 800;
  font-size: 12px;
  background: #fff0ce;
  color: #784a00;
  border-radius: 30px;
  padding: 6px 12px;
  display: inline-block;
}

.results-viewer-top .results-clear {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dfb9b5;
  border-radius: 10px;
  background: #fff;
  color: #a30015;
  font: inherit;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
}

.results-summary {
  color: #695758;
  margin: 10px 0 20px;
  font-size: 14px;
  line-height: 1.7;
}

.results-report-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 15px;
}

.results-report {
  border: 1px solid #eee0dc;
  border-radius: 14px;
  padding: clamp(16px, 2.2vw, 20px);
  min-width: 0;
  background: linear-gradient(175deg, #fff, #fffcf9);
}

.results-report h4 {
  font-size: clamp(16px, 1.8vw, 18px);
  color: #7d0014;
  margin: 0 0 10px;
}

.results-report .approved {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #edf8f0;
  color: #166037;
  border-radius: 30px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 12px;
}

.results-report .approved.pending {
  background: #fff7e8;
  color: #8e5a09;
}

.results-test-list {
  padding: 0;
  margin: 0 0 10px;
  list-style: none;
  color: #4a3436;
  line-height: 1.75;
  font-size: 14px;
}

.results-test-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f0e9e7;
}

.results-test-list li:last-child {
  border: 0;
}

.results-test-name {
  font-weight: 700;
  word-break: break-word;
}

.results-test-value {
  white-space: nowrap;
  direction: ltr;
  text-align: left;
  color: #754b48;
  flex-shrink: 0;
}

.results-pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: #ac0018;
  border: 0;
  color: white;
  border-radius: 10px;
  padding: 10px 15px;
  font-weight: 700;
  font: inherit;
  cursor: pointer;
  margin-top: 8px;
  width: 100%;
}

.results-pdf[disabled] {
  opacity: 0.58;
  cursor: not-allowed;
}

.results-pdf:focus-visible {
  outline: 3px solid #b38b28;
  outline-offset: 3px;
}

.results-demo-disclaimer {
  color: #8c4d19;
  font-size: 13px;
  background: #fff4de;
  border-radius: 12px;
  padding: 14px 16px;
  line-height: 1.7;
  margin: 22px 0 0;
}

.results-demo-label[hidden],
.results-demo-disclaimer[hidden] {
  display: none;
}

/* Tablet layout (768px - 959px): spacious centered container */
@media (min-width: 768px) and (max-width: 959px) {
  :root {
    --rail-safe-offset: 68px;
  }
  .results-panel {
    max-width: 680px;
  }
}

/* Desktop & Landscape Tablet (960px+): side-by-side 2-column grid */
@media (min-width: 960px) {
  :root {
    --rail-safe-offset: 78px;
  }
  .results-panel {
    grid-template-columns: 1.05fr 0.95fr;
    gap: clamp(32px, 5vw, 80px);
  }
}

/* Large Desktop (1536px+) */
@media (min-width: 1536px) {
  .patient-results {
    padding-right: max(48px, calc((100vw - 1380px) / 2));
    padding-left: max(88px, calc((100vw - 1380px) / 2));
  }
  .results-panel,
  .results-viewer {
    max-width: 1320px;
  }
}

/* Small Mobile (<= 380px): optimize spacing so form fits 320px comfortably */
@media (max-width: 380px) {
  :root {
    --rail-safe-offset: 54px;
  }
  .patient-results {
    padding-right: 12px;
    padding-left: 54px;
  }
  .results-access {
    padding: 16px 14px;
    border-radius: 15px;
  }
  .results-field input {
    padding: 11px 12px;
    min-height: 48px;
    font-size: 15px;
  }
  .results-password-box input {
    padding-left: 70px;
  }
  .results-toggle {
    min-width: 58px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .results-field input,
  .results-primary {
    transition: none;
  }
}

/* ==================== LTR ADAPTATION ==================== */
html[dir="ltr"] .results-field input {
  text-align: left;
}

html[dir="ltr"] .results-field input::placeholder {
  text-align: left;
}

html[dir="ltr"] .results-password-box input {
  padding-left: 16px;
  padding-right: 78px;
}

html[dir="ltr"] .results-toggle {
  left: auto;
  right: 5px;
}

@media (max-width: 380px) {
  html[dir="ltr"] .results-password-box input {
    padding-left: 12px;
    padding-right: 70px;
  }
}

