@import "redefine/mermaid.dark.css";
@import "redefine/codeblock.dark.css";
@import "redefine/sourcemode.dark.css";

:root {
  --side-bar-bg-color: #202124;
  --control-text-color: #777;

  --code-foreground: #bfbfc7;
  --code-background: #35363b;
  --highlight-background: #21252b;
  --highlight-foreground: #bfbfc7;
  --highlight-keyword: #569cd6;
  --highlight-link: #569cd6;
  --highlight-built-in: #4ec9b0;
  --highlight-number: #b8d7a3;
  --highlight-string: #d69d85;
  --highlight-regexp: #9a5334;
  --highlight-subst: #dcdcdc;
  --highlight-comment: #57a64a;
  --highlight-doctag: #608b4e;
  --highlight-meta: #9b9b9b;
  --highlight-variable: #bd63c5;
  --highlight-attr: #9cdcfe;
  --highlight-section: #ffd700;
  --highlight-bullet: #d7ba7d;
  --highlight-addition: #144212;
  --highlight-deletion: #600;

  --shadow-color-1: rgba(255, 255, 255, 0.08);
  --shadow-color-2: rgba(255, 255, 255, 0.05);
  --shadow-hover-color: rgba(69, 69, 69, 0.28);
  --background-color: #202124;
  --background-color-transparent: rgba(32, 33, 36, 0.4);
  --second-background-color: #242529;
  --third-background-color: #292b2f;
  --primary-color: #005080;
  --first-text-color: #d2d2d7;
  --second-text-color: #cbcbd1;
  --third-text-color: #9595a2;
  --fourth-text-color: #242429;
  --default-text-color: #bebec6;
  --invert-text-color: #373d3f;
  --border-color: #4a4c53;
  --selection-color: #0068a6;
  --scrollbar-color: #898989;
  --scrollbar-color-hover: #a1a1a1;
  --scroll-bar-bg-color: #2a2c30;
  --link-color: #c5c5cc;
  --copyright-info-color: #a30029;
  --note-blue-title-bg: #1e3e46;
  --note-red-title-bg: #4e1e1e;
  --note-cyan-title-bg: #1e4e4e;
  --note-green-title-bg: #1e4e1e;
  --note-yellow-title-bg: #4e4e1e;
  --note-gray-title-bg: #4e4e4e;
  --note-type-title-bg: #4e3a1e;
  --note-black-title-bg: #1e1e1e;
  --note-purple-title-bg: #4e1e4e;
  --redefine-box-shadow: var(--shadow-color-2) 0px 6px 24px 0px,
    var(--shadow-color-1) 0px 0px 0px 1px;
  --redefine-box-shadow-hover: var(--shadow-color-2) 0px 6px 24px 0px,
    var(--shadow-color-1) 0px 0px 0px 1px,
    var(--shadow-color-1) 0px 0px 0px 1px inset;
  --redefine-box-shadow-flat: var(--shadow-color-2) 0px 1px 4px 0px,
    var(--shadow-color-1) 0px 0px 0px 1px;
  --redefine-box-shadow-flat-hover: var(--shadow-color-2) 0px 1px 4px 0px,
    var(--shadow-color-1) 0px 0px 0px 1px,
    var(--shadow-color-1) 0px 0px 0px 1px inset;
  --redefine-border-radius-none: 0px;
  --redefine-border-radius-xsmall: 4px;
  --redefine-border-radius-xsmall-top: 4px 4px 0px 0px;
  --redefine-border-radius-xsmall-bottom: 0px 0px 4px 4px;
  --redefine-border-radius-small: 9px;
  --redefine-border-radius-small-top: 9px 9px 0px 0px;
  --redefine-border-radius-small-bottom: 0px 0px 9px 9px;
  --redefine-border-radius-medium: 14px;
  --redefine-border-radius-medium-top: 14px 14px 0px 0px;
  --redefine-border-radius-medium-bottom: 0px 0px 14px 14px;
  --redefine-border-radius-large: 18px;
  --redefine-border-radius-large-top: 18px 18px 0px 0px;
  --redefine-border-radius-large-bottom: 0px 0px 18px 18px;
  --redefine-border-radius-xlarge: 24px;
  --redefine-border-radius-xlarge-top: 24px 24px 0px 0px;
  --redefine-border-radius-xlarge-bottom: 0px 0px 24px 24px;
  --redefine-border-radius-xxlarge: 48px;
  --redefine-border-radius-xxlarge-top: 48px 48px 0px 0px;
  --redefine-border-radius-xxlarge-bottom: 0px 0px 48px 48px;
  --redefine-border-radius-full: 50%;
  --redefine-border-radius-full-top: 50% 50% 0px 0px;
  --redefine-border-radius-full-bottom: 0px 0px 50% 50%;

  --focus-mode-dim-color: #686868;
}

@include-when-export url(https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext);
@include-when-export url(https://fonts.googleapis.com/css2?family=Source+Code+Pro);

/* Import custom fonts */
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: normal;
  src: local("Open Sans Regular"), local("OpenSans-Regular"),
    url("./redefine/open-sans-v17-latin-ext_latin-regular.woff2")
      format("woff2");
}

@font-face {
  font-family: "Open Sans";
  font-style: italic;
  font-weight: normal;
  src: local("Open Sans Italic"), local("OpenSans-Italic"),
    url("./redefine/open-sans-v17-latin-ext_latin-italic.woff2")
      format("woff2");
}

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: bold;
  src: local("Open Sans Bold"), local("OpenSans-Bold"),
    url("./redefine/open-sans-v17-latin-ext_latin-700.woff2")
      format("woff2");
}

@font-face {
  font-family: "Open Sans";
  font-style: italic;
  font-weight: bold;
  src: local("Open Sans Bold Italic"), local("OpenSans-BoldItalic"),
    url("./redefine/open-sans-v17-latin-ext_latin-700italic.woff2")
      format("woff2");
}

@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-weight: 400;
  src: url("./redefine/noto-sans-sc-v26-latin-regular.woff2") format("woff2"),
    url("./redefine/noto-sans-sc-v26-latin-regular.woff") format("woff");
}

@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-weight: 700;
  src: url("./redefine/noto-sans-sc-v26-latin-700.woff2") format("woff2"),
    url("./redefine/noto-sans-sc-v26-latin-700.woff") format("woff");
}

html {
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: "Open Sans", "Noto Sans SC", "Clear Sans", "Helvetica Neue",
    Helvetica, Arial, "Segoe UI Emoji", sans-serif;
  color: var(--default-text-color);
  line-height: 1.6;
}

html,
body {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  background: var(--background-color);
  fill: currentColor;
  line-height: 1.625rem;
}

#write {
  max-width: 860px;
  margin: 0 auto;
  padding: 30px;
  padding-bottom: 100px;
}

@media only screen and (min-width: 1400px) {
  #write {
    max-width: 1024px;
  }
}

@media only screen and (min-width: 1800px) {
  #write {
    max-width: 1200px;
  }
}

#write > ul:first-child,
#write > ol:first-child {
  margin-top: 30px;
}

a {
  color: var(--link-color);
  outline: none;
  text-decoration: underline;
  padding-bottom: 2px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  position: relative;
  margin-top: 1rem;
  margin-bottom: 1rem;
  font-weight: bold;
  line-height: 1.5;
  cursor: text;
  font-family: "Open Sans", "Noto Sans SC", sans-serif;
  color: var(--first-text-color);
}

h1 {
  font-size: 3.2rem;
  font-weight: 600;
  line-height: 1.2;
  border-bottom: 2px solid var(--shadow-color-1);
}

h2 {
  font-size: 2.5rem;
  line-height: 1.225;
  border-bottom: 2px solid var(--shadow-color-1);
  margin-top: 4rem;
}

h3 {
  font-size: 1.8rem;
  font-weight: 550;
  margin-top: 2.8rem;
}

h4 {
  font-size: 1.5rem;
  font-weight: 550;
  margin-top: 2.5rem;
}

h5 {
  font-size: 1.28rem;
  font-weight: 550;
  margin-top: 2.2rem;
}

h6 {
  font-size: 1em;
  font-weight: 550;
  line-height: 1.2;
  margin-top: 2rem;
}

img {
  border-radius: 14px;
  border-left: none !important;
  border-right: none !important;
}

blockquote,
ul,
ol,
dl,
table {
  margin: 1em 0;
}

p {
  line-height: 1.5;
  color: var(--default-text-color);
  margin-bottom: 1rem;
  margin-top: 0;
}

li > ol,
li > ul {
  margin: 0 0;
}

ul,
ol {
  padding-left: 30px;
}

ul:first-child,
ol:first-child {
  margin-top: 0;
}

ul:last-child,
ol:last-child {
  margin-bottom: 0;
}

blockquote {
  border-left: 4px solid var(--default-text-color);
  padding: 0 15px;
  color: var(--second-text-color);
}

blockquote blockquote {
  padding-right: 0;
}

table {
  border-spacing: 0;
  padding: 0;
  word-break: initial;
  border-collapse: collapse;
  overflow: auto;
  margin-bottom: 1.2rem;
}

table tr {
  margin: 0;
  padding: 0;
}

table tr:nth-child(2n) {
  background-color: var(--second-background-color);
}

thead th {
  border-bottom: 1px solid var(--shadow-color-1);
  background-color: var(--third-background-color) !important;
}

thead tr {
  border-top: 1px solid var(--shadow-color-1);
}

table th {
  font-weight: bold;
  border-bottom: 0;
  margin: 0;
  padding: 8px 16px;
  border-left: 1px solid var(--shadow-color-1);
}

table th:last-child {
  border-right: 1px solid var(--shadow-color-1);
}

table td {
  margin: 0;
  padding: 8px 16px;
  border-left: 1px solid var(--shadow-color-1);
}

table td:last-child {
  border-right: 1px solid var(--shadow-color-1);
}

table th:first-child,
table td:first-child {
  margin-top: 0;
}

table th:last-child,
table td:last-child {
  margin-bottom: 0;
}

tbody tr:last-child {
  border-bottom: 1px solid var(--shadow-color-1);
}

.CodeMirror-lines {
  padding: 10px 5px 0px 15px;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  border-top: 1px solid var(--shadow-color-1);
}

.CodeMirror-gutters {
  border-right: 0 !important;
  border-top: 1px solid var(--shadow-color-1);
}

.code-tooltip {
  box-shadow: var(--redefine-box-shadow-flat);
  border-top: 1px solid var(--shadow-color-1);
  border-radius: var(--redefine-border-radius-small);
}

.md-fences,
code,
tt {
  border: 1px solid var(--code-background);
  background-color: var(--third-background-color);
  border-radius: 3px;
  padding: 0;
  padding: 5px 10px 10px 0px;
  font-size: 0.9em;
}

code {
  background-color: var(--code-background);
  padding: 2px 6px 2px 6px;
}

.md-task-list-item > input {
  margin-left: -1.3em;
}

@media print {
  html {
    font-size: 13px;
  }
  pre {
    page-break-inside: avoid;
    word-wrap: break-word;
  }
}

.md-fences {
  background: var(--third-background-color);
  border-radius: var(--redefine-border-radius-large);
  border: 1px solid var(--shadow-color-1);
  padding-top: 40px;
  margin-top: 10px;
  margin-bottom: 1.2rem;
  position: relative;
  padding-bottom: 15px;
  padding-right: 0px;
  padding-left: 0px;
}

.md-fences::after {
  content: " ";
  position: absolute;
  border-radius: var(--redefine-border-radius-full);
  background: #fc625d;
  width: 12px;
  height: 12px;
  top: 0;
  left: 20px;
  margin-top: 13px;
  -webkit-box-shadow: 20px 0px #fdbc40, 40px 0px #35cd4b;
  box-shadow: 20px 0px #fdbc40, 40px 0px #35cd4b;
  z-index: 3;
}

#write pre.md-meta-block {
  padding: 1rem;
  font-size: 85%;
  line-height: 1.45;
  background-color: var(--second-background-color);
  border: 0;
  border-radius: var(--redefine-border-radius-small);
  color: #9f9f9f;
  margin-top: 0 !important;
}

.mathjax-block > .code-tooltip {
  bottom: 0.375rem;
}

.md-mathjax-midline {
  background: var(--background-color);
}

#write > h3.md-focus:before {
  left: -1.5625rem;
  top: 0.375rem;
}
#write > h4.md-focus:before {
  left: -1.5625rem;
  top: 0.285714286rem;
}
#write > h5.md-focus:before {
  left: -1.5625rem;
  top: 0.285714286rem;
}
#write > h6.md-focus:before {
  left: -1.5625rem;
  top: 0.285714286rem;
}
.md-image > .md-meta {
  border-radius: 3px;
  padding: 2px 0px 0px 4px;
  font-size: 0.9em;
  color: inherit;
}

.md-tag {
  color: var(--third-text-color);
  opacity: 1;
}

.md-toc {
  margin-top: 20px;
  padding-bottom: 20px;
}

.sidebar-tabs {
  border-bottom: none;
}

#typora-quick-open {
  border: 1px solid var(--shadow-color-1);
  background-color: var(--second-background-color);
}

#typora-quick-open-item {
  background-color: var(--second-background-color);
  border-color: var(--second-background-color) var(--second-background-color)
    var(--second-background-color) var(--shadow-color-1);
  border-style: solid;
  border-width: 1px;
}

/** Focus mode styles */
.on-focus-mode .md-end-block:not(.md-focus):not(.md-focus-container) {
  color: var(--focus-mode-dim-color) !important;
}

.on-focus-mode .md-end-block:not(.md-focus):not(.md-focus-container) * {
  color: var(--focus-mode-dim-color) !important;
}

.on-focus-mode .md-end-block:not(.md-focus) img,
.on-focus-mode .md-task-list-item:not(.md-focus-container) > input {
  opacity: 0.5 !important;
}

.on-focus-mode li[cid]:not(.md-focus-container) {
  color: var(--focus-mode-dim-color) !important;
}

.on-focus-mode .md-fences.md-focus .CodeMirror-code > *:not(.CodeMirror-activeline) *,
.on-focus-mode .CodeMirror.cm-s-inner:not(.CodeMirror-focused) * {
  color: var(--focus-mode-dim-color) !important;
}

.on-focus-mode .md-focus,
.on-focus-mode .md-focus-container {
  color: var(--default-text-color);
}

header,
.context-menu,
.megamenu-content,
footer {
  font-family: "Segoe UI", "Arial", sans-serif;
}

.file-node-content:hover .file-node-icon,
.file-node-content:hover .file-node-open-state {
  visibility: visible;
}

.mac-seamless-mode #typora-sidebar {
  background-color: var(--side-bar-bg-color);
}

.md-lang {
  color: #b4654d;
}

#md-notification .btn {
  border: 0;
}

.dropdown-menu .divider {
  border-color: var(--shadow-color-1);
}

.ty-preferences .window-content {
  background-color: var(--background-color);
}

.ty-preferences .nav-group-item.active {
  color: var(--default-text-color);
  background: var(--third-background-color);
}

.menu-item-container a.menu-style-btn {
  background-color: var(--second-background-color);
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0)
  );
}

.outline-item:hover {
  background-color: var(--third-background-color);
  text-decoration: none;
}

.outline-label:hover {
  text-decoration: none;
}

.file-list-item {
  border-bottom: none;
}

.file-list-item-summary {
  opacity: 1;
}

.file-list-item.active:first-child {
  border-top: none;
}

.file-node-background {
  height: 32px;
}

.file-library-node.active > .file-node-content,
.file-list-item.active {
  color: var(--first-text-color);
}

.file-library-node.active > .file-node-background {
  background-color: var(--third-background-color);
}
.file-list-item.active {
  background-color: var(--third-background-color);
}

.file-node-content {
  cursor: pointer;
}

.md-rawblock-control:not(.md-rawblock-tooltip) {
  background-color: var(--second-background-color);
}

.md-rawblock-on-edit > .md-rawblock-tooltip,
.md-rawblock:hover > .md-rawblock-container,
.md-rawblock:hover > .md-rawblock-tooltip {
  background-color: var(--second-background-color);
}

.sidebar-footer {
  border-top: 1px solid var(--shadow-color-1);
}

.file-node-content:hover {
  color: var(--second-text-color);
}

/* Fix for file node children display */
.file-node-expanded > .file-node-children {
  display: grid;
}

/* New additions to fix white borders in menus and UI elements */

/* Menu borders */
.menu,
.dropdown-menu,
.context-menu,
#md-searchpanel,
.md-notification-container,
.popover {
  background-color: var(--second-background-color);
  border: 1px solid var(--shadow-color-1);
}


.dropdown-menu .divider,
.context-menu .divider,
.popover .divider {
  background-color: var(--shadow-color-1);
}

.popover-title {
  background-color: var(--second-background-color);
  border-bottom: 1px solid var(--shadow-color-1);
}

.popover-content {
  background-color: var(--second-background-color);
}

.modal-content {
  background-color: var(--second-background-color);
  border: 1px solid var(--shadow-color-1);
}

.modal-header,
.modal-footer {
  border-color: var(--shadow-color-1);
}

.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

.btn {
  background-color: var(--second-background-color);
  border: 1px solid var(--shadow-color-1);
  color: var(--default-text-color);
}

.btn:hover,
.btn:focus {
  background-color: var(--third-background-color);
}

.form-control {
  background-color: var(--second-background-color);
  border: 1px solid var(--shadow-color-1);
  color: var(--default-text-color);
}

/* Adjusting borders for other UI elements */
#md-searchpanel input,
#md-searchpanel .btn,
#searchpanel-msg {
  border: 1px solid var(--shadow-color-1);
}

#searchpanel-msg {
  background-color: var(--second-background-color);
  color: var(--default-text-color);
}

.ty-preferences input[type="search"],
.ty-preferences select {
  background-color: var(--second-background-color);
  border: 1px solid var(--shadow-color-1);
  color: var(--default-text-color);
}

.ty-preferences .btn-default {
  background-color: var(--second-background-color);
  border: 1px solid var(--shadow-color-1);
}

.ty-preferences .btn-default:hover {
  background-color: var(--third-background-color);
}

/* Adjusting borders in the sidebar */
#typora-sidebar {
  border-right: 1px solid var(--shadow-color-1);
}

.sidebar-tab {
  color: var(--default-text-color);
}

.sidebar-tabs {
  border-bottom: 1px solid var(--shadow-color-1);
}

.sidebar-footer {
  border-top: 1px solid var(--shadow-color-1);
}

hr {
  border: none; /* Remove default border */
  border-top: 1px solid var(--shadow-color-1); /* Use a suitable color variable */
  margin: 24px 0; /* Adjust margins as desired */
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 4px; /* Reduce the width to make it thinner */
  background-color: transparent; /* Make the scrollbar track transparent */
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2); /* Set a low-opacity color for the thumb */
  border-radius: 2px; /* Round the edges for a sleeker look */
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.4); /* Slightly increase visibility on hover */
}
