:root {
  --rmiblack: #1a1a1a;
  --rmidark-gray: #2a2a2a;
  --rmilight-gray: #bbbbbb;
  --rmi-red: #cc0000;          /* deeper true red */
  --rmi-white: #ffffff;
}

html {
  background-color: var(--rmidark-gray);
}

/* Base Body Styling */
body {
  background-color: var(--rmilight-gray);
  color: var(--rmilight-gray);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-content: center;
  flex-basis: 1 0 auto;
}

form {
  margin: .5em;
}

h1.title {
  height: 53px; margin: 0; padding-left: 0.25em; color: var(--rmi-white); font-weight: 600;
}

div.header {
  background-color: var(--rmidark-gray);
  flex-flow: stretch;
  display: flex;
  height: fit-content;
  box-sizing: border-box;
  padding: 1.2em;
  box-shadow: 0 2px 7px rgba(0,0,0,.8);
  margin-bottom: 1em;
}


h1.optic-type-heading {
  color: var(--rmi-white);
  text-align: center;
  border-radius: 6px;
  font-size: 2.5em;
  font-weight: 600;
  float: top;
  padding: 0.2em 0.2em;
  margin: 0 auto;
  background-color: black;
  width: 66vw;
  margin-bottom: 1em;
  box-shadow: 0 2px 7px rgba(0,0,0,.8);
}

.left {
  display: flex;
  height: 53px;
  overflow: clip;
}

/* Section Backgrounds */
.section {
  background-color: var(--rmidark-gray);
  padding: 1em;
  margin: 1em 0;
  border-radius: 6px;
  max-height: 60vh;
}

div.mainContent {
  height: 100%;
  overflow: scroll;
}
/* Links & Interactive Elements */
a {
  color: var(--rmiblack);
  text-decoration: none;
}
a:hover, a:focus {
  text-decoration: underline;
}

/* Buttons */
#btn {
  background-color: var(--rmi-red);
  color: var(--rmi-white);
  border: none;
  padding: 0.6em 1.2em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.2s ease;
  height: clamp(1.5em, 2.2em, 2.2em);
  margin-left: .5em;
  box-shadow: 0 2px 12px rgba(0,0,0,0.8);
}

#btn:hover {
  background-color: #a30000;
  border: 1px inset var(--rmiblack);
  box-sizing: border-box;
}

/* Inputs */
input#searchBar {
  all: unset;
  background-color: var(--rmi-white);
  color: var(--rmidark-gray);
  box-shadow: 0 2px 12px rgba(0,0,0,0.8);
  padding: 0.5em;
  border-radius: 4px;
  font-size: 1em;
  width: 25vw;
}

/* Form Labels */
label {
  display: block;
  margin: 0.5em 0 0.2em;
  color: var(--rmidark-gray);
}

form {
  display: flex;
  width: fit-content;
  margin: 0 auto;
}

#searchBarListContainer {
  position: relative;
  width: fit-content;
  z-index: 5;
  background-color: none;
}

ul#resultsDropdown {
  z-index: 15;
  position: absolute; 
  color: var(--rmi-white);
  background-color: var(--rmidark-gray);
  top: 2em;
  width: clamp(15vw, 26vw, 33vw);
  overflow-y: scroll;
  overflow-x: clip;
  padding-left: 0;
} :has(li.result) {
  max-height: 40vh;
}


ul#resultsDropdown:active:focus {
  width: clamp(20vw, 25vw, 30vw);
  font-size: 14px;
}

@media screen and (max-width: 768px) {
  ul#resultsDropdown{
    font-size: 14px;
    width: 33vw;
    position: absolute;
  }

  input#searchBar {
    width: 33vw;
    margin-bottom: 0;
  }
}

div.results-list-container {
  display: flex;
  flex-direction: column;
  flex-basis: stretch;
  align-items: center;
  color: var(--rmilight-gray);
  z-index: 0;
  padding: .5em;
  height: clamp(40vh, 60vh, 60vh);
  font-size: 1.5em;
  font-weight: 600;
}

div.results-list-container > h3 {
  width: inherit;
  margin-top: 0.5em;
  height: 100%;
}

.results-list-header {
  color: var(--rmidark-gray);
  background-color: var(--rmilight-gray);
  width: fit-content;
  position: sticky;
  top: 0;
  text-align: center;
  font-size: 1.5em;
  font-weight: 600;
  padding: 0.125em 0.25em;
  margin: 0 auto;
  border-radius: 25px;
  box-shadow: 0 1.5px 1px rgba(0,0,0,.4);
}

ul#resultsList {
  list-style: none;
  flex-basis: stretch;
  padding: 0;
  margin: 2em auto;
  height: 66vh;
  width: 60vw;
  overflow-y: scroll;
  padding: 0.25em
}

div.results-list {
  display: flex;
  flex-direction: column;
  padding: 0 25vw;
  border: 1px solid black;
  max-width: 30vw;
  align-items: stretch;
  margin: 0 auto;
}

li.result-container {
  display: flex;
  flex-direction: row;
  margin: 0.25em;
  padding: 0.25em;
  justify-content: space-between;

}

li.result-container:hover {
  background-color: var(--rmilight-gray);
  cursor: pointer;
}

div.resultdesc, div.resulttitle {
  width: fit-content;
  padding: 0;
  margin: 0;
  align-items: stretch;
}

li.result:not(:last-child)::after {
  content: "";
  display: block;
  border-bottom: 1px solid rgba(0,0,0,.9);
  margin: 0.5em 0;
}

li.result > :first-child {
  font-weight: 700;
}

li.result {
  margin: 0;
}

.result-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 18px 22px;
  cursor: pointer;
  transition: box-shadow 0.2s, background 0.2s;
}

.result-card:hover {
  background: #f0f6ff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.24);
}

.result-title {
  font-size: 1.1em;
  color: var(--rmiblack);
  font-weight: 600;
}

.result-desc {
  margin-top: 6px;
  color: var(--rmiblack);
  font-size: 0.97em;
}


.input-flex-container { 
  display: flex;
  align-content: center;
  align-items: center;
}

fieldset {
  display: flex;
  flex-direction: column;
  justify-items: center;
  align-items: center;
}

form.part-no-selector {
  margin: .5em auto;
}

div.opticType {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

h1.optic-type-heading {
  flex-basis: 1 0 auto;
  margin-top: .5em;
}

p.input-symbol {
  color: var(--rmiblack);
}

input.spec-input {
  all: unset;
  color: var(--rmiblack);
  background-color: var(--rmi-white);
  border-radius: 4px;
  box-shadow: 1px 2px rgba(0,0,0,.8);
  font-size: 1em;
  padding: .5em;
  width: 5em;
  text-align: center;
  text-transform: uppercase;
}

input.spec-input:focus-visible {
  border: 2px solid var(--rmi-red);
  outline: none;
}

input.spec-input::placeholder {
  color: var(--rmidark-gray);
  text-align: center;
}

div.opticType {
  z-index: 0;
}

div.part-no-output {
  margin: 0 auto;
}

h3#part-no-output {
  color: var(--rmiblack);
  text-align: center;
}

#substrate-submit {
  background-color: var(--rmi-red);
  color: var(--rmiblack);
  border-style: outset;
  padding: 0.6em 0.6em;
  border-radius: .5em;
  cursor: pointer;
  font-size: 1.5em;
  transition: background-color 0.2s ease;
  height: clamp(1.5em, 2.2em, 2.2em);
  margin: 0 auto;
  box-shadow: 0 2px 12px rgba(0,0,0,0.8);
  text-align: center;
  vertical-align: middle;
}

#flex-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: #888 #f0f0f0;
}

/* Chrome, Edge, Safari */
*::-webkit-scrollbar {
  width: 12px;
}
*::-webkit-scrollbar-track {
  background: #f0f0f0;
}
*::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 6px;
}

/* ----------------------------- */
/* Modernized table section      */
/* ----------------------------- */
/* TABLE WRAPPER */
div.tableWrapper {
  height: 30vh;
  overflow: auto;
  z-index: 0;
  margin: 0 auto;
  padding: 0;
  background: var(--rmilight-gray); /* same as page background */
  border-radius: 6px;               /* all 4 corners */
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* TABLE */
.table--rmiblack {
  width: fit-content;
  color: var(--rmiblack);
  border-collapse: collapse; /* clean grid */
  border-spacing: 0;
  background: var(--rmi-white);
  border: 1px solid var(--rmilight-gray); /* full perimeter */
}

.table--rmiblack th,
.table--rmiblack td {
  border: 1px solid var(--rmilight-gray); /* thin inner gridlines */
  padding: 0.5rem 0.75rem;
  text-align: left;
}

/* CAPTION */
.table--rmiblack caption {
  color: var(--rmiblack);
  caption-side: top;
  padding: 0.4rem 0;
  font-weight: 600;
}

/* STICKY HEADER */
table.table--rmiblack.table--sticky { --h1: 40px; }

.table--rmiblack thead th {
  position: sticky;
  top: 0; 
  z-index: 15;
  background: var(--rmi-white);
  font-weight: 600;
  box-shadow: 0 1px 0 var(--rmilight-gray);
}

/* row 2 headers if needed */
.table--rmiblack.table--sticky thead tr:nth-child(2) th {
  top: var(--h1);
  z-index: 15;
  background: var(--rmi-white);
}

/* LINKS */
.table--rmiblack a {
  color: inherit;
  text-decoration-color: currentColor;
}

/* SCROLLBAR (Chrome, Edge, Safari) */
div.tableWrapper::-webkit-scrollbar {
  width: 12px;
}
div.tableWrapper::-webkit-scrollbar-track {
  background: var(--rmilight-gray); /* same as wrapper/page */
  border-radius: 6px;
  margin-bottom: 4px; /* gap at bottom so radius shows */
}
div.tableWrapper::-webkit-scrollbar-thumb {
  background-color: #666;
  border-radius: 6px;
  border: 3px solid var(--rmilight-gray); /* floaty handle */
}

/* Firefox */
div.tableWrapper {
  scrollbar-width: thin;
  scrollbar-color: #666 var(--rmilight-gray);
}

/* BUTTON */
#substrate-submit {
  background-color: var(--rmi-red);
  color: var(--rmi-white);
  border: none;
  padding: 0.6em 0.9em;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2em;
  transition: all 0.2s ease;
  height: 2.4em;
  width: 2.4em;
  margin: 0.75em auto;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

#substrate-submit::before {
  content: "→";
  font-weight: bold;
}

#substrate-submit:hover {
  background-color: #a41f1f; /* deeper hover red */
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.hidden {
  display: none;
}

ul#resultsList {
  border: 1px solid var(--rmiblack);
  border-radius: 2px;
  background-color: white;
}

#flex-container .tableWrapper table.substrate-table > thead:last-of-type {
 background-color: var(--rmi-white); width: fit-content; height: fit-content;
}
