/* ============================================================
   style-dark.css
   Dark theme for HGI LIMS (matches login overlay)
   ============================================================ */

:root {
  --bg-main: #050510;
  --bg-panel: #11111c;
  --bg-panel-light: #181824;
  --text-main: #f5f5f5;
  --text-muted: #9a9ab3;
  --border-subtle: #27273a;
  --accent: #1e4620;
  --link: #156efd;
}

/* Base page */

body {
  font-family: sans-serif;
  margin: 2rem;
  background:
    radial-gradient(circle at top left, #182848 0, transparent 55%),
    radial-gradient(circle at bottom right, #4b6cb7 0, transparent 60%),
    #000;
  color: var(--text-main);
}

a {
  color: var(--link);
}

fieldset {
 border:1px solid rgba(255, 255, 255, 0.2);
 border-radius:4px;
 color: var(--text-muted);
}

/* Main table container */

#tableContainer {
  max-height: 85vh;  /* or whatever height makes sense */
  overflow-y: auto;
  overflow-x: auto; 
  max-width: 100%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}

#tableScroll table {
  width: 100%;
  table-layout: fixed;
}

/* Add Row overlay */

#addRowOverlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.65);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#addRowBox {
  background: var(--bg-panel-light);
  padding: 1.5rem 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
  min-width: 280px;
  text-align: center;
  position: relative;
  font-family: sans-serif;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

#addRowBox h3 {
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  padding: 8px 0;
  margin: -1.5rem -2rem 1rem;
  border-radius: 10px 10px 0 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

#addRowBox .add-row-input {
  width: 95%; /* A bit wider to accommodate the select arrow */
  padding: 8px;
  margin: 6px 0 12px 0; /* Add a bit more bottom margin for spacing */
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 1rem;
  color: var(--text-main);
  background: #05050b;
  text-align: center;
  box-sizing: border-box; /* Ensures padding doesn't affect the final width */
}

/* --- START: Style for PIN Input --- */
#pinInput {
  width: 90%;
  padding: 8px;
  margin: 6px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 1.2rem; /* A little larger for better PIN visibility */
  color: var(--text-main);
  background: #05050b;
  text-align: center;
  box-sizing: border-box; /* Ensures padding doesn't affect the final width */
}

#pinInput::placeholder {
  font-style: italic;
  color: #666a80;
}
/* --- END: Style for PIN Input --- */

/* Keep the italic placeholder style only for text inputs */
#addRowBox input.add-row-input {
  font-style: italic;
}

/* Tables */

table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  background: var(--bg-panel);
  color: var(--text-main);
}

th, td {
  border: 1px solid var(--border-subtle);
  padding: 4px 6px;
  font-size: 0.9rem;
}

th {
  background: #202036;
  position: sticky;
  top: 0;
  color: var(--text-main);
}

td[contenteditable] {
  background: var(--bg-panel);
}

td[data-column="date_ymd"],
td[data-column="update_date"] {
  white-space: nowrap;
}

tr:nth-child(even) td {
  background: #171727;
}

td.saving {
  background: #2b2614;
}

td.saved {
  background: #1c2a18;
}

td.error {
  background: #3a1515;
}

tr.flash-success td {
  background-color: #1c2a18 !important;
}

tr.flash-error td {
  background-color: #3a1515 !important;
}

td:focus {
  outline: 2px solid var(--accent);
  background: #232341;
}

/* --- Dataroom-style login overlay for LIMS --- */
#userOverlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Dark gradient background like the dataroom */
  background:
    radial-gradient(circle at top left, #182848 0, transparent 55%),
    radial-gradient(circle at bottom right, #4b6cb7 0, transparent 60%),
    #000;
  /* Scoped design tokens */
  --bg-card: rgba(10, 10, 18, 0.92);
  --text-main: #f5f5f5;
  --text-muted: #a0a0b3;
  --accent: #0d6efd;
  --border-subtle: #26263a;

  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Container and two-column layout */
#userOverlay .shell {
  max-width: 900px;
  width: 100%;
  padding: 1.5rem;
  z-index: 10; 
}

#userOverlay .login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
}

/* Brand panel (left) */
#userOverlay .brand-panel {
  padding: 2rem 2.5rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(5,5,15,0.95), rgba(10,20,40,0.98));
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
}

#userOverlay .brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

#userOverlay .brand-logo img {
  height: 40px;
  display: block;
}

#userOverlay .brand-name {
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#userOverlay .brand-panel h1 {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  font-weight: 500;
}

#userOverlay .brand-panel p {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 26rem;
}

/* Pill + highlights */
#userOverlay .brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.1);
  color: var(--accent);
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

#userOverlay .brand-pill .dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #2ecc71;
}

#userOverlay .highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

#userOverlay .highlights span {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(15,15,30,0.8);
}

/* Form panel (right) */
#userOverlay .form-panel {
  background: var(--bg-card);
  border-radius: 18px;
  padding: 1.75rem 1.75rem 1.5rem;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 0 30px rgba(0,0,0,0.6);
}

#userOverlay .form-panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 500;
}

#userOverlay .form-subtitle {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Labels + PIN input + button */
#userOverlay label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

#userOverlay #pinInput {
  width: 100%;
  padding: 0.5rem 0.55rem;
  margin-bottom: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: #04040b;
  color: var(--text-main);
  font-size: 0.9rem;
  text-align: center;
  letter-spacing: 0.2em;
}

#userOverlay #pinInput::placeholder {
  letter-spacing: 0.1em;
  color: #666;
}

#userOverlay #pinInput:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(13,110,253,0.3);
}

/* Error message + sign-in button */
#userOverlay .error {
  color: #ff6b6b;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  min-height: 1.1em;
}

#userOverlay #pinLoginBtn {
  width: 100%;
  padding: 0.6rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 0.25rem;
}

#userOverlay #pinLoginBtn:hover {
  background: #0b5ed7;
}

#userOverlay .footnote {
  margin-top: 0.9rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Responsive tweaks */
@media (max-width: 800px) {
  #userOverlay .login-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  #userOverlay .brand-panel {
    margin-bottom: 1rem;
  }
}

@media (max-width: 600px) {
  #userOverlay .shell {
    padding: 1rem;
  }
  #userOverlay .brand-panel,
  #userOverlay .form-panel {
    padding: 1.25rem 1.5rem;
  }
  #userOverlay .brand-logo img {
    height: 32px;
  }
}

/* --- Here some fun ---------------*/
/* Splotches --*/
#userOverlay::before {
  content: "";
  position: fixed;
  inset: -10%;
  pointer-events: none;
  z-index: 0;

  background:
    radial-gradient(circle at 10% 15%, rgba(110, 220, 255, 0.25) 0 4px, transparent 18px),
    radial-gradient(circle at 30% 40%, rgba(110, 220, 255, 0.18) 0 3px, transparent 7px),
    radial-gradient(circle at 70% 25%, rgba(110, 220, 255, 0.2) 0 5px, transparent 23px),
    radial-gradient(circle at 85% 55%, rgba(110, 220, 255, 0.16) 0 3px, transparent 11px),
    radial-gradient(circle at 55% 75%, rgba(110, 220, 255, 0.18) 0 4px, transparent 25px),
    radial-gradient(circle at 20% 80%, rgba(110, 220, 255, 0.14) 0 3px, transparent 19px);

  filter: blur(2px);
  opacity: 0.5;
  animation: overlayBokehDrift 60s linear infinite alternate;
}

/* --- virus ---*/

.bio-sprite {
  position: absolute;
  width: 120px;
  height: auto;
  pointer-events: none;
}

@keyframes drift {
	from { transform: translate(-5%, -5%) rotate(var(--angle, 0deg)); }
	to   { transform: translate(410%, 410%) rotate(calc(var(--angle,0deg) + 640deg)); }
}

@keyframes driftB {
	from { transform: translate(0, 0vh) rotate(var(--angle, 0deg)); }
	to   { transform: translate(-25vw, -100vh) rotate(calc(var(--angle, 0deg) + 560deg)); }
}


.bio-sm  { width: 60px; opacity: 0.10; animation: drift 300s linear infinite;}
.bio-md  { width: 90px; opacity: 0.15; animation: drift 250s linear infinite;}
.bio-lg  { width: 150px; opacity: 0.30; animation: driftB 200s linear infinite;}
/* -- end userOverlay -- */

/* Hide-row button */

.hide-row-btn {
    padding: 2px 8px;
    background-color: #5b1515;
    border: 1px solid #ff9999;
    color: #ffd6d6;
    border-radius: 4px;
    cursor: pointer;
}
.hide-row-btn:hover {
    background-color: #d8000c;
    color: white;
}

/* --- Loading text --- */
.loading-text {
  text-align: center;
  padding: 2rem;
  font-style: italic;
  color: var(--text-muted);
}

/* Navbar container */
.navbar {
  overflow: hidden;
  background-color: var(--bg-panel-light);
  font-family: Helvetica, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  border-bottom: solid 1px var(--border-subtle);
  box-shadow: 0 6px 18px rgba(0,0,0,0.65);
  border-radius:6px;
  z-index:1;
  margin-bottom: 1rem;
}

/* Links inside the navbar */
.navbar a {
  float: left;
  font-size: 14px;
  color: var(--text-main);
  text-align: center;
  padding: 10px 16px;
  text-decoration: none;
}

.navbar a::first-letter{
  color: #f88;
}

.navbar label::first-letter{
  color: #f88;
}

/* The dropdown container */
.dropdown {
  float: left;
  overflow: hidden;
}

/* Dropdown button */
.dropdown .dropbtn {
  font-size: 14px;
  border: solid 1px transparent;
  outline: none;
  color: var(--text-main);
  padding: 10px 16px;
  background-color: inherit;
  font-family: inherit; /* Important for vertical align on mobile phones */
  margin: 0; /* Important for vertical align on mobile phones */
}

.dropbtn::first-letter{
  color: #f88;
}

/* Add a background color to navbar links on hover */
.navbar a:hover, .dropdown:hover .dropbtn {
    background: #232341;
    border-left:solid 1px var(--border-subtle);
    border-right:solid 1px var(--border-subtle);
}

/* Dropdown content (hidden by default) */
.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--bg-panel);
  min-width: 160px;
  border: solid 1px var(--border-subtle);
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.6);
  z-index: 1;
  margin:0px;
  padding:0px;
}

/* Links inside the dropdown */
.dropdown-content a,
.dropdown-content label,
.dropdown-content li {
  float: none;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
  font-size:14px;
  border-left: 2px solid transparent;
  cursor: pointer;
  color: var(--text-main);
}

/* Add a grey background color to dropdown links on hover */
.dropdown-content a:hover,
.dropdown-content label:hover,
.dropdown-content li:hover {
    background: #232341;
    border-left: 2px solid var(--accent);
}

.dropdown-content label:hover {
    background: #232341;
}

/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
  display: block;
}

/* --- START: Context Menu Styles --- */
.context-menu {
  position: fixed; /* Use fixed positioning */
  z-index: 1000;
  background-color: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 2px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.7);
  min-width: 150px;
  padding: 5px 0;
}

.context-menu ul {
  list-style: none;
  font-size:12px;
  padding: 0px;
  margin: 0px;
}

.context-menu ul li:not(.seperator) {
  padding: 8px 15px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-main);
}

.context-menu ul li:hover {
  background-color: #232341;
  border-left: 2px solid var(--accent);
}

.context-menu ul li.disabled {
  color: #666a80;
  cursor: not-allowed;
}

/* Prevent hover effect on disabled items */
.context-menu ul li.disabled:hover {
  background-color: var(--bg-panel);
  border-left-color: transparent;
}

.seperator{
    height: 1px;
    background: #3a3a4f;
    margin: 2px 0px 2px 0px;
}
/* --- END: Context Menu Styles --- */

#searchQuery {
   border-radius:6px;
   height:22px;
   background-color: #fff0;
   color:#fff;
}

#searchField {
  background-color: var(--bg-panel-light);
  color: var(--text-main);
  font-size:1rem;
  height:34px;

  border-radius:6px;
}


/* --- START: In-Cell Select Styles --- */
td select.cell-select {
    width: 100%;
    border: none;
    background-color: transparent;
    font-size: 0.9rem;
    padding: 2px;
    cursor: pointer;
    color: var(--text-main);
}

td select.cell-select:focus {
    outline: 1px solid var(--accent);
}
/* --- END: In-Cell Select Styles --- */

/* --- START: Box Overview Modal Styles --- */
#boxViewOverlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); z-index: 1000; display: none; /* Hidden by default */
  justify-content: center; align-items: center;
}

#boxViewBox {
  background: var(--bg-panel-light);
  padding: 1.5rem 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7); 
  min-width: 450px;
  text-align: center; position: relative; font-family: sans-serif;
  max-height: 80vh; 
  max-width: 70vh;
  display: flex; 
  flex-direction: column;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

#boxViewBox h3 {
  background: var(--bg-panel-light);
  color: #fff;
  font-size: 1.2rem;
  padding: 8px 0;
  margin: -1.5rem -2rem 1rem;
  border-radius: 10px 10px 0 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

#boxViewContent {
  overflow-y: auto; /* Make the list of boxes scrollable */
  text-align: left;
}

#boxViewContent table {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
}

#boxViewContent th, #boxViewContent td {
   border: 1px solid var(--border-subtle);
   padding: 8px;
   text-align: center;
}

#boxViewContent th {
    background-color: #202036;
    color: var(--text-main);
}

#boxViewBox button {
   margin-top: 1.5rem;
   align-self: center;
}

/* --- close button --- */
.close-btn {
    position: absolute;
    top: 5px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease-in-out;
}

.close-btn:hover {
    color: #fff;
}
/* --- END: Box Overview Modal Styles --- */

/* --- START: Box Display Modal (9x9 Grid) Styles --- */
#boxDisplayOverlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); z-index: 1001; /* Higher z-index */
  display: none;
}

#boxDisplayBox {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-panel-light);
  padding: 1.5rem 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7); 
  width: 420px; /* Fixed width for a 9x9 grid */
  text-align: center; font-family: sans-serif;
  display: flex; 
  flex-direction: column;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

#boxDisplayBox h3 {
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  padding: 8px 0;
  margin: -1.5rem -2rem 1rem;
  border-radius: 10px 10px 0 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

#boxDisplayGridContainer {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 4px;
    margin: 1rem auto;
}

.grid-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
}
.grid-circle.open {
    background-color: transparent;
    border: 2px solid #4F46E5;
    color: #c7d2ff;
}
.grid-circle.filled {
    background-color: #4F46E5;
    border: 2px solid #4F46E5;
    color: white;
}
/* --- END: Box Display Modal (9x9 Grid) Styles --- */
