* {
  font-family: Arial, Helvetica, FreeSans, sans;
  box-sizing: border-box;
}

#top {
  padding: 0px 10px 10px 10px;
  height: 100vh;
}

.redText {
  color: red;
}

.greenText {
  color: green;
}

.explanation {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  font-style: oblique;
  font-size: 1em;
  min-height: 2em;
}

.box {
  border: 2px solid #999;
  padding: 7px;
  -moz-border-radius: 7px;
  -webkit-border-radius: 7px;
}


.columnContainer::after {
  content: "";
  clear: both;
  display: table;
}

.column {
  width: 50%;
  padding: 10px;
  float: left;
}

.valid {
  border-color: green;
}

a {
  cursor: pointer;
  color:  #0020C2;
  border-width: 1px;
  border-bottom-style: solid;
}

a:hover {
  color: green;
}

a:active {
  color: white;
  background: #0020C2;
}

h1 {
  font-weight: lighter;
  text-align: center;
  font-size: 1.5em;
}

h2 {
  margin: -7px -7px 3px -7px;
  text-align: center;
  font-size: 1.2em;
  color: white;
  background: #0020C2;
}

p {
  font-size: 0.8em;
}

span {
  display: flex; /* 2. display flex to the rescue */
  flex-direction: row;
}

label {
  display:block;
  font-size: 0.9em;
}

input {
  font-size: 0.8em;
  border-style: solid;
  border-width: 1px;
  background-color: white;
  border-color: red;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
}

input:disabled {
  border-color: pink;
}

input:focus {
  background-color: lightgray;
  outline: none;
}

select {
  display:block;
  font-size: 0.8em;
  border-style: solid;
  border-width: 1px;
}

input[type=button].valid {
  background: lightgreen;
}

button {
  width: 10%;
  font-size: 0.8em;
  margin: 0.75em;
  vertical-align: middle;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  border: 1px solid #999;
  -moz-border-radius: 7px;
  -webkit-border-radius: 7px;
}

button.valid {
  background-color: #4CAF50; /* Green */
}

/* Tab styles - blend with table header */
.tabs {
  display: none; /* Hidden by default */
  margin: 0;
  padding: 0;
}

.tab-button {
  background: #f2f2f2;
  border: 1px solid #999;
  border-bottom: none;
  padding: 8px 20px;
  cursor: pointer;
  margin-right: 2px;
  border-radius: 5px 5px 0 0;
  font-size: 0.9em;
  color: #333;
  min-width: 60px;
  text-align: center;
  display: flex; /* Use flexbox for better centering */
  align-items: center; /* Center vertically */
  justify-content: center; /* Center horizontally */
}

.tab-button:hover {
  background: #e6e6e6;
}

.tab-button.active {
  background: #f2f2f2;
  color: #333;
  border-color: #999;
  border-bottom: 1px solid #f2f2f2;
  margin-bottom: -1px;
  z-index: 2;
  position: relative;
}

/* Table container for scrolling */
.table-container {
  max-height: 250px; /* Even smaller to ensure scrolling with fewer rows */
  overflow-y: auto;
  border: 1px solid #999;
  border-radius: 0 4px 4px 4px;
  display: none; /* Hide by default */
}

/* Show table container when it has content */
.table-container:has(.table thead) {
  display: block;
}

/* Alternative approach if :has() isn't supported */
.table-container.visible {
  display: block;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9em;
}

.table th {
  background: #f2f2f2;
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: bold;
  font-size: 0.9em;
}

/* Right-justify the Date column (first column) */
.table th:nth-child(1),
.table td:nth-child(1) {
  text-align: right;
}

/* Right-justify the Amount column (second column) */
.table th:nth-child(2),
.table td:nth-child(2) {
  text-align: right;
}

.table td {
  padding: 8px;
  border-bottom: 1px solid #ddd;
  font-size: 0.9em;
}

.table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.table tbody tr:hover {
  background-color: #f5f5f5;
}

/* When tabs are visible, adjust table container border */
.tabs:not([style*="display: none"]) + .table-container {
  border-top: none;
  border-radius: 0 0 4px 4px;
}
