body {
  margin: 2em;
  font-family: sans-serif;
}

/* TEXT */
h1 {
  display: inline;
  font-size: 3em;
  color: black;
}

h2 {
  font-size: 2em;
  color: black;
}

a {
  color: #7958e7;
}

a:hover, a:visited {
  color: #b881f2; 
}

ul {
  list-style: square;
}

pre, code {
  font-size: 1.1em;
  white-space: pre-wrap;
  word-break: break-word;
}

.clearlink {
  text-decoration: none;
}

.greytext {
  color: rgb(111, 111, 111);
}

.redtext {
  color: #ff5736;
  font-weight: bold;
}

.section {
  margin: 0.5em 1.5em;
}

.row {
  display: flex;
  gap: 1em;
}

.row-spaced {
  justify-content: space-between; 
  align-items: center;
  margin-bottom: 0.8em;
}

.row-right {
  justify-content: flex-end; 
  flex-wrap: wrap;
  align-items: center;
  margin: 0.5em;
  gap: 0.5em;
}

.row-left {
  justify-content: flex-start; 
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: center;
  margin-bottom: 0.8em;
}

.row-centered {
  justify-content: center; 
  flex-wrap: wrap;
  align-items: center; 
  margin-left: 1em;
}

.row-item-input {
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  flex: 1; 
  min-width: 150px;
}

.row-item-input input {
  width: 100%;
  box-sizing: border-box;
}

.row-wide {
  flex: 0.97;
  /* width: 100%; */
}

.label-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center; 
  gap: 0.2em;
}

/* ******** ELEMENTS ******** */
/* Buttons */
button {
  align-items: center;
  background: none;
  border: 1px solid darkgray;
  border-radius: 15px;
  font-size: 1em;
  /* overflow: hidden; */
  cursor: pointer;
  transition: ease 0.2s;
}
button:hover {
  background: #f0f0f0;
}

.button-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5em; 
  height: 1.5em;
  border-radius: 50%;
  line-height: 1;
}

.button-icon {
  display: flex;
  align-items: center;
  border: none;
  font-size: 0.9em;
  gap: 0.2em;
}

.button-icon:hover {
  background: none;
  transform: scale(1.05);
} 

.tag {
  display: inline-block;
  align-items: center;
  padding: 0.3em 0.5em;
  border: 1.5px solid;
  border-radius: 25px;
  opacity: 0.6;
  font-size: 0.9em;
  overflow: hidden;
  cursor: pointer;
  transition: ease 0.2s;
}

/* Select */
.select {
  position: relative;
  display: inline-block;
}

.select-options {
  display: none; 
  position: absolute;
  width: 100%;
  top: 100%;
  z-index: 10;
  margin-top: 0.5em;
  padding: 0;
  background: white;
  border: 1px solid darkgray;
  border-radius: 10px;
  list-style: none;
  overflow: hidden;
}

.select-options li {
  padding: 0.5em;
  font-size: 1em;
  cursor: pointer;
}

.select-options li:hover {
  background: #f0f0f0;
}

/* Input */
input {
  transition: ease 0.2s;
}

input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle; /* Aligns checkbox center with text */ 
  line-height: 1;
  border: 1.5px solid darkgray;
  border-radius: 25px;
}

input[type="checkbox"]::before {
  position: absolute;
  width: 100%;
  height: 100%;
  text-align: center;
  white-space: pre;
  content: " ";
}

input[type="checkbox"]:checked::before {
  color:#ff5736;
  font-weight: bold;
  content: "\2713";
}

textarea, input[type="text"], input[type="date"], input[type="number"], .tagify {
  appearance: none;
  align-items: center;
  padding: 0.5em 1em;
  border: 1px solid darkgray;
  border-radius: 5px;
  font-size: 0.9em;
  gap: 0.2em;
}

textarea {
  width: 100%;
  min-height: 150px;
  max-height: 600px;
}

input[type="text"]:focus, input[type="date"]:focus, input[type="number"]:focus, .tagify--focus {
  outline: 2px solid lightgray;
  box-shadow: 0 0 5px #f0f0f0;
}

.tagify__tag, .tagify__input {
  margin: 0;
}

/* ******** FEATURES ******** */
/* Dataset display */
.data-display {
  flex: 1; /* Display takes up remainder of screen width */
}

/* Search */
.search {
  display: inline-flex;
  width: 100%;
  align-items: center;
  border: 1px solid darkgray;
  border-radius: 25px;
  overflow: hidden;
}

#search-type {
  display: flex;
  flex: 0 0 auto;
  height: 3em;
  width: 3em;
  align-items: center;
  justify-content: center;
  border: none;
  border-right: 1px solid darkgray;
  border-radius: 0;
  background: lightgray;
}

#search-type:hover {
  background: darkgray;
}

.search-bar {
  flex: 1 1 auto;
  border: none;
  outline: none;
  min-width: 0;
}

#search-submit {
  width: 2em;
  height: 2em;
  margin-right: 0.6em;
  background: black;
  border: none;
  opacity: 0.5;
}

#search-submit:hover {
  opacity: 1;
}

.search-bar, .sort-button {
  height: 3em;
  padding: 0 1em;
  font-size: 1em;
}

/* Sort */
#sort-group {
  display: inline-flex;
  border: 1px solid darkgray;
  border-radius: 25px;
  overflow: hidden;
}

#sort-value {
  min-width: 125px;
  border: none;
  border-right: 1px solid darkgray;
  border-radius: 0;
}

#sort-direction {
  text-align: center;
  border: none;
  border-radius: 0;
}

/* Filter */
#filters {
  width: 250px;
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2em;
  margin-bottom: 0.5em;
}

.filter-tag:hover, .filter-tag.checked {
  border-width: 2.5px;
  opacity: 1;
}

/* Tag Colors */
.tag-annotation {
  background: #d1fcbb; 
  border-color: #48c908;
}

.tag-category {
  background: #fcc6bb; 
  border-color: #f54927;
}

.tag-format {
  background: #e6bbfc; 
  border-color: #8908c9;
}

.tag-license {
  background: #fcbbf1; 
  border-color: #c908a9;
}

.tag-modality {
  background: #bbf1fc; 
  border-color: #08a9c9;
}

.tag-date {
  background: #f1fcbb; 
  border-color: #a9c908;
}

.tag-keyword {
  background: #e0e1ec; 
  border-color: #b881f2;
}

.tag-size {
  background: #f3f3f3; 
  border-color: #868686;
}


/* Card + Tile + Box + Table */
.card {
  margin: 0.8em 0;
  padding: 1.1em;
  border: 1px solid darkgray;
  border-radius: 25px;
  cursor: pointer;
}

.card-title {
  font-size: 1.1em;
  font-weight: bold;
}

.card:hover {
  background: #f0f0f0;
}

.card:hover .card-title {
  color: #ff5736;
}

.tile {
  flex: 1;
  margin: 1em 0;
  padding: 1em 3em 2em 3em;
  border: 1px solid darkgray;
  border-radius: 25px;
  overflow: hidden;
}

.tile-label {
  margin-right: 0.1em;
  font-weight: bold;
}

#boxes-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
}

.box {
  display: flex;
  flex-direction: column;
  align-self: flex-start; /* Each box keeps its own height */
  position: relative; 
  border: 1px solid darkgray;
  border-radius: 5px;
  max-width: 400px;
  min-width: 400px;
}

.box-title {
  width: inherit;
  max-height: 35px;
  padding: 0.25em 1em;
  font-weight: bold;
  background: #f0f0f0;
  border-radius: 5px !important;
  border: none !important;
}

.box-section {
  padding: 0.75em 1em;
  border-top: 1px solid darkgray;
}

.box-section .section-title {
  font-weight: bold;
}

.field-kv {
  display: flex;
  gap: 0.3em; /* Space between key and value */
  flex-wrap: wrap;
}

.field-kv:has(input) {
  display: grid; /* Stack key and value on top of each other instead of side by side */
  width: 100%;
}

.box-field .field-key {
  font-weight: bold;
  min-width: 100px; 
  flex: 0.3;
}

.box-field .field-value {
  flex: 1;
}

.field-value.box-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1em;
}

.field-value.box-chart {
  justify-content: center; 
  align-items: center;
  width: 100%;  
  width: 100%;  
  min-width: 350px;
  margin: 1.5em 0;
  gap: 1em; 
}

.box-field button, #widget-button {
  height: 2em;
  align-items: center;
}

#widget-button {
  width: 75px;
  padding: 0.3em 0.7em;
  text-align: left;
  background: #f0f0f0;
}

.box-input {
  flex: 1;
  min-width: 0;
}

.box-button {
  padding: 0.5em 0.75em;
  border: none;
  border-radius: 5px;
  font-size: 0.8em;
}

.add-button, .edit-button {
  background: #4a90e2;
  color: white;
}

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

.square-input {
  border-radius: 5px 5px 0 0 !important;
  border: none !important;
}

.chart-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-top: 1em;
}

.chart-editor-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.chart-editor-row {
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.chart-editor-row .label-input {
  flex: 2;
}

.chart-editor-row .value-input {
  flex: 1;
}

table {
  border-collapse: separate; 
  border-spacing: 0; 
  overflow: hidden;
  width: 100%; 
  font-family: sans-serif;
  border: 1px solid darkgray;
  border-radius: 5px; 
}

table td.field-key {
  width: 30%;
  background: #f0f0f0; 
  border-right: 1px solid darkgray;
  font-weight: bold;
}

table td.field-key, table td.field-value {
  padding: 0.3em 0.7em;
}

table .td-button {
  width: 4%;
}

table .td-handle {
  padding-left: 1em;
  width: 1%;
  background: #f0f0f0; 
}

table td {
  border-bottom: 1px solid darkgray;
}

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

.table-input {
  border: 0 !important;
  background: inherit;
}

/* Miscellaneous */

.dataset-links {
  display: flex;
  flex-wrap: wrap;
  justify-items: space-around;
  align-items: center;
  gap: 1.5em; 
}

.dataset-links a {
  display: flex;
  flex-direction: column;   
  align-items: center;   
  text-decoration: none;
}

.blank-msg {
  padding: 1em 0;
  color: #ff5736;
  font-weight: bold;
}

#submit-button, #cancel-button {
  font-size: 1em;
}

.table-head {
  margin: 0.5em;
  gap: 0.5em;
}

.page-alert {
  display: flex;
  gap: 0.5em;
  padding: 0.5em;
  border-radius: 5px;
  background: #ff5736;
  color: white;
}

.about-button {
  display: inline-block;
  position: relative;
  text-align: left;
  padding: 0.75em 1em;
}

.about-popup {
  position: absolute;
  top: 0;
  right: 100%; /* Start hidden to the left */
  width: 1100px;
  padding: 1em;
  border: 1px solid lightgray;
  border-radius: 15px;
  box-shadow: 0 4px 20px lightgray;
  background: white;
  line-height: 1.5em;
  opacity: 0;
  transform: translateX(20px) scale(0.95);
  transition: all 0.3s ease;
  z-index: 10;
  pointer-events: none; 
}

.about-button.active .about-popup {
  opacity: 1;
  transform: translateX(-10px) scale(1);
  pointer-events: auto;
}

.drag-handle {
  cursor: grab;
  padding: 0.3em 0.6em;
}

.drag-handle:active {
  cursor: grabbing;
}