@use "editor";
@use "modals";
@use "theme";
@use "colors";

@font-face {
  font-family: "iA-Mono";
  src: url("/.client/iAWriterMonoS-Regular.woff2");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "iA-Mono";
  src: url("/.client/iAWriterMonoS-Bold.woff2");
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: "iA-Mono";
  src: url("/.client/iAWriterMonoS-Italic.woff2");
  font-weight: normal;
  font-style: italic;
}

@font-face {
  font-family: "iA-Mono";
  src: url("/.client/iAWriterMonoS-BoldItalic.woff2");
  font-weight: bold;
  font-style: italic;
}

html,
body {
  margin: 0;
  height: 100%;
  padding: 0;
  width: 100%;
  overflow: hidden;
  background-color: var(--top-background-color);
}

#sb-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background-color: var(--root-background-color);
}

#sb-top {
  display: flex;
  flex-direction: row;
  z-index: 20;

  height: 55px;

  .main {
    flex: 2;
    max-width: 100%;

    .inner {
      // Hack to not have SCSS precompile this value but use proper CSS variables
      max-width: var(--#{"editor-width"});
      margin: auto;
      font-size: 28px;
      padding: 8px 0;
      display: flex;
      flex-direction: row;

      .wrapper {
        width: env(titlebar-area-width, 100%);
        padding: 0 20px;
        display: flex;
        box-sizing: border-box;
        position: relative;

        .sb-notifications {
          position: absolute;
          right: 20px;
          top: 50px;

          font-size: 15px;
          z-index: 100;

          > div {
            padding: 3px;
            margin-bottom: 3px;
            border-radius: 5px;
          }
        }
      }
    }

    #sb-current-page {
      flex: 1;

      overflow: hidden;
      white-space: nowrap;
      text-align: left;
      display: block;

      -webkit-app-region: drag;

      .cm-scroller {
        font-family: var(--ui-font);
      }

      .cm-content {
        padding: 0;

        .cm-line {
          padding: 0;
          caret-color: var(--editor-caret-color);
        }
      }
    }
  }

  .sb-actions {
    display: flex;
    flex: 0 0 auto;
    text-align: right;
  }

  .progress-wrapper {
    display: inline-block;
    position: relative;
    margin-top: 4px;
    padding: 4px;
    background-color: var(--top-background-color);
  }

  .progress-bar {
    display: flex;
    justify-content: center;
    align-items: center;

    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 8px;
  }
}

.sb-panel {
  flex: 1;
}

.sb-bottom-iframe {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--editor-widget-background-color);
  border-radius: 5px;
}

.sb-top-iframe {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--editor-widget-background-color);
  border-radius: 5px;
}

#sb-main {
  display: flex;
  flex-direction: row;
  flex-grow: 1;
  height: 0;

  .sb-panel {
    flex: 1;
  }
}

#sb-editor {
  flex: 2;
  height: 100%;

  width: 100%;
}

.sb-bhs {
  height: 300px;
  width: 100%;
  z-index: 10;

  .sb-panel {
    height: 100%;
  }
}

.sb-modal {
  position: absolute;
  z-index: 100;

  .sb-panel {
    height: 100%;
  }
}

.sb-page-prefix {
  display: flex;
  align-items: baseline;
  flex: 0 0 auto;
  text-align: left;
  padding-top: 3px;
  font-family: var(--ui-font);
  white-space: pre-wrap;
}

.sb-panel {
  iframe {
    background-color: var(--root-background-color);
    border: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
  }
}

.sb-preview {
  position: relative;
}

.sb-markdown-toolbar {
  position: absolute;
  opacity: 0;
  transition: opacity 0.2s;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  box-sizing: border-box;
}

.sb-markdown-toolbar:hover {
  opacity: 1;
}
