/* reset */
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

/* variables */
:root {
  --sait: var(--discord-safe-area-inset-top, env(safe-area-inset-top));
  --saib: var(--discord-safe-area-inset-bottom, env(safe-area-inset-bottom));
  --sail: var(--discord-safe-area-inset-left, env(safe-area-inset-left));
  --sair: var(--discord-safe-area-inset-right, env(safe-area-inset-right));

  --mono-100: 227, 5%, 100%;
  --mono-200: 227, 5%, 95%;
  --mono-300: 227, 5%, 70%;
  --mono-400: 227, 5%, 58%;
  --mono-500: 227, 5%, 50%;
  --mono-600: 227, 5%, 40%;
  --mono-700: 227, 5%, 35%;

  --discord-bg: rgb(49, 51, 56);
  --discord-overlay: #232428c4;
}

/* set if html tag has data-color-mode set to dark theme */
html[data-theme="light"] {
  --mono-100: 227, 5%, 10%;
  --mono-200: 227, 5%, 25%;
  --mono-300: 227, 5%, 35%;
  --mono-400: 227, 5%, 40%;
  --mono-500: 227, 5%, 60%;
  --mono-600: 227, 5%, 75%;
  --mono-700: 227, 5%, 87%;

  --discord-bg: white;
  --discord-overlay: #e0e1e2c4;
}

/**
 * Motion
 */

@keyframes slideInTop {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInBottom {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

html {
  /* background-color: var(--discord-bg); */
  color: hsl(var(--mono-100));
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
  padding-left: var(--sail);
  padding-right: var(--sair);
  padding-top: var(--sait);
  padding-bottom: var(--saib);
}

/* Scale canvas with resize attribute to full size */
canvas[resize] {
  width: 100%;
  height: 100%;
}

/* Styles for the parent container */

.hidden {
  display: none !important;
}

.hstack {
  display: flex;
  gap: 4px;
}

.center {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

#container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

#appbody {
  height: fit-content;
  position: fixed;
  display: flex;
  bottom: 16px;
  left: 0;
  right: 0;
  width: 100%;

  justify-content: space-between;
  transition: opacity 0.17s ease;
  padding-inline: 4px;
  z-index: 1;
}

@media (min-width: 640px) {
  #appbody {
    max-width: 70vw;
    margin: 0 auto;
  }
  #bottomBarWrapper {
    border-radius: 19px;
  }

}

.toolButton {
  flex-shrink: 0;
  align-self: flex-end;
  position: relative;
  width: 38px; /* match discord's style */
  height: 38px;
  margin-right: 8px;
  margin-left: 0px
}

.fadeout {
  opacity: 0;
}

#buttonContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

button {
  display: flex;
  position: relative;
  width: 38px; /* match discord's style */
  height: 38px;
  box-sizing: border-box;
  -webkit-box-direction: normal;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  cursor: pointer;
  justify-content: center;
  align-items: center;
  user-select: none;
  color: hsla(var(--mono-100), 0.8);
  background-color: hsla(var(--mono-700), 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: none;
  outline-offset: -1px;
  border-radius: 48px;
}
button:hover {
  background-color: hsla(var(--mono-700), 0.8);
  transition: background-color .17s ease, border .17s ease;
}
button:active {
  background-color: hsla(var(--mono-300), 0.8);
  transition: background-color .01s ease, border .01s ease;
}
button:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}
button.selected {
  background-color: hsla(var(--mono-500), 0.8);
  transition: background-color .17s ease, border 0.17s ease;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.spinner-container {
  padding: 4px;
  z-index: 1;
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.spinner {
  animation: spinner 1s linear infinite;
  fill: hsla(var(--mono-200), 0.85);
}

.loading-container {
  opacity: 0;
  transition: opacity 0.17s ease;
}

.Submit {
  border: none;
  outline: none;
  border-radius: 32px;
  background: none;
  position: relative;
  display: flex;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  height: 28px;
  width: 28px;
  background-color: hsla(var(--mono-200), 1.0);
}
.Submit svg {
  color: hsl(var(--mono-700));
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.Submit svg:hover{
  transition: fill .17s ease;
}
.Submit svg:active{
  transition: fill .17s ease;
}
.Submit[data-state="loading"] {
  background-color: hsla(var(--mono-200), 0.2);
  cursor: not-allowed;
}

.withText {
  background-color: transparent;
  padding-inline: 8px;
  gap: 12px;
  width: unset !important;
}

.withText svg {
  color: hsla(var(--mono-200), 0.85);
}

#Undo {
  margin-left: 8px;
}

.no-animation {
  animation: none !important;
}

.textarea {
  /* 2.5x line-height */
  max-height: 56px;
  background-color: transparent;
  border: none;
  color: hsla(var(--mono-100), 1.0);
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  outline: none;
  outline-offset: 0px;

  padding-inline-start: 8px;
  flex: 1;
  display: block;
  overflow: auto;
  resize: none;
  white-space: break-spaces;
  word-break: normal;
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-appearance: none;
  appearance: none;
  transition: max-height 0.17s ease;
}
.textarea[placeholder]:empty:before {
  content: attr(placeholder);
  color: hsla(var(--mono-100), 0.6);
}
.textarea[placeholder]:empty:focus:before {
  content: "";
}
.textarea:focus, .textarea:active {
  box-shadow: none;
  max-height: unset;
}

/* hide the scrollbar to avoid overlap with the submit button */
.textarea::-webkit-scrollbar {
  display: none;
}

@media (max-width: 640px) {
  .textarea {
    min-width: auto;
  }

  .Submit {
    width: 38px;
    height: 38px;
  }

  .toolButton {
    width: 48px; /* match discord's style */
    height: 48px;
  }
}

#submit-label {
  pointer-events: none;
}

#loadingModal {
  display: flex;
}

#splashPageModal {
  display: none;
}

#jobSubmittedModal {
  display: none;
}

#jobErroredModal {
  display: none;
}

.undoButtons {
  position: fixed;
  top: 16px;
  left: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-direction: row;
}

.bottomBarWrapper {
  display: flex;
  flex-direction: row;
  overflow: hidden;
  align-items: center;
  border: none;
  /* border: 1px solid hsl(var(--mono-400)); */
  padding-inline: 4px;
  padding-block: 4px;
  box-sizing: border-box;
  border-radius: 24px;
  background-color: hsla(var(--mono-700), 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  width: 100%;
  gap: 4px;
}
.noFill {
  width: unset;
}

/**
 * Tutorial overlay
 */

#popover-container {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  pointer-events: none;
  z-index: 10;
}

.popover {
  border: 1px solid hsla(var(--mono-100), 0.1);
  position: absolute;
  top: 16px;
  z-index: 10;
  padding-inline: 16px;
  padding-block: 9px;
  border-radius: 100px;
  font-size: 16px;
  max-width: 90vw;
  background-color: var(--discord-overlay);
  animation: slideInTop 0.3s ease;
  transition: opacity 0.3s ease;
  box-shadow: 0 2px 10px 0 rgba(0,0,0,0.09);
}

@media (max-width: 640px) {
  .popover {
    top: 64px;
  }

  @media (max-height: 500px) {
    .popover {
      opacity: 0;
    }
  }
}

/**
 * Modals
 */

.modal {
  display: flex;
  position: fixed;
  justify-content: center;
  align-items: center;
  left: 0;
  top: 0;
  padding-inline: 8px;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
}

.modal-backdrop {
  position: fixed;
  z-index: 2;
  inset: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.4);
  animation: fadeIn 0.3s ease;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
  max-width: 420px;
  background-color: var(--discord-bg);
  border-radius: 8px;
  padding: 16px;
  box-sizing: border-box;
  animation: slideInBottom 0.2s ease;
}

.modal-header {
  font-size: 18px;
  font-weight: 600;
}

.modal-content {
  color: hsla(var(--mono-100), 0.6);
}

.modal-footer {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.modal-button {
  border-radius: 4px;
  background-color: hsl(var(--mono-500));
  color: hsl(var(--mono-100));
  padding: 8px 16px;
  flex-shrink: 0;
  width: unset;
  height: unset;
}
