/* ==== CSS Variables ==== */
:root {
  --background-color-light: #444;
  --background-color-dark: #333;
  --shadow-small: 0 2px 4px rgba(0, 0, 0, 0.6);
  --shadow-large: 0 4px 16px rgba(0, 0, 0, 0.6);
  --font-family: Arial, sans-serif;
  --font-size-small: 10px;
  --font-size-standard: 12px;
  --font-size-large: 18px;
  --font-size-title: 32px;
  --text-color-light: white;
  --text-color-mid: lightgray;
  --text-color-dark: black;
  --height-body: 660px;
  --height-app: 640px;
  --height-header: 60px;
  --height-main: 560px;
  --height-main-buttons: 40px;
  --height-main-tree: 420px;
  --height-main-info: 90px;
  --height-main-list: 520px;
  --height-main-list-table: 500px;
  --height-footer: 20px;
}

/* ==== Global Reset ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* outline: 1px red dashed; */
}

html,
body {
  overflow: hidden;
}

/* ==== App Layout ==== */
body {
  min-width: 390px;
  min-height: var(--height-body);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--background-color-dark);
}

.app {
  width: 370px;
  max-width: 370px;
  height: var(--height-app);
  max-height: var(--height-app);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: var(--shadow-large);
  background-image: url('images/background.png');
  background-size: cover;
  background-position: center;
  font-family: var(--font-family);
  font-size: var(--font-size-standard);
  color: var(--text-color-dark);
  margin: 10px;
  padding: 0 10px;
}

/* ==== Header ==== */
.header {
  width: 100%;
  height: var(--height-header);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#header-title {
  font-size: var(--font-size-title);
  text-shadow: var(--shadow-small);
  color: var(--text-color-light);
  letter-spacing: 1px;
  -webkit-text-stroke: 1px black;
}

/* ==== Main ==== */
.main {
  width: 100%;
  height: var(--height-main);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==== Main - Buttons ==== */
#main-buttons {
  width: 100%;
  height: var(--height-main-buttons);
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 3;
}

#main-buttons .iconButton {
  width: 35px;
  height: 35px;
  border: 1px solid black;
  border-radius: 50%;
  background: #88ddff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-small);
  transition: background 0.2s;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  padding: 0;
}

@media (hover: hover) and (pointer: fine) {
  #main-buttons .iconButton:hover,
  #main-buttons .iconButton:active {
    background: #88ff88;
  }
}

#main-buttons .iconButton.pressed {
  background: #88ff88 !important;
}

#main-buttons .iconButton .iconImage {
  width: 35px;
  height: 35px;
  display: block;
  object-fit: contain;
}

/* ==== Main - Tree ==== */
#main-tree {
  width: 100%;
  height: var(--height-main-tree);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  overflow-y: auto;
}

.tree-node {
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
}

.tree-node-img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  background-color: white;
  border: 1px solid black;
}

.tree-node-label {
  width: 75px;
  height: 32px;
  overflow: hidden;
  border-radius: 5px;
  margin-top: 5px;
  padding: 2px 4px;
  background-color: white;
  text-align: center;
  vertical-align: middle;
  font-size: var(--font-size-standard);
  white-space: normal;
  text-overflow: ellipsis;
  cursor: pointer;
  line-height: 1.2;
  border: 1px solid black;
}

.tree-node.clickable {
  cursor: pointer;
}

.tree-node:not(.clickable) {
  cursor: default;
}

.tree-node-img,
.tree-node-label {
  cursor: inherit;
  box-shadow: var(--shadow-small);
}

.tree-row {
  width: 350px;
  display: flex;
  justify-content: center;
}

.tree-row:nth-child(1) {
  gap: 15px;
  margin-bottom: 30px;
}

.tree-row:nth-child(2) {
  gap: 60px;
  margin-bottom: 30px;
}

.infoSquare {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid black;
  background: white;
  border-radius: 10px;
  padding: 10px;
  width: 350px;
  min-height: 200px;
  font-family: var(--font-family);
  font-size: var(--font-size-standard);
  color: var(--text-color-dark);
  box-shadow: var(--shadow-small);
}

#infoSquareTitle {
  font-size: var(--font-size-large);
  color: var(--text-color-dark);
  margin-bottom: 5px;
}

.infoSquare b {
  display: inline;
  font-weight: bold;
}

/* ==== Main - Info ==== */
#main-info {
  height: var(--height-main-info);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  font-size: var(--font-size-standard);
  background: whitesmoke;
  border: 1px solid black;
  border-radius: 10px;
  box-shadow: var(--shadow-small);
  z-index: 5;
}

.info-row {
  width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: var(--font-size-standard);
}

#info-name {
  font-size: var(--font-size-large);
}

/* ==== Main - List ==== */
#main-list {
  max-height: var(--height-main-list);
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: whitesmoke;
  border: 1px solid black;
  border-radius: 10px;
  z-index: 10;
  margin-top: 40px;
  padding: 10px;
}

#main-list-table {
  max-height: var(--height-main-list-table);
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  font-size: var(--font-size-standard);
  z-index: 11;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

#main-list-table::-webkit-scrollbar {
  display: none;
}

#main-list-table table {
  width: 100%;
  max-width: 100%;
  max-height: 500px;
  table-layout: fixed;
  border-collapse: collapse;
}

#main-list-table th {
  position: sticky;
  top: 0;
  background: whitesmoke;
  z-index: 12;
  font-size: var(--font-size-standard);
  font-weight: bold;
  text-align: left;
  padding: 2px 4px;
  border-bottom: 1px solid gray;
}

#main-list-table tr {
  display: table-row;
  cursor: pointer;
}

#main-list-table tr:hover td {
  background: #88ff88;
}

#main-list-table td {
  border: 1px solid gray;
  padding: 2px 4px;
  text-align: left;
}

#main-list-table th:nth-child(1),
#main-list-table td:nth-child(1),
#main-list-table th:nth-child(2),
#main-list-table td:nth-child(2) {
  width: 35%;
}

#main-list-table th:nth-child(3),
#main-list-table td:nth-child(3),
#main-list-table th:nth-child(4),
#main-list-table td:nth-child(4) {
  width: 15%;
}

/* ==== Select Table ==== */
.selectTable {
  width: 50%;
  max-width: 100%;
  max-height: 500px;
  table-layout: fixed;
  border-collapse: collapse;
}

.selectTable tr {
  display: table-row;
  cursor: pointer;
}

.selectTable tr:hover td {
  background: #88ff88;
}

.selectTable td {
  border: 1px solid gray;
  padding: 2px 4px;
  text-align: center;
  font-size: var(--font-size-standard);
  font-family: var(--font-family);
}

/* ==== Footer ==== */
.footer {
  width: 100%;
  height: var(--height-footer);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-small);
  color: var(--text-color-mid);
}

.footer-content {
  width: 100%;
  display: flex;
  justify-content: space-between;
}

.footer a {
  color: var(--text-color-mid);
  text-decoration: none;
}
