/* Reset box sizing */
* {
  box-sizing: border-box;
}

/* Header background bar */
.header-bg {
  position: fixed;
  top: 0;
  left: 0;
  height: 80px;
  width: 100%;
  background-color: #1e1e1e; /* dark background */
  z-index: 90;
  border-bottom: 2px solid #a64dff; /* WRS purple border */
  box-shadow: 0 2px 10px rgba(0,0,0,0.7);
}

/* Nav bar fixed left */
.main-nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 80px;
  display: flex;
  align-items: center;
  padding-left: 12px;
  gap: 20px; /* base gap between links */
  background-color: transparent;
  z-index: 100;
  min-width: 240px; /* fixed width or adjust */
  max-width: 30vw; /* max width scales with viewport */
  white-space: nowrap;
  overflow: visible;
  transition: gap 0.3s ease; /* smooth gap change */
}

/* Dynamically increase gap with viewport width */
@media (min-width: 768px) {
  .main-nav {
    gap: 30px;
  }
}
@media (min-width: 1200px) {
  .main-nav {
    gap: 40px;
  }
}

/* Nav links styling */
.nav-link,
.dropbtn {
  background-color: transparent;
  border: none;
  color: #ffffffcc; /* semi-transparent white */
  font-weight: 600;
  font-size: 18px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 6px;
  transition: background-color 0.3s ease, color 0.3s ease;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover,
.dropbtn:hover {
  background-color: #a64dff; /* WRS purple */
  color: white;
}

/* Dropdown styles */
.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #1e1e1e;
  min-width: 160px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  z-index: 200;
  transition: opacity 0.3s ease;
}

.dropdown-content a {
  color: #ffffffcc;
  padding: 12px 18px;
  text-decoration: none;
  display: block;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.25s ease;
}

.dropdown-content a:hover,
.dropdown-content a:focus {
  background-color: #a64dff;
  color: #fff;
  outline: none;
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* Title container - margin to avoid overlap with nav and search */
.title-container {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
  z-index: 95;
  padding: 0 260px; /* leave space for nav on left and search on right */
  box-sizing: border-box;
  max-width: calc(100vw - 520px);
  white-space: nowrap;
}

.title-container h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 700;
  color: #ffffff;
  font-family: 'Roboto Slab', serif;
}

/* Search box fixed right */
.search-box {
  position: fixed;
  top: 20px;
  right: 0;
  height: 40px;
  width: 260px; /* fixed width */
  display: flex;
  align-items: center;
  padding: 0 16px;
  background-color: transparent;
  z-index: 100;
}

.search-box input {
  width: 100%;
  padding: 8px 10px;
  font-size: 16px;
  border-radius: 6px;
  border: none;
  outline: none;
  background-color: #ffffff;
  font-family: 'Inter', sans-serif;
  transition: box-shadow 0.3s ease;
  color: #000; /* black text */
}

.search-box input::placeholder {
  color: #000000aa;
  font-style: italic;
}

/* Main content container */
.scroll-container {
  margin-top: 80px;
  padding: 24px 32px 32px 32px;
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 80px);
  width: 100vw;
  box-sizing: border-box;
  background-color: #121212;
  padding-left: 260px; /* space for fixed nav */
  padding-right: 280px; /* space for fixed search */
}

/* Table styles */
table {
  border-collapse: collapse;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  background-color: #1e1e1e;
  border-radius: 12px;
  box-shadow: 0 0 10px #a64dff;
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  color: #ffffffcc;
}

thead th {
  top: 0;
  background-color: #121212;
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  padding: 14px 18px;
  text-align: center;
  border-bottom: 2px solid #a64dff;
  z-index: 50;
  user-select: none;
}

tbody td {
  padding: 12px 18px;
  text-align: center;
  border-bottom: 1px solid #333;
  vertical-align: middle;
  word-break: break-word;
  color: #e0e0e0;
  font-weight: 500;
  transition: background-color 0.25s ease;
}

tbody tr {
  background-color: #2a2a2a;
  transition: background-color 0.3s ease;
  cursor: default;
  border-radius: 8px;
}

tbody tr:nth-child(even) {
  background-color: #222222;
}

tbody tr:hover {
  background-color: #d6acff35;
  color: #fff;
}

/* Responsive column widths */
thead th:nth-child(1),
tbody td:nth-child(1) {
  width: 40%;
  font-weight: 600;
}

thead th:nth-child(2),
tbody td:nth-child(2) {
  width: 20%;
  font-weight: 500;
  color: #d6acff;
}

thead th:nth-child(3),
tbody td:nth-child(3) {
  width: 20%;
  font-weight: 500;
  color: #9934fd;
}

thead th:nth-child(4),
tbody td:nth-child(4) {
  width: 20%;
  font-weight: 500;
  color: #d6acff;
}

/* Scrollbar styling */
.scroll-container::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.scroll-container::-webkit-scrollbar-track {
  background: #1e1e1e;
  border-radius: 10px;
}

.scroll-container::-webkit-scrollbar-thumb {
  background: #a64dff;
  border-radius: 10px;
  border: 2px solid #1e1e1e;
}

/* Accessibility: focus styles */
.nav-link:focus,
.dropbtn:focus,
.dropdown-content a:focus,
.search-box input:focus,
tbody tr:focus-within {
  outline: 2px solid #a64dff;
  outline-offset: 2px;
  background-color: #33000088;
}

/* Mobile styles for screens smaller than or equal to 480px */
@media (max-width: 480px) {
  /* Make header content stack vertically */
  .header-content {
    flex-direction: column;
    height: auto;
    padding: 10px;
    gap: 12px;
  }

  /* Nav bar: full width, horizontal scroll if needed */
  .main-nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-left: 0;
    gap: 12px;
    max-width: 100vw;
  }

  /* Allow nav links to not wrap */
  .nav-link, .dropbtn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Dropdown content adjust for mobile */
  .dropdown-content {
    position: static; /* so it pushes content down instead of absolute */
    box-shadow: none;
    border-radius: 0;
    background-color: #2a2a2a;
    margin-top: 0;
    min-width: unset;
  }

  /* Center title smaller and with margin */
  .title-container {
    text-align: center;
    margin-top: 0;
  }

  .title-container h1 {
    font-size: 28px;
  }

  /* Search box: full width below nav */
  .search-box {
    width: 100%;
    padding: 0 10px;
  }

  .search-box input {
    font-size: 14px;
  }

  /* Optional: adjust scroll container padding */
  .scroll-container {
    margin-top: 20px;
    padding: 12px 10px 32px;
    width: 100vw;
    padding-left: 10px;
    padding-right: 10px;
  }
}
