/********************* general *********************/

body {
  font-family: Arial, sans-serif;
  /* margin: 40px; */
  background: #f5f5f5;
}

body.dark {
  font-family: Arial, sans-serif;
  /* margin: 40px; */
  background: #362d2d;
  color: white; /* make page text readable in dark mode */
}

header {
  background: white;
  border-bottom: 2px solid red;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  position: sticky;
  top: 0;
  z-index: 9999;
  width: 100%;
  box-sizing: border-box;
}

.dark header {
  background: rgb(53, 46, 46);
  border-bottom: 2px solid rgb(59, 43, 121);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  position: sticky;
  top: 0;
  z-index: 9999;
  width: 100%;
  box-sizing: border-box;
}

.nav-left {
  flex: 0 0 auto;
  min-width: 0;
  cursor: pointer;
}

.nav-center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.nav-right {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  white-space: nowrap;
  margin-left: 16px;
  margin-right: 16px;
}

img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 15px;
  background: white; /* keep image area white for readability */
}

/* when inside dark mode page, ensure white backing remains */
.dark img {
  background: white;
}

canvas {
  border: 1px solid black;
  background: white; /* always keep drawing surface light */
}

.card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* dark mode adjustments for containers */
.dark .card {
  background: #4a4a4a;
  color: white;
}

.dark header,
.dark .dropdown-content,
.dark .tab-area,
.dark .x-content {
  color: white;
}

.dark button {
  background-color: #555;
  color: white;
  border-color: #888;
}

.dark button:hover {
  background: #777;
}

.meta {
  color: gray;
  font-size: 14px;
}

.text-content {
  font-size: 18px;
  white-space: pre-wrap;
}

.error-message {
  color: red;
  font-size: 0.75rem;
  margin-bottom: 0px;
}

button {
  background-color: white;
  color: black;
  padding-top: 2px;
  padding-right: 6px;
  padding-bottom: 3px;
  padding-left: 6px;
  border-top-width: 2px;
  border-right-width: 2px;
  border-bottom-width: 2px;
  border-left-width: 2px;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid red;
  border-radius: 6px;
}

button:hover {
  background: gray;
  color: white;
  transform: scale(1.03);
}

input[type="text"] {
  margin-right: 4px;
  margin-bottom: 4px;
}

/********************* canvas tools *********************/

#drawingCanvas {
  max-width: 100%;
  height: auto; /* maintain aspect ratio */
}

/* buttons for pen/eraser tools */
.tool-button {
  margin-right: 4px;
  margin-bottom: 4px;
}

.tool-button.active {
  background-color: red;
  color: white;
}

/********************* dropdowns *********************/

/* surrounds the entire dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

/* surrounds only the part of the dropdown that should be revealed */
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%; /* Sit directly under button */
  right: 0; /* Align with button */
  z-index: 9999;
  background: white;
  border: 1px solid red;
  padding: 14px;
  border-radius: 6px;
  min-width: 260px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

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

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

.dropdown:has(.last-clicked) .dropdown-content {
  display: block;
}

/********************* tabs *********************/

/* contains a bunch of tabs and their contents */
.tab-area {
}

/* a tab button. Clicking it should change tabs */
.tab {
}

/* contains the content for one tab */
.tab-content {
  display: none;
}

.tab.active {
  background-color: red;
}

/********************* x buttons *********************/

/* an x button. Clicking it should hide its enclosing x-content */
.x {
  position: absolute;
  top: 8px;
  right: 12px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

/* surrounds everything that should disappear when the x is clicked */
.x-content {
  position: relative;
}

/* surrounds everything that should disappear once and for all when the x is clicked */
/* every one-time-x-conent must have a unique id */
.one-time-x-content {
}

#tree-container {
  width: 100%;
  height: 85vh;
  background-color: #000000;
  overflow: hidden;
}

.dark #tree-container {
  width: 100%;
  height: 85vh;
  background-color: #0f172a;
  overflow: hidden;
}
