/* =========================
   Global / Layout
   ========================= */
*, *::before, *::after { box-sizing: border-box; }

#tableContainer {
  flex-grow: 1;
  overflow: auto;
  width: 100%;
  position: relative;
  background-color: white;
  padding: 0 4rem 0 2rem;
  height: calc(100vh - 2.5rem);
}

/* Sticky search bar row */
.bodySearchbar {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;

  /* one padding declaration */
  background: rgb(255, 255, 255, 0.9);
  padding: 0 4rem 0.75rem 2rem;
  color: black;

  position: sticky;
  top: 0;
  transition: transform 0.3s ease;

  /* overflow fixes for sticky+padding on mobile */
  width: auto;           /* avoid 100% + padding overflow */
  left: 0;
  right: 0;
  max-width: 100%;
  overflow-x: clip;      /* keep any accidental bleed in-bounds */
}

/* If you show the “Results showing…” block on the right */
#tableHeaderInfo {
  flex: 0 0 auto;
  white-space: nowrap;
  margin-left: .75rem;
}

#resultCount {
  color: var(--orange-color);
  font-family: montserratBold;
}

/* =========================
   Search Field — Option A
   ========================= */
.bodySearchbar .searchField,
.searchField.optionA {
  position: relative;
  display: flex;
  align-items: center;
  gap:0.5em;

  /* flex growth + shrink (prevents overflow) */
  flex: 1 1 auto;
  min-width: 0;

  /* Underline base */
  border-bottom: 2px solid #e5e5e5;

  /* Animated active line */
  background-image: linear-gradient(var(--orange-color), var(--orange-color));
  background-repeat: no-repeat;
  background-size: 0% 2px;     /* starts collapsed */
  background-position: left bottom;
  transition: background-size .25s ease, border-color .25s ease;
}
.bodySearchbar .searchField.focused,
.searchField.optionA.focused {
  background-size: 100% 2px;   /* animates to full width */
  border-color: transparent;   /* hide the grey base while active */
}

/* Input */
.bodySearchbar .searchField input#searchInput {
  flex: 1 1 auto;
  min-width: 0;                /* allow shrinking in flex */
  font-size: 2rem;
  border: 0;
  outline: 0;
  background: transparent;

}
/* Ensure any legacy bottom border is gone */
#searchInput { border-bottom: 0 !important; }

/* Hide the browser's built-in clear for <input type="search"> */
#searchInput::-webkit-search-cancel-button,
#searchInput::-webkit-search-decoration,
#searchInput::-webkit-search-results-button,
#searchInput::-webkit-search-results-decoration { display: none; -webkit-appearance: none; }
#searchInput::-ms-clear,
#searchInput::-ms-reveal { display: none; width: 0; height: 0; } /* legacy Edge */



/* Icon button */
.searchIconBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3em; height: 3em;
  border: 0;
  background: transparent;
  color: #999;
  cursor: pointer;
  border-radius: 8px;
  flex: 0 0 auto; /* never forces field width */
}


.searchIconBtn .icon {
  width: 3em;
  height: 3em;
}


@media (max-width: 1000px) {
  .bodySearchbar .searchField input#searchInput{
    font-size: 1.5em;
  }
  .searchIconBtn {  
    width: 3em; 
    height: 3em;
  }
  .searchIconBtn .icon {
    width: 3em;
    height: 3em;
  }
}

.searchField.focused .searchIconBtn { color: var(--orange-color); }





/* Tune this to match your icon button width + the gap (.5rem) */
.bodySearchbar .searchField {
  --icon-space: 3em;          /* desktop: your .searchIconBtn is 3em */
}

/* Mobile override if your icon is 2em there */
@media (max-width: 1000px) {
  .bodySearchbar .searchField { --icon-space: 2em; }
}

/* Idle caret beacon: shows only when not focused AND empty */
.bodySearchbar .searchField::after {
  content: "";
  position: absolute;
  left: 3em; /* icon width + gap */
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 2em;
  background: #999898;
  opacity: .35;
  pointer-events: none;
  display: none;
  animation: idleCaretBlink 1.05s steps(1, end) infinite;
}

/* Show it only when the field is idle (no focus & no value) */
.bodySearchbar .searchField:not(.focused):not(.has-value)::after {
  display: block;
}

@keyframes idleCaretBlink { 50% { opacity: 0; } }


/* =========================
   Table States / Action Bar
   ========================= */
.hide-on-scroll {
  transform: translateY(-100%);
  transition: transform 0.3s ease-out;
}

.actionBar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: black;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  display: flex;
  gap: 1rem;
  z-index: 10;
  transition: opacity 0.3s ease, transform 0.3s ease;
  
  
  background: #edededb8;

  background-color: rgba(255, 255, 255, 0.3); /* Semi-transparent background */
  backdrop-filter: blur(24px);                 /* Core effect */
  -webkit-backdrop-filter: blur(24px);         /* Safari support */
}
.actionBar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
}

/* =========================
   Empty State + Subtle Grid
   ========================= */
#emptyState {
  position: absolute; /* overlays within #tableContainer */
  inset: 0;
  display: none;      /* toggled via .is-visible */
  align-items: center;
  justify-content: center;
  padding: 2rem;
  pointer-events: none; /* allow scrolling through */
  color: black;
}
#emptyState.is-visible { display: flex; }

#emptyState .empty-card {
  max-width: 800px;
  width: min(90ch, 90%);
  text-align: left;
  background: white;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  padding: 1.25rem 1.5rem 1.5rem;
  box-shadow: 0 10px 35px rgba(0,0,0,.06);
}
#emptyState h2 { margin: 0 0 .25rem 0; font-size: 1.15rem; }
#emptyState .subtitle { margin: 0 0 .75rem 0; opacity: .8; }
#emptyState ul { margin: .5rem 0 0 1.25rem; display: grid; gap: .35rem; }
#emptyState .pill {
  display: inline-block;
  padding: .25rem .5rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.08);
  font-size: .9em;
  margin-right: .5rem;
}

/* Subtle grid + smooth top fade under the sticky search bar */
#tableContainer.is-empty {
  --grid-small-size: 18px;
  --grid-large-size: 108px;
  --grid-small-color: rgba(0, 0, 0, 0.04);
  --grid-large-color: rgba(0, 0, 0, 0.06);
  --grid-bg: #fff;
  --grid-fade-height: 20em; /* tune to match/search bar height */

  background-color: var(--grid-bg);

  /* 5 layers total; first is the fade */
  background-image:
    linear-gradient(to bottom, var(--grid-bg) 0%, transparent 100%),
    linear-gradient(to right,  var(--grid-small-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-small-color) 1px, transparent 1px),
    linear-gradient(to right,  var(--grid-large-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-large-color) 1px, transparent 1px);

  /* Size only the fade to the top strip height; grids tile normally */
  background-size:
    100% var(--grid-fade-height),
    var(--grid-small-size) var(--grid-small-size),
    var(--grid-small-size) var(--grid-small-size),
    var(--grid-large-size) var(--grid-large-size),
    var(--grid-large-size) var(--grid-large-size);

  background-position:
    top left,
    top left, top left, top left, top left;

  background-repeat:
    no-repeat, /* fade */
    repeat, repeat, repeat, repeat;

  transition: background-color 160ms ease, opacity 160ms ease;
}

@media (max-width: 1000px) {
  #tableContainer.is-empty { --grid-fade-height: 64px; }
}

@media (prefers-color-scheme: dark) {
  #tableContainer.is-empty {
    --grid-bg: #0b0b0c;
    --grid-small-color: rgba(255,255,255,0.05);
    --grid-large-color: rgba(255,255,255,0.08);
  }
}





/* =========================
   Table
   ========================= */
.key { display: none; }
.inline { display: inline; }

#EUTenderTable {
  border-collapse: collapse;
  color: black;
  width: 100%;
  font-size: 1rem;
}

#EUTenderTable td { padding: 1.5em 1.5em; }

#tableHead {
  text-align: left;
  height: 1em;
  top: 3em;
  color: #000;
  font-size: 1.25rem;
  padding: 0 2px 0 2px;
  transition: top 0.3s ease;
  background-color: white;
}
#tableHead.head-up { top: 0; } /* when searchbar is hidden */

#tableHead th {
  padding: 0em 1em;
  position: relative;
  cursor: pointer;
  border-spacing: 0;
}

/* Hide the desktop header row when instructed by JS */
#columnHeaders.is-hidden { display: none; }

#tableBody .spacer-row td {
  padding: 1.5em 0;  /* match sticky header height */
  border: none;
  background: transparent;
  height: 2em;
}

#tableBody td {
  vertical-align: middle;
  letter-spacing: 0.05em;
  line-height: 1.3em;
  cursor: pointer;
}

#tableBody tr {
  border-left: 2px solid white;
  border-right: 2px solid white;
}
#tableBody tr:nth-of-type(2n) {
  background: rgba(229, 229, 229, 0.5);
  border-left: 2px solid rgba(229, 229, 229, 0.5);
  border-right: 2px solid rgba(229, 229, 229, 0.5);
}
#tableBody tr:hover {
  border-left: 2px solid var(--orange-color);
  border-right: 2px solid var(--orange-color);
  font-weight: bold;
}

#tableHead th:nth-child(2) { width: 36vw; }

.expansion-row td {
  background-color: #f9f9f9;
  border-top: 1px solid #ddd;
  padding: 1em;
  font-size: 0.95em;
}

/* =========================
   Checkbox visuals
   ========================= */
.checkBox { width: 0px; }
.checkbox-wrapper {
  cursor: pointer;
  display: flex;
  align-items: center;
  width: 25px;
  height: 25px;
  border: 2px solid var(--grey-color);
  user-select: none;
}
.checkbox-wrapper.checked { border: 2px solid #ff7a00; }
.checkbox-svg { width: 100%; height: 100%; }
.checkbox-tick {
  stroke: #ff7a00;
  stroke-dasharray: 172;
  stroke-dashoffset: 172;
  transition: stroke-dashoffset 0.1s ease-in;
}
.checked .checkbox-tick { stroke-dashoffset: 0; }

/* =========================
   Mobile
   ========================= */
@media (max-width: 1000px) {
  #tableContainer {
    width: 100%;
    padding: 0;
    margin-right: 0;
  }

  .bodySearchbar {
    width: auto; /* keep */
    padding: 0 1rem 0.75rem 1rem; /* softer sides to prevent overflow */
  }

  #tableHeaderInfo { display: none; }
  #tableHead { display: none; }

  td { display: flex; padding: 1em; }
  th { display: none; }

  .key {
    display: block;
    width: 22%;
    text-align: right;
    margin-right: 3%;
    font-weight: bold;
  }
  .value {
    width: 60%;
    margin-right: 15%;
  }

  /* Remove side borders on rows to avoid tiny horizontal scroll */
  #tableBody tr { border-left: 0; border-right: 0; }

  /* Soften grid a bit on mobile */
  #tableContainer.is-empty {
    --grid-small-color: rgba(0, 0, 0, 0.035);
    --grid-large-color: rgba(0, 0, 0, 0.05);
  }

  /* Empty state layout */
  #emptyState { position: static; padding: 1rem; }
  #emptyState .empty-card { width: 100%; }
}

/* =========================
   Dark Mode for Empty Grid
   ========================= */
@media (prefers-color-scheme: dark) {
  #tableContainer.is-empty {
    --grid-bg: #0b0b0c;
    --grid-small-color: rgba(255, 255, 255, 0.05);
    --grid-large-color: rgba(255, 255, 255, 0.08);
  }
}

/* =========================
   Sidebar Expanded
   ========================= */
.sidebarExpanded #tableContainer {
  width: 100%;
  padding: 0;
  margin-right: 0;
}

.sidebarExpanded #tableHead,
.sidebarExpanded th { display: none; }

.sidebarExpanded td { display: flex; padding: 1em; }
.sidebarExpanded .key {
  display: block;
  width: 22%;
  text-align: right;
  margin-right: 3%;
  font-weight: bold;
}
.sidebarExpanded .value {
  width: 60%;
  margin-right: 15%;
}




