@charset "UTF-8";

/* === Reset === */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* === Base typography === */
html {
  font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 300;
  color: #414141;
  letter-spacing: 0.03rem;
}
body, html { overflow-x: hidden; }
body {
  color: #414141;
  background-color: rgba(0,0,0,0.4);
  -webkit-text-size-adjust: 100%;
}
b { font-weight: 500; color: #3e3e3e; }
a { color: #aa0f14; text-decoration: none; }
a:focus, a:hover { text-decoration: underline; }
p { margin-top: 0; margin-bottom: 1rem; }
code {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", Courier, monospace;
  padding: 10px;
  font-size: 85%;
  color: #747474;
  background-color: #f4f4ef;
  border-radius: 3px;
}
label { cursor: pointer; }
.clearfix::after { content: ""; display: table; clear: both; }

/* === Layout === */
.wrap {
  position: relative;
  width: 100%;
  backface-visibility: hidden;
  transition: transform 0.3s ease-in-out;
}
.container, .overlay {
  width: 485px;
  padding: 20px;
  margin: 5px auto;
  border: 1px solid rgba(0,0,0,0.6);
  border-radius: 15px;
  background-color: #fafaf8;
  box-shadow: 1px 2px 5px 0 rgba(0,0,0,0.55), 4px 8px 25px 0 rgba(0,0,75,0.25);
}
.app-title {
  margin: -20px auto 2px;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}
.theme-base-08 .container a { color: #aa0f14; }

/* === Data entry form === */
#entry-area { width: 440px; }
#data_entry_type {
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: 10px;
  margin-top: 0;
  margin-bottom: 0;
  padding-bottom: 8px;
  width: 440px;
  box-shadow: 1px 2px 4px 0 rgba(0,0,0,0.1), 4px 8px 12px 0 rgba(0,0,50,0.05);
}
form#enter_data_point {
  display: flex;
  justify-content: center;
  align-items: space-between;
}
form#enter_data_point > div {
  width: 470px;
  padding: 6px 15px 0 15px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  align-items: space-between;
}
form#enter_data_point > div label { grid-row: 1; text-align: center; }
form#enter_data_point > div input { grid-row: 2; }
form#enter_data_point > div button {
  grid-column: 5;
  grid-row: 1 / span 2;
  align-self: center;
  margin-left: 10px;
}
form#enter_data_point input#gray_percent,
form#enter_data_point input#L_val,
form#enter_data_point input#A_val,
form#enter_data_point input#B_val {
  font-size: 1.75rem;
  width: 75px;
}

/* Hide number spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

button#form_entry {
  color: #fafaf8;
  background-color: rgba(166,20,50,0.95);
  font-size: 1.15rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  border: none;
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.05);
}
button#form_entry:hover {
  background-color: rgba(166,20,50,1);
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.3), 0 6px 20px 0 rgba(0,0,0,0.1);
}

/* === Canvas / spline editors === */
#canvas_container {
  position: relative;
  width: 440px;
  height: 508px;
  display: flex;
  justify-content: center;
}
.splineCell {
  padding: 10px 20px;
  width: 440px;
  height: 459px;
  margin: 10px auto 20px;
  position: relative;
  border: 1px solid rgba(0,0,0,0.3);
  border-bottom-width: 3px;
  border-bottom-color: rgba(0,0,0,0.5);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  box-shadow: 1px 2px 4px 0 rgba(0,0,0,0.1), 4px 8px 12px 0 rgba(0,0,50,0.05);
}
.splineCell canvas {
  display: block;
  margin: auto auto 20px;
  z-index: 2;
}
#LUT { display: none; }

/* === Tab bar === */
.tab-bar {
  display: flex;
  justify-content: flex-start;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 442px;
}
button.tab {
  display: flex;
  align-items: baseline;
  padding: 10px 15px;
  border: none;
  border-top: 1px solid rgba(0,0,0,0.2);
  border-right: 1px solid rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(0,0,0,0.2);
  background-color: #fafafa;
  cursor: pointer;
  outline: none;
  font-size: 0.9rem;
  transition: background 0.3s, box-shadow 0.3s;
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 10px;
  max-height: 41px;
  filter: drop-shadow(1px 2px 4px rgba(0,0,0,0.15));
}
.tab:hover { background: #eaeaea; }
.tab.active {
  background-color: #fafafa;
  font-weight: bold;
  filter: drop-shadow(1px 2px 4px rgba(0,0,0,0.4));
  color: #aa0f14;
  font-size: 1.1rem;
  border: 1px solid #ddd;
}
.tab.inactive { background-color: #e5e5e5; color: #1105bb; }
.tab-content { display: none; background-color: #fafafa; }
.tab-content.active { display: block; }
.hidden { display: none; }
img.inline-return { height: 16px; }

/* === Output mode row === */
#output-mode-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 440px;
  margin-top: 10px;
  border: 1px solid rgba(0,0,0,0.3);
  padding: 8px 10px 10px;
  border-radius: 10px;
  box-shadow: 1px 2px 4px 0 rgba(0,0,0,0.1), 4px 8px 12px 0 rgba(0,0,50,0.05);
}
.mode-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 34%;
}
.mode-label { font-size: 0.85rem; color: #616161; margin: 2px 6px 6px; }
.mode-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: rgba(166,20,50,0.95);
  color: #fafaf8;
  font-size: 0.85rem;
  border-radius: 0.5rem;
  border: none;
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.15), 0 6px 20px 0 rgba(0,0,0,0.05);
  padding: 10px 30px 10px 10px;
  margin: 0 4px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23F6EDED' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}
.mode-select:focus { outline: 2px solid rgba(128,0,0,0.35); }
.save-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 32%;
}
#saveOutput {
  color: #fafaf8;
  background-color: rgba(166,20,50,0.95);
  font-size: 0.85rem;
  border-radius: 0.5rem;
  border: none;
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.15), 0 6px 20px 0 rgba(0,0,0,0.05);
  padding: 10px 14px;
  margin: 23px 6px 2px;
  text-align: center;
  cursor: pointer;
}
.mode-select:hover, #saveOutput:hover {
  box-shadow: 0 5px 8px 0 rgba(0,0,0,0.2), 0 8px 20px 0 rgba(0,0,0,0.1);
}

/* === Bottom row === */
#next-bottom-row {
  display: flex;
  justify-content: space-between;
  width: 440px;
  margin-top: 10px;
  padding: 0;
}
#loadLabBtn {
  margin: 5px auto 0 50px;
  color: rgba(166,20,50,0.95);
  background-color: rgba(0,0,0,0.05);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: 10px;
  box-shadow: 1px 2px 4px 0 rgba(0,0,0,0.1), 4px 8px 12px 0 rgba(0,0,50,0.05);
  max-width: 100px;
  width: 85px;
  padding: 5px;
  cursor: pointer;
  line-height: 1.3;
}
#loadLabBtn:hover {
  box-shadow: 1px 2px 5px 0 rgba(0,0,0,0.4), 4px 8px 14px 0 rgba(0,0,50,0.2);
}

/* === Normalize switch === */
.switch-container { display: flex; align-items: center; margin-top: 10px; }
.switch-label { font-weight: 400; }
.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background-color: rgba(0,0,0,0.01);
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow: 0 1px 1px 0 rgba(0,0,0,0.2), 0 2px 3px 0 rgba(0,0,0,0.05);
}
.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.4s;
  border-radius: 8px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 8px; width: 8px;
  left: 2px; bottom: 2px;
  background-color: white;
  transition: 0.4s;
  border-radius: 5px;
  border: 2px solid rgba(0,0,0,0.5);
}
input:checked + .slider { left: 15px; border: none; }
input:checked + .slider:before {
  background-color: rgba(166,20,50,0.95);
  border: none;
  height: 12px; width: 12px;
  border-radius: 7px;
}
label.switch:hover {
  box-shadow: 1px 2px 5px 0 rgba(0,0,0,0.4), 4px 8px 14px 0 rgba(0,0,50,0.2);
}

/* === Help button & overlay === */
button#helpBtn {
  color: rgba(0,0,0,0.7);
  background-color: rgba(255,255,153,1);
  padding: 10px 10px 7px;
  margin: 0;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.15);
  width: 60px;
  cursor: pointer;
}
button#helpBtn:hover {
  box-shadow: 1px 2px 5px 0 rgba(0,0,0,0.4), 4px 8px 14px 0 rgba(0,0,50,0.2);
}
img.fa-icon { width: 25px; height: 25px; }

.overlay {
  background-color: rgba(250,250,146,0.95);
  height: 788px;
  position: fixed;
  top: 0;
  left: calc(50% - 243px);
  transition: opacity 0.5s ease-in-out;
  overflow: auto;
  display: none;
}
.overlay::-webkit-scrollbar { width: 10px; }
.overlay::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; margin: 5px; }
.overlay::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.4); border-radius: 10px; }
.overlay::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.6); }
#close-btn {
  position: sticky;
  top: 0; left: 85%;
  transform: translateY(-30px);
  background: rgba(0,50,250,0.6);
  color: white;
  border: none;
  padding: 10px 15px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 5px;
  width: 70px;
  text-align: center;
  z-index: 10;
}
#close-btn:hover { background: #0056b3; }
summary { font-size: 16px; font-weight: 500; color: rgba(0,0,0,0.7); transition: font-size 0.3s; }
summary:hover { font-size: 18px; color: rgba(0,0,0,0.9); }
details > details { margin-left: 25px; margin-top: 5px; }
summary ~ p { margin-top: 10px; margin-left: 15px; }
.help-box h4 ~ p { margin-top: 10px; margin-left: 15px; }

/* === Error toast === */
#customAlert {
  display: none;
  position: fixed;
  top: 350px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(255,255,153,0.5);
  color: black;
  padding: 15px;
  border: 1px solid black;
  border-radius: 5px;
  box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
  font-weight: bold;
  font-size: 18px;
}

/* === Confirmation modal === */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }
.modal-content {
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.modal-content button {
  margin: 0 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
#keepBtn { background: #4caf50; color: white; }
#revertBtn { background: #f44336; color: white; }
