:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --text-color: #333;
  --border-color: #dee2e6;
  --header-bg-color: #e9ecef;
  --row-hover-bg-color: #f8f9fa;
  --box-shadow-color: rgba(0, 0, 0, 0.1);
}

body {
  font-family: 'Arial', sans-serif;
  color: var(--text-color);
}

.table-container {
  overflow-x: auto; /* Allows horizontal scrolling on small screens */
  margin: 1rem 0;
  box-shadow: 0 0.5rem 1rem var(--box-shadow-color);
  border-radius: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  background-color: #fff;
  border-radius: 0.5rem;
  overflow: hidden; /* Ensures border-radius applies to content */
}

caption {
  padding: 1rem;
  font-weight: bold;
  text-align: left;
  color: var(--primary-color);
  font-size: 1.25rem;
  background-color: var(--header-bg-color);
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--header-bg-color);
  font-weight: bold;
  color: var(--secondary-color);
  text-transform: uppercase;
  font-size: 0.875rem;
}

tr:hover {
  background-color: var(--row-hover-bg-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  table, thead, tbody, th, td, tr {
    display: block;
  }

  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  tr {
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
    border-radius: 0.5rem;
  }

  td {
    border: none;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    padding-left: 50%; /* Space for the pseudo-element label */
    text-align: right;
  }

  td:last-child {
    border-bottom: none;
  }

  td:before {
    /* For accessibility, use data-label or similar */
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 45%;
    padding-left: 0.75rem;
    font-weight: bold;
    text-align: left;
    color: var(--secondary-color);
  }
}

/* Focus styles for accessibility */
table:focus-within {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

a:focus, button:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}
