@import url(./forms.css);
@import url(./shell.css);
@import url(./dialogs.css);
@import url(./pages.css);
@import url(./ribbon.css);
@import url(./notes/text.css);
@import url(./notes/canvas.css);
@import url(./notes/collections/table.css);

@font-face {
    font-family: "Inter";
    src: url(../../fonts/Inter/Inter-VariableFont_opsz,wght.ttf);
}

/*
 * GLOBAL VARIABLES
 */

:root {
    color-scheme: var(--theme-style);

    --main-font-family: "Inter", sans-serif;

    --main-font-size: normal;

    --tree-font-family: var(--main-font-family);
    --tree-font-size: normal;

    --detail-font-family: var(--main-font-family);
    --detail-font-size: normal;

    --monospace-font-family: JetBrainsLight, monospace;
    --monospace-font-size: normal;

    --left-pane-item-selected-shadow-size: 2px;

    --launcher-pane-vert-size: 58px;
    --launcher-pane-vert-icon-size: 150%;
    --launcher-pane-vert-button-margin: 6px;
    --launcher-pane-vert-button-gap: 3px;

    --launcher-pane-horiz-size: 54px;
    --launcher-pane-horiz-icon-size: 20px;
    --launcher-pane-horiz-button-margin: 8px;
    --launcher-pane-horiz-button-gap: 3px;

    --tree-actions-toolbar-horizontal-margin: 8px;
    --tree-actions-toolbar-vertical-margin: 8px;
    --tree-actions-toolbar-padding-size: 4px;
    --tree-actions-toolbar-collapsed-width: 40px;
    --tree-actions-toolbar-expand-button-size: 25px;

    --tab-bar-height: 50px;
    --tab-height: 36px;
    --tab-first-item-horiz-offset: 0;
    --new-tab-button-size: 24px;

    --center-pane-border-radius: 10px;

    --floating-button-height: 34px;
    --floating-button-width: 40px;
    --floating-button-icon-size: 20px;
    --floating-button-show-hide-button-size: 26px;

    --menu-padding-size: 8px;
    --menu-item-icon-vert-offset: -2px;
    --menu-submenu-mobile-background-color: rgba(255, 255, 255, 0.15);

    --more-accented-background-color: var(--card-background-hover-color);

    --timeline-left-gap: 20px;
    --timeline-right-gap: 20px;
    --timeline-item-top-padding: 4px;
    --timeline-item-bottom-padding: 8px;
    --timeline-bullet-size: 10px;
    --timeline-bullet-vertical-pos: 0.75em;
    --timeline-connector-size: 4px;

    --help-backdrop-blur: 10px;

    --icon-button-size: 32px;
    --icon-button-icon-ratio: 0.65;

    --opaque-icon-button-backdrop-filter: blur(32px) saturate(1000%);

    --modal-control-button-size: 22px;

    /* Theme capabilities */
    --tab-note-icons: true;
    --allow-background-effects: true;

    /* To ensure that a tree item's custom color remains sufficiently contrasted and readable,
     * the color is adjusted based on the current color scheme (light or dark). The lightness
     * component of the color represented in the CIELAB color space, will be
     * constrained to a certain percentage defined below.
     *
     * Note: the tree background may vary when background effects are enabled, so it is recommended
     * to maintain a higher contrast margin than on the usual note tree solid background. */

    /* The maximum perceptual lightness for the custom color in the light theme (%): */
    --tree-item-light-theme-max-color-lightness: 60;

    /* The minimum perceptual lightness for the custom color in the dark theme (%): */
    --tree-item-dark-theme-min-color-lightness: 65;

    /* Tooltips */
    --tooltip-border-radius: 6px;
    --tooltip-padding: 2px 8px 4px 8px;
    --tooltip-box-shadow: 
        -1px -1px 2px var(--tooltip-shadow-color),
        2px 2px 8px var(--tooltip-shadow-color);
    --tooltip-backdrop-filter: blur(5px);
    --tooltip-font-size: 0.9rem;

    --note-tooltip-box-shadow: 10px 10px 93px -25px var(--tool-dialog-shadow-color);
}

body {
    user-select: none;
}

.selectable-text {
    user-select: text;
}

body.backdrop-effects-disabled {
    /* Backdrop effects are disabled, replace the menu background color with the
     * no-backdrop fallback color */
    --menu-background-color: var(--menu-background-color-no-backdrop);
}

/*
 * MENUS
 *
 * Note: apply the "tn-dropdown-list" class for scrollable dropdown menus. Submenus are not
 * supported when this class is used.
 */

 .dropdown-menu:not(.static),
 :root .excalidraw .popover {
    border-radius: var(--dropdown-border-radius);
    padding: var(--padding, var(--menu-padding-size)) !important;
    font-size: 0.9rem !important;
}

/* Use this class for non-legacy menus */
.dropdown-menu.tn-dropdown-menu {
    --menu-item-icon-vert-offset: 0;
    white-space-collapse: discard;
}

.dropdown-menu.tn-dropdown-menu .dropdown-item .tn-icon {
    margin-inline-end: 6px;
}

.dropdown-menu.tn-dropdown-menu-scrollable {
    /* Note: scrollable dropdowns does not support submenus */
    max-height: 90vh;
    overflow-y: auto;
}

body.desktop .dropdown-menu::before,
:root .ck.ck-dropdown__panel::before,
:root .excalidraw .popover::before,
body.zen .note-split .ribbon-container .classic-toolbar-widget::before {
    content: "";
    backdrop-filter: var(--dropdown-backdrop-filter);
    border-radius: var(--dropdown-border-radius);
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    bottom: 0;
    z-index: -1;
}

body.desktop .dropdown-menu.tn-dropdown-list {
    backdrop-filter: var(--dropdown-backdrop-filter);
}

body.desktop .dropdown-submenu .dropdown-menu::before {
    content: unset;
}

body.desktop .dropdown-menu.tn-dropdown-list::before {
    display: none;
}

body.desktop .dropdown-submenu .dropdown-menu {
    backdrop-filter: var(--dropdown-backdrop-filter);
    background: transparent;
}

.dropdown-item,
.excalidraw .context-menu .context-menu-item {
    --menu-item-start-padding: 8px;
    --menu-item-end-padding: 22px;
    --menu-item-vertical-padding: 2px;

    /* Note: the right padding should also accommodate the submenu arrow. */
    border-radius: 6px;
    cursor: default !important;
}

.dropdown-item:not(.dropdown-submenu),
body.desktop .dropdown-item.dropdown-submenu .dropdown-toggle,
.excalidraw .context-menu .context-menu-item {
    padding-top: var(--menu-item-vertical-padding) !important;
    padding-bottom: var(--menu-item-vertical-padding) !important;
    padding-inline-start: var(--menu-item-start-padding) !important;
    padding-inline-end: var(--menu-item-end-padding) !important;
}

.dropdown-item.dropdown-submenu {
    padding: 0 !important;

    .dropdown-toggle {
        flex-grow: 1;
    }
}

body.desktop .dropdown-menu:has(> .dropdown-submenu.dropstart) > .dropdown-item:not(.dropdown-submenu),
body.desktop .dropdown-menu:has(> .dropdown-submenu.dropstart) > .dropdown-item.dropdown-submenu .dropdown-toggle {
    padding-inline-end: var(--menu-item-start-padding) !important;
    padding-inline-start: var(--menu-item-end-padding) !important;
}

:root .dropdown-item:focus-visible {
    outline: 2px solid var(--input-focus-outline-color) !important;
    background-color: transparent;
    color: unset;
}

:root .dropdown-item:active {
    background: unset;
}

body.mobile .dropdown-submenu {
    padding: 0 !important;
}

body.mobile .dropdown-item:not(:last-of-type) {
    margin-bottom: 0.5em;
}

html body .dropdown-item.disabled,
html body .dropdown-item[disabled] {
    color: var(--menu-text-color) !important;
    opacity: var(--menu-item-disabled-opacity);
}

.dropdown-item:not(.disabled) .destructive-action-icon,
.dropdown-item:not(.disabled) .bx-trash {
    --menu-item-icon-color: var(--dropdown-item-icon-destructive-color);
}
/* Badges */
:root .badge {
    --bs-badge-color: var(--badge-text-color);
    --bs-badge-font-weight: 500;

    background: var(--badge-background-color);
    text-transform: uppercase;
    letter-spacing: .2pt;
}

/* Menu item icon */
.dropdown-item .tn-icon {
    translate: 0 var(--menu-item-icon-vert-offset);
    color: var(--menu-item-icon-color) !important;
    font-size: 1.1em;
}

/* Menu item keyboard shortcut */
.dropdown-item kbd,
.excalidraw .context-menu-item__shortcut {
    font-family: unset !important;
    font-size: unset !important;
    color: var(--menu-item-keyboard-shortcut-color) !important;
    padding-top: 0;
}

.dropdown-item span.keyboard-shortcut {
    color: var(--menu-item-keyboard-shortcut-color) !important;
    margin-inline-start: 16px;
}

.dropdown-divider,
.excalidraw .context-menu hr {
    position: relative;
    border-color: transparent !important;
    overflow: visible;
}

.dropdown-divider::after,
.excalidraw .context-menu hr::before {
    position: absolute;
    content: "";
    top: -1px;
    inset-inline-start: calc(0px - var(--menu-padding-size));
    inset-inline-end: calc(0px - var(--menu-padding-size));
    border-top: 1px solid var(--menu-item-delimiter-color);
}

/* Menu item arrow */
body.mobile .dropdown-submenu .dropdown-toggle::after,
body.desktop .dropdown-submenu:not(.dropstart) .dropdown-toggle::after {
    content: "\ed3b" !important;
    position: absolute;
    display: flex !important;
    align-items: center;
    justify-content: center;
    top: 0;
    inset-inline-end: 0;
    margin: unset !important;
    border: unset !important;
    padding: 0 4px;
    font-family: boxicons;
    font-size: 1.2em;
    color: var(--menu-item-arrow-color) !important;
}

body.mobile .dropdown-submenu.dropstart .dropdown-toggle::before {
    content: unset;
}

body.desktop .dropdown-submenu.dropstart .dropdown-toggle::before {
    content: "\ea4d" !important;
    position: absolute;
    display: flex !important;
    align-items: center;
    justify-content: center;
    top: 0;
    inset-inline-start: 0;
    margin: unset !important;
    border: unset !important;
    padding: 0 4px;
    font-family: boxicons;
    font-size: 1.2em;
    color: var(--menu-item-arrow-color) !important;
}

body[dir=rtl] .dropdown-menu:not([data-popper-placement="bottom-start"]) .dropdown-toggle::after {
    content: "\ea4d" !important;
}

/* Menu item group heading */

/* The heading body */
.dropdown-menu h6,
.excalidraw .dropdown-menu-container .dropdown-menu-group-title,
.excalidraw .dropdown-menu-container div[data-testid="canvas-background-label"] {
    position: relative;
    background: transparent;
    padding: 1em 8px 14px 8px;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 1pt;
    color: var(--menu-item-group-header-color) !important;
}

/* The delimiter line */
.dropdown-menu h6::before,
.excalidraw .dropdown-menu-container .dropdown-menu-group-title::before,
.excalidraw .dropdown-menu-container div[data-testid="canvas-background-label"]::before {
    content: "";
    position: absolute;
    bottom: 8px;
    inset-inline-start: calc(0px - var(--menu-padding-size));
    inset-inline-end: calc(0px - var(--menu-padding-size));
    border-top: 1px solid var(--menu-item-delimiter-color);
}

/* Static menus (used as a list, such as on the note revisions dialog) */
body.desktop .dropdown-menu.static {
    box-shadow: unset;
    border-radius: 4px;
    border: unset;
    background-color: var(--card-background-color) !important;
    padding: var(--menu-padding-size) !important;
    user-select: none;
}

body.desktop .dropdown-menu.static .dropdown-item.active {
    --active-item-text-color: var(--menu-text-color);
}

/* #region Mobile tweaks for dropdown menus */
body.mobile #context-menu-cover {
    transition: background-color 150ms ease-in;

    &.show {
        background: rgba(0, 0, 0, 0.7);
    }

    &.global-menu-cover {
        bottom: calc(var(--mobile-bottom-offset) + var(--launcher-pane-size));

        @media (min-width: 992px) {
            bottom: 0;
        }
    }
}

body.mobile .dropdown-menu.mobile-bottom-menu,
body.mobile .dropdown.global-menu .dropdown-menu {
    border-radius: var(--dropdown-border-radius) var(--dropdown-border-radius) 0 0;
}

body.mobile .dropdown-menu {
    --dropdown-menu-padding-vertical: 0.7em;
    --dropdown-menu-padding-horizontal: 1em;
    --hover-item-background-color: var(--card-background-color);
    font-size: 1em !important;
    backdrop-filter: var(--dropdown-backdrop-filter);
    position: relative;

    .dropdown-toggle::after {
        top: 0.5em;
        right: var(--dropdown-menu-padding-horizontal);
        transform: translateX(50%) rotate(90deg);
    }

    .dropdown-item.submenu-open .dropdown-toggle::after {
        transform: rotate(270deg);
    }

    .dropdown-item,
    .dropdown-custom-item {
        margin-bottom: 0;
        padding: var(--dropdown-menu-padding-vertical) var(--dropdown-menu-padding-horizontal) !important;
        background: var(--card-background-color);
        border-bottom: 1px solid var(--menu-item-delimiter-color) !important;
        border-radius: 0;
    }

    .dropdown-item:first-of-type,
    .dropdown-divider + .dropdown-item,
    .dropdown-custom-item:first-of-type,
    .dropdown-divider + .dropdown-custom-item {
        border-top-left-radius: 6px;
        border-top-right-radius: 6px;
    }

    .dropdown-item:last-of-type,
    .dropdown-item:has(+ .dropdown-divider),
    .dropdown-custom-item:last-of-type,
    .dropdown-custom-item:has(+ .dropdown-divider) {
        border-bottom-left-radius: 6px;
        border-bottom-right-radius: 6px;
        border-bottom: 0 !important;
    }

    .dropdown-divider {
        visibility: hidden;
    }

    .dropdown-submenu {
        padding: 0 !important;
        backdrop-filter: unset !important;

        .dropdown-toggle {
            padding: var(--dropdown-menu-padding-vertical) var(--dropdown-menu-padding-horizontal);
        }

        .dropdown-menu {
            --menu-background-color: --menu-submenu-mobile-background-color;
            --bs-dropdown-divider-margin-y: 0.25rem;
            border-radius: 0;
            max-height: 0;
            transition: max-height 100ms ease-in;
            display: block !important;

            &.show {
                max-height: 1000px;
                padding: 0.5rem 0.75rem !important;
            }
        }

        &.submenu-open {
            .dropdown-toggle {
                padding-bottom: var(--dropdown-menu-padding-vertical);
            }
        }
    }

    .dropdown-custom-item:has(.note-color-picker) {
        overflow-x: auto;
    }

    .note-color-picker {
        padding: 0;
        width: fit-content;

        .color-cell {
            --color-picker-cell-size: 26px;
            flex-shrink: 0;
        }
    }
}
/* #endregion */

body.desktop .dropdown-menu .dropdown-toggle::after {
    height: 100%;
}



/* Dropdown item button (used in zoom buttons in global menu) */

li.dropdown-item a.dropdown-item-button {
    border: unset;
}

li.dropdown-item a.dropdown-item-button.tn-icon {
    color: var(--menu-text-color) !important;
}

li.dropdown-item a.dropdown-item-button:focus-visible {
    outline: 2px solid var(--input-focus-outline-color) !important;
}

:root .dropdown-menu .note-color-picker {
    padding: 4px 10px;
    --note-color-picker-clear-color-cell-background: var(--main-text-color);
    --note-color-picker-clear-color-cell-selection-outline-color: var(--main-text-color);
}

/*
 * TOASTS
 */

 #toast-container {
    /* The vertical gap between toasts */
    gap: 10px;
}

#toast-container .toast {
    --bs-toast-padding-x: 12px;
    --bs-border-radius: 8px;
    --bs-toast-bg: var(--toast-background);
    --bs-toast-color: var(--toast-text-color);
    --modal-control-button-background: var(--toast-close-button-background);
    --modal-control-button-color: var(--bs-toast-color);

    display: flex;
    flex-direction: column;
    backdrop-filter: blur(6px);
}

#toast-container .toast .toast-header {
    background: transparent !important;
    border-bottom: none;
    color: var(--toast-text-color) !important;
}

#toast-container .toast .toast-header strong > * {
    vertical-align: middle;
}

#toast-container .toast .toast-header .btn-close,
#toast-container .toast .toast-close .btn-close {
    margin: 0 0 0 12px;
}

#toast-container .toast .toast-body {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-top: 0;
}

#toast-container .toast:not(.no-title) .tn-icon {
    margin-inline-end: 0.5em;
    font-size: 1.1em;
    opacity: 0.85;
}

#toast-container .toast.no-title .tn-icon {
    margin-inline-end: 0;
    font-size: 1.3em;
}

#toast-container .toast.no-title .toast-body {
    padding-top: var(--bs-toast-padding-x);
    color: var(--toast-text-color);
}

/*
 * NOTE TOOLTIPS
 */

.tooltip.note-tooltip {
    --tooltip-background-color: var(--note-tooltip-background-color);
    --tooltip-foreground-color: var(--main-text-color);
    --tooltip-box-shadow: var(--note-tooltip-box-shadow);
    
    > .tooltip-inner {
        outline: 1px solid var(--main-border-color);
        border-radius: 12px;
        min-height: 120px;
    }
    
    .rendered-content {
        font-size: .8em;
    }

    .open-popup-button {
        display: flex;
        width: 32px;
        height: 32px;
        inset-inline-end: 20px;
        inset-block-end: 20px;
        justify-content: center;
        align-items: center;
        border-radius: 50%;

        backdrop-filter: var(--opaque-icon-button-backdrop-filter);
        background-color: var(--opaque-icon-button-background);
        color: var(--opaque-icon-button-color);

        &:hover {
            background-color: var(--opaque-icon-button-hover-background-color);
            color: var(--opaque-icon-button-hover-color);
        }
    }
}

.tooltip .tooltip-inner:has(.note-tooltip-content) {
    border-radius: 8px;
}

.note-tooltip-content {
    padding: 8px;
    min-height: 56px;
}

.note-tooltip-title .note-title-with-path {
    display: flex;
    flex-direction: column-reverse;
}

.note-tooltip-title a {
    color: inherit !important;
}

.note-tooltip-title.note-no-content {
    margin: 0;
}

.note-tooltip-title:not(.note-no-content) .note-title-with-path {
    padding-bottom: 6px;
    border-bottom: 2px solid currentColor;
}

.note-tooltip-content .note-path {
    display: block;
    color: var(--muted-text-color);
    font-size: 0.75em;
}

.note-tooltip-content .note-tooltip-attributes {
    margin-top: -4px;
    font-size: 0.75em;
}

.note-tooltip-content .rendered-content {
    padding-top: 12px;
}

/* NOTE PATHS */

.note-path .path-bracket {
    /* Hide the leading and trailing bracket from the path */
    display: none;
}

.note-path .path-delimiter {
    /* Hide the path delimiters (slashes) */
    display: none;
}

.note-path .path-delimiter + span::before {
    /* Replace the path delimiters with arrows */
    display: inline-block;
    content: "\ed3b";
    padding: 0 0.25em;
    font-family: boxicons;
    opacity: 0.75;
    transform: translateY(4%);
}

/*
 * NOTE SEARCH SUGGESTIONS
 */

/* List body */
.jump-to-note-dialog .jump-to-note-results .aa-suggestions,
.note-detail-empty .aa-suggestions {
    padding: 0;
}

/* List item */
.jump-to-note-dialog .aa-suggestion,
.note-detail-empty .aa-suggestion {
    border-radius: 6px;
    color: var(--menu-text-color);
    cursor: default;
}

/* Selected list item */
.jump-to-note-dialog .aa-suggestions div.aa-cursor,
.note-detail-empty .aa-suggestions div.aa-cursor {
    background: var(--hover-item-background-color);
    color: var(--hover-item-text-color);
}

/*
 * Alert bars
 */

div.alert {
    margin-bottom: 8px;
    background: var(--alert-bar-background) !important;
    color: var(--main-text-color);
    border-radius: 8px;
    font-size: .85em;
}

div.alert p + p {
    margin-block: 1em 0;
}
