body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

* {
  user-select: none;
}

.logo.vanilla:hover {
  filter: drop-shadow(0 0 2em #ffe21c);
}
:root {
  --lineheight: 24px;
  font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: var(--lineheight);
  font-weight: 400;

  color: #0f0f0f;
  background-color: #f6f6f6;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

.container {
  margin: 0;
  padding-top: 10vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.logo {
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: 0.75s;
}

.logo.tauri:hover {
  filter: drop-shadow(0 0 2em #24c8db);
}

.row {
  display: flex;
  justify-content: center;
}

a {
  font-weight: 500;
  color: #646cff;
  text-decoration: inherit;
}

a:hover {
  color: #535bf2;
}

h1 {
  text-align: center;
}

input,
button {
  border-radius: 8px;
  border: 1px solid transparent;
  /* padding: 0.6em 1.2em; */
  padding: 0.4em 1em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  color: #0f0f0f;
  background-color: #ffffff;
  transition: border-color 0.25s;
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  min-height: var(--lineheight);
}

div {
  /* this should be on everything by default, really */
  box-sizing: border-box;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: #396cd8;
}
button:active {
  border-color: #396cd8;
  background-color: #e8e8e8;
}

input,
button {
  outline: none;
}

#greet-input {
  margin-right: 5px;
}


.header {
  height: 60px;
  min-width: 100%;
  background-color: #ccc;
  text-align: left;
  z-index: 1;
}

.icon {
  width: var(--lineheight);
  height: var(--lineheight);
}

.panecontainer {
  width: 100%;
  height: 100%;
}

.horizontal-grid, .vertical-grid {
  display: flex;
  gap: 5px;
  background-color: #555;
  width: 100%;
  height: 100%;
  contain: strict;
}
.horizontal-grid {
  flex-direction: row;
}
.vertical-grid {
  flex-direction: column;
}
/* I don't fully understand this selector but it works for now */
.horizontal-grid:hover:not(:has(*:hover)) {
  background: #666;
  cursor: ew-resize;
}
.vertical-grid:hover:not(:has(*:hover)) {
  background: #666;
  cursor: ns-resize
}
.scroll {
  overflow: scroll;
  width: 100%;
  height: 100%;
  background-color: #555;
}
.stage {
  width: 1500px;
  height: 1000px;
  /* overflow: scroll; */
}
.stageWrapper {
  position: relative;
  width: 1500px;
  height: 1500px;
}
.selectionRect {
  position: absolute;
  width: 500px;
  height: 300px;
  left: 100px;
  top: 100px;
  border: 1px solid #00ffff;
  display: none;
  user-select: none;
  pointer-events: none;
}
.cornerRect {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: black;
  transition: width 0.2s ease, height 0.2s linear;
  user-select: none;

  pointer-events: auto;
  /* z-index: 2; */
}
.cornerRect:hover {
  width: 15px;
  height: 15px;
}
.cornerRotateRect {
  position: absolute;
  width: 50px;
  height: 50px;
  /* background-color: blue; */
  pointer-events: auto;
}
.nw {
  top: 0px;
  left: 0px;
  transform: translate(-50%, -50%);
  cursor:nw-resize;
}
.n {
  top: 0px;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor:n-resize;
}
.ne {
  top: 0px;
  right: 0px;
  transform: translate(50%, -50%);
  cursor:ne-resize;
}
.e {
  top: 50%;
  right: 0px;
  transform: translate(50%, -50%);
  cursor:e-resize;
}
.se {
  bottom: 0px;
  right: 0px;
  transform: translate(50%, 50%);
  cursor:se-resize;
}
.s {
  bottom: 0px;
  left: 50%;
  transform: translate(-50%, 50%);
  cursor:s-resize;
}
.sw {
  bottom: 0px;
  left: 0px;
  transform: translate(-50%, 50%);
  cursor:sw-resize;
}
.w {
  top: 50%;
  left: 0px;
  transform: translate(-50%, -50%);
  cursor:w-resize;
}
.cornerRotateRect.nw,.cornerRotateRect.ne,.cornerRotateRect.se,.cornerRotateRect.sw {
  /* cursor: url("assets/arrow-counterclockwise.svg") 12 12, auto;   */
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='currentColor' class='bi bi-arrow-counterclockwise' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2z'/%3E%3Cpath d='M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466'/%3E%3C/svg%3E") 12 12, auto;
}
.toolbar {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 5px;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: space-around;
}
.toolbtn {
  width: calc( 3 * var(--lineheight) );
  height: calc( 3 * var(--lineheight) );
  background-color: #ccc;
}
.toolbtn img {
  filter: invert(1);
}

.horiz_break {
  width: 100%;
  height: 5px;

  background-color: #999;
}
.color-field {
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 10px;
  width: 100%;
  height: calc(2 * var(--lineheight));
  --color: red; /* CSS variable for the pseudo-element color */
  --label-text: "Color:"; /* CSS variable for the label text */
}

.color-field::before {
  content: var(--label-text);;
  font-size: 16px;
  color: black;
  margin-right: 10px;
}

.color-field::after {
  content: "";
  flex-grow: 1;
  height: 100%;
  border-radius: 5px;
  background:
  linear-gradient(to right, var(--color), var(--color)),
  repeating-conic-gradient(#B0B0B0 0% 25%, #E0E0E0 0% 50%) 
      50% / 20px 20px;
}

.clr-field button {
  width: 50% !important;
  /* height: 100% !important; */
  /* margin: 100px; */
  border-radius: 5px;
}
.clr-field input {
  width: 50%;
}
.infopanel {
  width: 100%;
  height: 100%;
  background-color: #aaa;
  display: flex;
  box-sizing: border-box;
  gap: calc( var(--lineheight) / 2 );
  padding: calc( var(--lineheight) / 2 );
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
}
.infopanel-field {
  width: 300px;
  height: var(--lineheight);
  display: flex;
  flex-direction: row;
}
.infopanel-label {
  flex: 1 1 50%;
}
.infopanel-input {
  flex: 1 1 50%;
  width: 50%;
}
.layers {
  background-color: #aaa;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  min-height: 100%;
}
.frames-container {
  background-color: #aaa;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  /* overflow-x: scroll; */
  /* overflow-y:inherit; */
  min-height: 100%;
  overflow-x: scroll;
}
.layer-header {
  width: 100%;
  height: calc( 2 * var(--lineheight));
  background-color: #aaa;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #999;
  flex-shrink: 0;

  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.layer-header.active {
  background-color: #ccc;
}
.layer-header.audio {
  background-color: #8281cc;
  border-top: 1px solid #9a99db;
  border-bottom: 1px solid #817db9;
}
.layer-name {
  padding-left: 1em;
  padding-top: 5px;
  display: inline-block;
  color: #666;
  cursor: text;
}
.layer-header.active > .layer-name {
  color: #000;
}
/* Visibility icon positioning */
.visibility-icon {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-right: 10px;
} 
.layer-track {
  min-width: 100%;
  height: calc( 2 * var(--lineheight));
  /* background: repeating-linear-gradient(to right, transparent, transparent 24px, #aaa 24px, #aaa 25px),
              repeating-linear-gradient(to right, #bbb, #bbb 100px, #aaa 100px, #aaa 125px); */
  background-image: 
    /* Layer 1: frame dividers */
    linear-gradient(to right, transparent 24px, #aaa 24px 25px),
    /* Layer 2: highlight every 5th frame */
    linear-gradient(to right, #bbb 100px, #aaa 100px 125px);
  background-repeat: repeat-x, repeat-x;
  background-size: 25px 100%, 125px 100%;
  display: flex;
  flex-direction: row;
  border-top: 1px solid #bbb;
  border-bottom: 1px solid #ccc;
  flex-shrink: 0;
}
.layer-track.invisible {
  opacity: 0.3;
}
.frame {
  width: 25px;
  height: 100%;

  background-color: #ccc;
  flex-grow: 0;
  flex-shrink: 0;
  border-right: 1px solid #bbb;
  border-left: 1px solid #ddd;
}
.frame:hover {
  background-color: #555555;
}
.frame.active {
  background-color: #fff;
}
.frame.keyframe {
  position: relative;
}
.frame.keyframe::before {
  content: ''; /* Creates a pseudo-element */
  position: absolute;
  bottom: 0; /* Position the circle at the bottom of the div */
  left: 50%; /* Center the circle horizontally */
  transform: translateX(-50%); /* Adjust for perfect centering */
  width: 50%; /* Set the width of the circle to half of the div's width */
  height: 0; /* Initially set to 0 */
  padding-bottom: 50%; /* Set padding-bottom to 50% of the div's width to create a circle */
  border-radius: 50%; /* Make the shape a circle */
  background-color: #222; /* Set the color of the circle (black in this case) */
  margin-bottom: 5px;
}
.frame.motion {
  background-color: #7a00b3;
  border: none;
}
.frame.motion:hover, .frame.motion.active {
  background-color: #530379;
  border-left: 1px solid #450264;
  border-right: 1px solid #450264;
}
.frame.shape {
  background-color: #9bff9b;
  border: none;
}
.frame.shape:hover, .frame.shape.active {
  background-color: #38f538;
  border-left: 1px solid #26ac26;
  border-right: 1px solid #26ac26;
}
/* :nth-child(1 of .frame.motion) {
  background-color: blue;
}
:nth-last-child(1 of .frame.motion) {
  background-color: red;
} */

.frame-highlight {
  background-color: #888;
  width: 25px;
  height: calc( 2 * var(--lineheight) - 2px);
  position: relative;
}

.hidden {
  display: none;
}

#overlay {
  display: none; /* Hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999; /* Under the dialog */
}

/* Scoped styles for the dialog */
#newFileDialog {
  display: none; /* Hidden by default */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #ddd;
  border: 1px solid #aaa;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  padding: 20px;
  width: 300px;
  z-index: 1000; /* Make sure it's in front of other elements */
}

#newFileDialog .dialog-label {
  display: block;
  margin: 10px 0 5px;
}

#newFileDialog .dialog-input {
  width: 100%;
  padding: 8px;
  margin: 5px 0;
  border: 1px solid #aaa;
}

#newFileDialog .dialog-button {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  background-color: #007bff;
  color: white;
  border: none;
  cursor: pointer;
}

#newFileDialog .dialog-button:hover {
  background-color: #0056b3;
}

#popupMenu {
  background-color: #eee;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
  padding: 20px;
  border-radius: 5px;
  position: absolute;
}
#popupMenu ul {
  padding: 0px;
  margin: 0px;
}
#popupMenu li {
  color: #222;
  list-style-type: none;
  display: flex;
  align-items: center;  /* Vertically center the image and text */
  padding: 5px 0; /* Add padding for better spacing */
}
#popupMenu li:hover {
  background-color: #fff;
  cursor:pointer;
}
#popupMenu li:not(:last-child) {
  border-bottom: 1px solid #ccc;  /* Horizontal line for all li elements except the last */
}
#popupMenu li img {
  margin-right: 10px; /* Space between the icon and text */
  width: 20px;  /* Adjust the width of the icon */
  height: 20px; /* Adjust the height of the icon */
}


@media (prefers-color-scheme: dark) {
  :root {
    color: #f6f6f6;
    background-color: #2f2f2f;
  }

  a:hover {
    color: #24c8db;
  }

  input,
  button {
    color: #ffffff;
    background-color: #0f0f0f98;
  }
  button:active {
    background-color: #0f0f0f69;
  }

  #newFileDialog {
    background-color: #444;
    border: 1px solid #333;
  }
  #newFileDialog .dialog-input {
    border: 1px solid #333;
  }
  #popupMenu {
    background-color: #222;
  }
  #popupMenu li {
    color: #ccc;
  }
  #popupMenu li:hover {
    background-color: #444;
  }
  #popupMenu li:not(:last-child) {
    border-bottom: 1px solid #444;
  }
  .color-field::before {
    color: #eee;
  }
  .layers {
    background-color: #222222;
  }
  .frames-container {
    background-color: #222222;
  }
  .layer-header {
    background-color: #222;
    border-top: 1px solid #4f4f4f;
    border-bottom: 1px solid #111;
  }
  .layer-header.active {
    background-color: #444;
  }
  .layer-name {
    color: #aaa
  }
  .layer-header.active > .layer-name {
    color: #fff;
  }
  .layer-header.audio {
    background-color: #23253b;
    border-top: 1px solid #403f4e;
    border-bottom: 1px solid #1f1e24;
  }
  .layer-track {
    background-image: 
      linear-gradient(to right, transparent 23px, #1a1a1a 23px 25px), /* Dark mode frame dividers */
      linear-gradient(to right, #121212 100px, #0a0a0a 100px 125px); /* Dark mode frame highlights */
    border-top: 1px solid #222222;
    border-bottom: 1px solid #3f3f3f;
  }
  .frame {
    background-color: #4f4f4f;
    border-right: 1px solid #3f3f3f;
    border-left: 1px solid #555555;
  }
  .frame:hover {
    background-color: #555555;
  }
  .frame.active {
    background-color: #666666;
  }
  .infopanel {
    background-color: #3f3f3f;
  }
  .header {
    background-color: #3f3f3f;
  }
  .horizontal-grid, .vertical-grid {
    background-color: #0f0f0f;
  }
  .toolbtn {
    background-color: #2f2f2f;
  }
  .toolbtn img {
    filter:none;
  }
  .horiz_break {
    background-color: #2f2f2f;
  }
  .audioWaveform {
    filter: invert(1);
  }
  .visibility-icon {
    filter: invert(1);
  }
}
