/* Basic reset and typography */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
  color: #333;
  background-color: #f9f9f9;
  padding: 1rem;
}

.sizeS {
  max-width: 800px;
  margin: 0 auto;
}

.sizeM {
  max-width: 1024px;
  margin: 0 auto;
}

.sizeL {
  max-width: 1980px;
  margin: 0 auto;
}

/* Top navigation bar */
nav {
  background-color: #008000;
  padding: 0.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: start;
}

nav a {
  color: #fff;
  text-decoration: none;
  margin-right: 1.5rem;
  font-weight: 600;
  font-size: 1rem;
  transition: opacity 0.2s ease-in-out;
}

nav a:hover {
  opacity: 0.8;
}

/* Container */
.container {
  padding: 2rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Headings */
h1 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  text-align: center;
}

/* Form styling: always single-column */
form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

label {
  font-weight: 600;
  display: block;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #008000;
  box-shadow: 0 0 0 2px rgba(0, 128, 0, 0.2);
}

/* Checkbox styling */
input[type="checkbox"] {
  transform: scale(1.2);
  margin-right: 0.5rem;
}

/* Drop Down styling */
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  background-color: #fff;
  appearance: none; /* removes OS default arrow */
  background-image: url("data:image/svg+xml;utf8,<svg fill='gray' height='18' viewBox='0 0 24 24' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1em;
}

select:focus {
  border-color: #008000;
  box-shadow: 0 0 0 2px rgba(0, 128, 0, 0.2);
  outline: none;
}

/* Button */
button {
  padding: 0.75rem 1.5rem;
  background-color: #008000;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
  justify-self: start;
}

button:hover {
  background-color: #006400;
}

/* Success message */
.success {
  color: #155724;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  text-align: center;
}

/* Table styling with horizontal scroll */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  table-layout: auto; /* allow natural widths */
}

th,
td {
  padding: 4px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid #e1e1e1;
}

th {
  background-color: #f4f4f4;
  font-weight: 600;
}

/* Sortable tables, see table-sort.js */
th.sortable-column {
  cursor: pointer;
}

th.asc::after {
  content: " ▲";
}

th.desc::after {
  content: " ▼";
}

/* Clickable table rows */
.table-wrapper table tbody tr {
  cursor: pointer;
}

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

/* Highlight table row */
.highlighted-row {
  background-color: #ffffcc !important;
  border: 2px solid #ffcc00;
}

.circumstance-row,
.symptom-row,
.measure-row,
.tag-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.add-button {
  background-color: #008000;
  color: white;
}

.remove-button {
  background-color: #b22222;
  color: white;
}

.add-button,
.remove-button {
  padding: 0.4rem 0.8rem;
  font-size: 1rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row label {
  flex: 1;
  min-width: 200px;
}

.table-wrapper table td:last-child {
  width: 100%; /* this makes the bar column take all leftover space */
}

.bar {
  background-color: steelblue;
  height: 20px;
  border-radius: 4px;
}

th.number, td.number {
  text-align: right !important;
  padding-right: 10px;
}
