@use "./variables" as vars;
@use "./colors" as colors;
@use "./v2/variables" as vars-v2;
@use "./v2/colors" as colors-v2;
@use "./v2/sing-colors"; // ソング用カラー
@use "./v2/cursor"; // カーソル
@use "fonts";

:root {
  color-scheme: dark;
}

// Material Symbols Rounded のスタイル設定
.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 200, 'opsz' 24;
}

// 優先度を強引に上げる
body:not(#dummy) {
  user-select: none;
  color: colors.$display;
  background: colors.$background;

  // Storybookでは枠線を付けない
  &:not(.sb-show-main) {
    border-left: solid #{vars.$window-border-width} #{colors.$splitter};
    border-right: solid #{vars.$window-border-width} #{colors.$splitter};
    border-bottom: solid #{vars.$window-border-width} #{colors.$splitter};
  }
}

body {
  font-family: 'LINE Seed JP', 'Twemoji', sans-serif;
  font-weight: 500;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code, kbd, pre, samp {
  font-family: "Menlo", "Monaco", "Consolas", "BIZ UDGothic", monospace;
}

img {
  pointer-events: none;
}

// スクロールバーのデザイン
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
  background-color: rgba(colors.$primary-rgb, 0.2);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb {
  background-color: rgba(colors.$primary-rgb, 0.6);
  border-radius: 5px;
  &:hover {
    background-color: rgba(colors.$primary-rgb, 0.7);
  }
  &:active {
    background-color: rgba(colors.$primary-rgb, 0.8);
  }
}
::-webkit-scrollbar-corner {
  background: colors.$background;
}

#app {
  display: flex;
  flex-direction: column;
}

.relative-absolute-wrapper {
  position: relative;
  > div {
    position: absolute;
    inset: 0;
  }
}

// ホバー色
.q-hoverable {
  &:hover > .q-focus-helper {
    background-color: colors.$primary !important;
    opacity: 0.3 !important;
  }
  &.bg-primary:hover > .q-focus-helper {
    background-color: colors.$background !important;
    opacity: 0.2 !important;
  }
}

// リプル色
.q-ripple > .q-ripple__inner {
  background-color: colors.$primary;
}
.bg-primary > .q-ripple > .q-ripple__inner {
  background-color: colors.$background;
}

// 無効時の色
.q-btn {
  &.disabled {
    opacity: 0.5 !important;
  }
}

.q-tooltip {
  // 背景色を変更
  background-color: rgba(colors.$surface-rgb, 1) !important;
  box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.2) !important;
  // ツールチップが変な箇所で折り返さないようにする
  max-width: none !important;
}

// ダイアログ
.q-dialog,
#q-loading {
  .q-dialog__backdrop,
  .q-dialog__inner,
  .q-loading,
  .q-loading__backdrop {
    top: vars.$menubar-height;
    left: vars.$window-border-width;
    right: vars.$window-border-width;
    bottom: vars.$window-border-width;
  }
  .q-layout-container {
    box-shadow: none;
  }

  .q-loading__box {
    padding: 16px 20px !important;
    .q-spinner {
      width: 2.5rem !important;
      height: 2.5rem !important;
    }
    .q-loading__message {
      margin-top: 12px !important;
      margin-left: 0 !important;
      margin-right: 0 !important;
    }
  }
}

.transparent-backdrop > .q-dialog__backdrop {
  background: transparent; // デフォルトの設定だと全画面ダイアログが出る際に黒背景がちらつく
}

// トースト通知と通知内にあるボタン
.text-toast-display,
.text-toast-display-warning,
.q-notification__actions .q-btn {
  font-weight: bold;
}

// 設定とかのヘッダーの色
.q-layout__section--marginal {
  background: colors.$toolbar !important;
}

// ボタンにアイコンを設定した際の margin-right を調整
.q-icon.on-left {
  margin-right: 6px !important;
}

// line-height を調整
.text-body1, .text-body2 {
  line-height: 1.55 !important;
}
.q-field__native, .q-field__prefix, .q-field__suffix, .q-field__input {
  line-height: 1.00 !important;
}
.q-btn .block, .q-btn.q-btn--unelevated .q-btn__content {
  margin-top: 1.5px;  // テキストの位置調整
}

// Markdown
.q-card .markdown-body {
  border-radius: 4px;
}
.markdown-body {
  min-height: max-content;
  color: colors.$display;
  background: colors.$background;
  overflow-x: auto;
  user-select: text;
  a {
    color: colors.$display-hyperlink;
  }
}
.markdown {
  // アラートの色
  // ref: https://github.com/antfu/markdown-it-github-alerts/blob/main/styles/github-colors-dark-class.css
  --color-note: #2f81f7;
  --color-tip: #3fb950;
  --color-warning: #d29922;
  --color-severe: #db6d28;
  --color-caution: #f85149;
  --color-important: #a371f7;
  // h1-h6のスタイルをデフォルトに戻す
  // https://www.w3schools.com/tags/tag_hn.asp
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    display: block;
    margin-left: 0;
    margin-right: 0;
    font-weight: bold;
    line-height: 1.55;
  }
  h1 {
    font-size: 28px;
    margin-top: 12px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid colors.$splitter;
  }
  h2 {
    font-size: 24px;
    margin-top: 20px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid colors.$splitter;
  }
  h3 {
    font-size: 20px;
    margin-top: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid colors.$splitter;
  }
  h4 {
    font-size: 18px;
    margin-top: 16px;
    margin-bottom: 12px;
  }
  h5 {
    font-size: 16px;
    margin-top: 12px;
    margin-bottom: 8px;
  }
  h6 {
    font-size: 14px;
    margin-top: 12px;
    margin-bottom: 8px;
  }
  p {
    margin-bottom: 16px;
  }
  ul, ol {
    padding-inline-start: 25px;
  }
  pre {
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 4px;
    overflow-x: auto;

    code {
      padding: 0;
      border-radius: 0;
      background: none;
    }
  }
  code {
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
  }
  *:last-child {
    margin-bottom: 0 !important;
  }
}

// Quasar用のカラー設定
.text-primary {
  color: colors.$primary;
}
.bg-primary {
  background: colors.$primary;
}

.text-display {
  color: colors.$display;
}
.bg-display {
  background: colors.$display;
}

.text-display-hyperlink {
  color: colors.$display-hyperlink;
}
.bg-display-hyperlink {
  background: colors.$display-hyperlink;
}

.text-display-on-primary {
  color: colors.$display-on-primary;
}
.bg-display-on-primary {
  background: colors.$display-on-primary;
}

.text-background {
  color: colors.$background;
}
.bg-background {
  background: colors.$background;
}

.text-surface {
  color: colors.$surface;
}
.bg-surface {
  background: colors.$surface;
}

.text-warning {
  color: colors.$warning;
}
.bg-warning {
  background: colors.$warning;
}

.text-warning-light {
  color: #f2be74;
}

.text-toolbar {
  color: colors.$toolbar;
}
.bg-toolbar {
  background: colors.$toolbar;
}

.text-toolbar-button {
  color: colors.$toolbar-button;
}
.bg-toolbar-button {
  background: colors.$toolbar-button;
  &:last-of-type {
    margin-right: 0;
  }
}

.text-toolbar-button-display {
  color: colors.$toolbar-button-display;
}
.bg-toolbar-button-display {
  background: colors.$toolbar-button-display;
}

.bg-toast {
  background: colors.$toast;
}
.text-toast-display {
  color: colors.$toast-display;
}
.text-toast-button-display {
  color: colors.$toast-button-display;
}

.bg-toast-warning {
  background: colors.$toast-warning;
}
.text-toast-display-warning {
  color: colors.$toast-display-warning;
}
.text-toast-button-display-warning {
  color: colors.$toast-button-display-warning;
}

.bg-surface-darken {
  background: rgba(colors.$surface-rgb, 0.45);
}

// ダイアログのサイズ
.dialog-card {
  width: 700px;
  max-width: 80vw;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 24px; /* Preferred icon size */
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
}
