/* variables */
:root {
  --nicegui-default-padding: 1rem;
  --nicegui-default-gap: 1rem;
}

/* prevent q-layout from getting strange outline when focussed */
.nicegui-layout {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* flex containers */
.nicegui-content,
.nicegui-header,
.nicegui-footer,
.nicegui-drawer,
.nicegui-tab-panel,
.nicegui-card,
.nicegui-carousel-slide,
.nicegui-expansion-content,
.nicegui-scroll-area .q-scrollarea__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--nicegui-default-gap);
  padding: var(--nicegui-default-padding);
}
.nicegui-splitter .q-splitter__panel,
.nicegui-step .q-stepper__nav,
.nicegui-step .q-stepper__step-inner,
.nicegui-timeline-entry .q-timeline__content,
.nicegui-sub-pages,
.nicegui-row,
.nicegui-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--nicegui-default-gap);
}
.nicegui-header,
.nicegui-footer,
.nicegui-step .q-stepper__nav,
.nicegui-row {
  flex-direction: row;
}
.nicegui-card-tight {
  padding: 0;
  gap: 0;
}

/* let step content fill the whole stepper for easier layout manipulation (#1788) */
.nicegui-stepper {
  display: flex;
  flex-direction: column;
}
.nicegui-stepper .q-stepper__content {
  flex-grow: 1;
}
.nicegui-stepper.q-stepper--horizontal .q-stepper__step-content,
.nicegui-stepper.q-stepper--horizontal .q-stepper__step-inner {
  height: 100%;
}
.nicegui-step .q-stepper__nav {
  padding-top: 8px;
  gap: 8px;
}

/* revert Tailwind's CSS reset for ui.editor and ui.markdown */
.nicegui-editor .q-editor__content h1,
.nicegui-markdown h1 {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 1rem;
  margin-top: 1.5rem;
  font-weight: 300;
}
.nicegui-editor .q-editor__content h2,
.nicegui-markdown h2 {
  font-size: 2.25rem;
  line-height: 2.5rem;
  margin-bottom: 0.75rem;
  margin-top: 1.25rem;
  font-weight: 300;
}
.nicegui-editor .q-editor__content h3,
.nicegui-markdown h3 {
  font-size: 1.875rem;
  line-height: 2.25rem;
  margin-bottom: 0.5rem;
  margin-top: 1rem;
  font-weight: 400;
}
.nicegui-editor .q-editor__content h4,
.nicegui-markdown h4 {
  font-size: 1.5rem;
  line-height: 2rem;
  margin-bottom: 0.25rem;
  margin-top: 0.75rem;
  font-weight: 400;
}
.nicegui-editor .q-editor__content h5,
.nicegui-markdown h5 {
  font-size: 1.25rem;
  line-height: 1.75rem;
  margin-bottom: 0.125rem;
  margin-top: 0.5rem;
  font-weight: 400;
}
.nicegui-editor .q-editor__content h6,
.nicegui-markdown h6 {
  font-size: 1.125rem;
  line-height: 1.75rem;
  margin-bottom: 0.125rem;
  margin-top: 0.5rem;
  font-weight: 500;
}
.nicegui-editor .q-editor__content a,
.nicegui-markdown a {
  text-decoration-line: underline;
  color: rgb(37 99 235); /* blue-600 */
}
.nicegui-editor .q-editor__content a:hover,
.nicegui-markdown a:hover {
  color: rgb(30 64 175); /* blue-800 */
}
.nicegui-editor .q-editor__content a:visited,
.nicegui-markdown a:visited {
  color: rgb(147 51 234); /* purple-600 */
}
.nicegui-editor .q-editor__content hr,
.nicegui-markdown hr {
  margin-block-start: 0.5em;
  margin-block-end: 0.5em;
  height: 1px;
  border-style: none;
  background-color: rgba(128, 128, 128, 0.25);
}
.nicegui-editor .q-editor__content ul,
.nicegui-markdown ul {
  list-style-type: initial;
  padding-inline-start: 2.5rem;
  margin-block-start: 0.25rem;
  margin-block-end: 0.25rem;
}
.nicegui-editor .q-editor__content ol,
.nicegui-markdown ol {
  list-style-type: decimal;
  padding-inline-start: 2.5rem;
  margin-block-start: 0.25rem;
  margin-block-end: 0.25rem;
}
.nicegui-editor .q-editor__content blockquote,
.nicegui-markdown blockquote {
  border-left: 0.25rem solid #8884;
  padding: 0.25rem 1rem 0.25rem 1rem;
  margin: 0.5rem 0;
}
.nicegui-editor .q-editor__content p,
.nicegui-markdown p {
  margin: 0.5rem 0;
}
.nicegui-editor .q-editor__content table,
.nicegui-markdown table {
  border-collapse: collapse;
  margin: 0.5rem 0;
}
.nicegui-editor .q-editor__content th,
.nicegui-markdown th {
  padding: 0.5rem;
  border: 1px solid #8884;
}
.nicegui-editor .q-editor__content td,
.nicegui-markdown td {
  padding: 0.5rem;
  border: 1px solid #8884;
}
.nicegui-markdown pre {
  margin: 0.5rem 0;
}
.nicegui-markdown .mermaid-pre > .mermaid {
  display: none;
}

/* other NiceGUI elements */
.nicegui-grid {
  display: grid;
  gap: var(--nicegui-default-gap);
}
.nicegui-link {
  text-decoration-line: underline;
  color: rgb(59 130 246);
}
.nicegui-link:hover,
.nicegui-link:active {
  opacity: 0.8;
}
.nicegui-separator.q-separator--horizontal {
  width: 100%;
}
.nicegui-aggrid,
.nicegui-codemirror,
.nicegui-echart,
.nicegui-leaflet,
.nicegui-log,
.nicegui-scroll-area {
  width: 100%;
  height: 16rem;
}
.nicegui-leaflet video.leaflet-image-layer {
  max-width: none; /* HACK: make the video show up */
}
.q-parallax__media > img,
.q-parallax__media > video {
  max-width: none; /* HACK: make the parallax image cover the screen as it should */
}
.nicegui-log {
  outline: 1px solid rgba(127, 159, 191, 0.15);
  background-color: rgba(127, 159, 191, 0.05);
}
.nicegui-log .q-scrollarea__container {
  scroll-padding-bottom: 0.5rem;
  scroll-snap-type: y proximity;
}
.nicegui-log .q-scrollarea__content {
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  padding: 0.5rem;
}
.nicegui-log .q-scrollarea__content > :last-child {
  scroll-snap-align: end;
}
h6.q-timeline__title {
  font-size: 1.25rem;
  font-weight: 500;
}
.nicegui-code {
  position: relative;
  background-color: rgba(127, 159, 191, 0.1);
  border: 1pt solid rgba(127, 159, 191, 0.15);
  box-shadow: 0 0 0.5em rgba(127, 159, 191, 0.05);
  border-radius: 0.25rem;
}
.nicegui-code pre {
  padding: 0 0.5rem;
}
.nicegui-matplotlib > svg,
.nicegui-pyplot > svg {
  width: 100%;
  height: 100%;
}
.nicegui-joystick {
  width: 10em;
  height: 10em;
  background-color: AliceBlue;
}
.nicegui-joystick > div {
  width: 100%;
  height: 100%;
  position: relative;
}
.nicegui-scene[data-initializing],
.nicegui-scene-view[data-initializing] {
  visibility: hidden;
}
.nicegui-interactive-image-layer {
  position: absolute !important;
  inset: 0;
  pointer-events: none;
}
.nicegui-interactive-image-layer img {
  display: none;
}
.nicegui-codemirror .cm-editor.cm-focused {
  outline: none;
}
.js-plotly-plot {
  box-sizing: content-box; /* HACK: fix overflow when adding borders to the Plotly plot */
}

/* error popups */
.nicegui-error-popup {
  position: fixed;
  bottom: 0;
  border: 1pt solid rgba(127, 159, 191, 0.25);
  border-radius: 0.25em;
  box-shadow: 0 0 0.5em rgba(127, 159, 191, 0.05);
  margin: 2em;
  padding: 1.5em 4em;
  display: flex;
  flex-direction: column;
  gap: 1em;
  transition-duration: 500ms;
  pointer-events: none;
  z-index: 10000;
}
.nicegui-error-popup:dir(ltr) {
  left: 0;
}
.nicegui-error-popup:dir(rtl) {
  right: 0;
}
.body--dark .nicegui-error-popup {
  background-color: black;
}
.body--light .nicegui-error-popup {
  background-color: white;
}
.nicegui-error-popup[aria-hidden="true"] {
  opacity: 0;
  visibility: hidden;
}
.nicegui-error-popup[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}
#popup[aria-hidden="false"] {
  transition-delay: 2000ms;
}
.nicegui-error-popup > span:first-child {
  font-weight: bold;
}
.nicegui-error-popup:dir(ltr) > span:first-child::before {
  content: "⚠️";
  position: absolute;
  left: 1.5em;
}
.nicegui-error-popup:dir(rtl) > span:first-child::before {
  content: "⚠️";
  position: absolute;
  right: 1.5em;
}
