* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --bg-color: #ffffff;
    --hover-bg: #f0f0f0;
    --text-color: #2c3e50;
    --text-color-note: #8b9cad;
    --toolbar-bg: #f8f9fa;
    --toolbar-bottom-bg: #f3f5f7;
    --border-color: #dee2e6;
    --font-body: 'Vazirmatn', Tahoma, Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;
    --font-code: Vazircode, Consolas, Courier, monospace;
    --font-size-small: 14px;
}

[data-theme="dark"] body,
[data-theme="dark"] .toolbar,
[data-theme="dark"] .modal {
    --bg-color: #1a1a1a;
    --hover-bg: #292929;
    --text-color: #f8f9fa;
    --text-color-note: #8b9cad;
    --toolbar-bg: #2d2d2d;
    --toolbar-bottom-bg: #292929;
    --border-color: #404040;
}

/* width */
::-webkit-scrollbar {
    width: 10px;
}

/* Track */
::-webkit-scrollbar-track {
    background: var(--border-color);
    /* border-radius: 5px; */
}

/* Handle */
::-webkit-scrollbar-thumb {
    background: #888;
    cursor: grab;
}

/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
    background: #555;
}

input,
textarea,
button,
select,
a {
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100vh;
    height: -webkit-fill-available;
    height: 100svh;
    /* overflow: hidden !important; */
    overscroll-behavior: none;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    font-family: var(--font-body);
    background: var(--bg-color);
    color: var(--text-color);
    position: relative;
}

select,
button,
input {
    outline: none;
}

#editor,
.toastui-editor-defaultUI,
.toastui-editor-defaultUI-toolbar {
    border: 0 !important;
    border-radius: 0 !important;
}

.toastui-editor-mode-switch {
    border-radius: 0 !important;
}

/* .toolbar { */
/* display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--border-color); */
/* } */

.toolbar .toolbar-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem;
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--border-color);
}

.toolbar .toolbar-bottom {
    display: flex;
    justify-content: start;
    align-items: center;
    /* padding: 0.5rem; */
    background: var(--toolbar-bottom-bg);
    border-bottom: 1px solid var(--border-color);
}

.toolbar .toolbar-bottom .file-name {
    font-weight: bold;
    position: relative;
    top: 2px;
    font-size: 14px;
    padding-left: 5px;
    background-color: transparent;
    border: 0;
    /* border: 1px solid red; */
    outline: none;
    color: var(--text-color);
    padding: 0.3rem;
    display: block;
    width: 100%;
    font-family: var(--font-body);
}

.toolbar .toolbar-bottom svg {
    margin-left: 12px;
    margin-right: 5px;
    /* padding: 1px; */
}

.toolbar-logo,
.left-controls,
.right-controls,
.right-controls label {
    display: flex;
    align-items: center;
}

.left-controls,
.right-controls {
    display: flex;
    gap: 0.5rem;
}

.center-title {
    font-size: 1.25rem;
    font-weight: bold;
}

.toolbar-logo {
    flex-direction: column;
}

.editor-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* #editor,
.preview-pane { */
/* flex: 1; */
/* padding: 1rem; */
/* overflow-y: auto; */
/* overflow-y: hidden; */
/* transition: all 0.3s ease; */
/* } */

#editor {
    width: 100%;
    border-right: 1px solid var(--border-color);
}

[dir="rtl"] #editor {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

/* .preview-pane {
    font-family: var(--font-body);
    line-height: 1.6;
}

.preview-pane h1,
.preview-pane h2,
.preview-pane h3 {
    color: var(--text-color);
} */

button,
select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
}

button:not(.toastui-editor-toolbar-icons):hover {
    background: var(--hover-bg);
}

/* @media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
    }

    #editor,
    .preview-pane {
        height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
} */

/* .toastui-editor-md-code,.toastui-editor-md-code-block */
.toastui-editor-defaultUI,
.toastui-editor-tooltip,
.ProseMirror,
.toastui-editor-contents,
.toastui-editor-contents code,
.toastui-editor-contents pre {
    font-family: var(--font-body) !important;
}

.toastui-editor-md-code,
.toastui-editor-md-code-block,
.toastui-editor-contents code,
.toastui-editor-contents pre {
    font-family: var(--font-code) !important;
}

.toastui-editor-toolbar-group .toastui-editor-dropdown-toolbar {
    max-width: 95%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    /* Hides the scrollbar in Firefox */
    -ms-overflow-style: none;
    /* Hides the scrollbar in IE/older Edge */
}

.toastui-editor-toolbar-group .toastui-editor-dropdown-toolbar::-webkit-scrollbar {
    display: none;
}

@media only screen and (max-width: 480px) {
    .toastui-editor-toolbar .toastui-editor-popup {
        margin-left: 0px;
    }
}

.page-break-command {
    background-image: url("data:image/svg+xml,%3Csvg width='24px' height='24px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 12C2.5 11.5858 2.83579 11.25 3.25 11.25H4.75C5.16421 11.25 5.5 11.5858 5.5 12C5.5 12.4142 5.16421 12.75 4.75 12.75H3.25C2.83579 12.75 2.5 12.4142 2.5 12Z' fill='%23555555'/%3E%3Cpath d='M6.5 12C6.5 11.5858 6.83579 11.25 7.25 11.25H8.75C9.16421 11.25 9.5 11.5858 9.5 12C9.5 12.4142 9.16421 12.75 8.75 12.75H7.25C6.83579 12.75 6.5 12.4142 6.5 12Z' fill='%23555555'/%3E%3Cpath d='M10.5 12C10.5 11.5858 10.8358 11.25 11.25 11.25H12.75C13.1642 11.25 13.5 11.5858 13.5 12C13.5 12.4142 13.1642 12.75 12.75 12.75H11.25C10.8358 12.75 10.5 12.4142 10.5 12Z' fill='%23555555'/%3E%3Cpath d='M14.5 12C14.5 11.5858 14.8358 11.25 15.25 11.25H16.75C17.1642 11.25 17.5 11.5858 17.5 12C17.5 12.4142 17.1642 12.75 16.75 12.75H15.25C14.8358 12.75 14.5 12.4142 14.5 12Z' fill='%23555555'/%3E%3Cpath d='M18.5 12C18.5 11.5858 18.8358 11.25 19.25 11.25H20.75C21.1642 11.25 21.5 11.5858 21.5 12C21.5 12.4142 21.1642 12.75 20.75 12.75H19.25C18.8358 12.75 18.5 12.4142 18.5 12Z' fill='%23555555'/%3E%3Cpath d='M4.75 2C4.33579 2 4 2.33579 4 2.75V7C4 8.104 4.896 9 6 9H18C19.104 9 20 8.104 20 7V2.75C20 2.33579 19.6642 2 19.25 2C18.8358 2 18.5 2.33579 18.5 2.75V7C18.5 7.275 18.276 7.5 18 7.5H6C5.724 7.5 5.5 7.275 5.5 7V2.75C5.5 2.33579 5.16421 2 4.75 2Z' fill='%23555555'/%3E%3Cpath d='M19.25 22C19.6642 22 20 21.6642 20 21.25V17C20 15.896 19.104 15 18 15L6 15C4.896 15 4 15.896 4 17L4 21.25C4 21.6642 4.33579 22 4.75 22C5.16421 22 5.5 21.6642 5.5 21.25L5.5 17C5.5 16.725 5.724 16.5 6 16.5L18 16.5C18.276 16.5 18.5 16.725 18.5 17V21.25C18.5 21.6642 18.8358 22 19.25 22Z' fill='%23555555'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px;
    margin-right: 30px !important;
    position: relative;
}

.page-break-command:after {
    content: '';
    background-color: #e1e3e9;
    display: inline-block;
    height: 18px;
    width: 0.9px;
    position: absolute;
    top: 7px;
    right: -60%;
}

[dir="rtl"] .page-break-command {
    margin-right: 5px !important;
    margin-left: 30px !important;
}

[dir="rtl"] .page-break-command:after {
    right: auto;
    left: -60%;
}

[data-theme="dark"] .page-break-command {
    background-image: url("data:image/svg+xml,%3Csvg width='24px' height='24px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 12C2.5 11.5858 2.83579 11.25 3.25 11.25H4.75C5.16421 11.25 5.5 11.5858 5.5 12C5.5 12.4142 5.16421 12.75 4.75 12.75H3.25C2.83579 12.75 2.5 12.4142 2.5 12Z' fill='%23efefef'/%3E%3Cpath d='M6.5 12C6.5 11.5858 6.83579 11.25 7.25 11.25H8.75C9.16421 11.25 9.5 11.5858 9.5 12C9.5 12.4142 9.16421 12.75 8.75 12.75H7.25C6.83579 12.75 6.5 12.4142 6.5 12Z' fill='%23efefef'/%3E%3Cpath d='M10.5 12C10.5 11.5858 10.8358 11.25 11.25 11.25H12.75C13.1642 11.25 13.5 11.5858 13.5 12C13.5 12.4142 13.1642 12.75 12.75 12.75H11.25C10.8358 12.75 10.5 12.4142 10.5 12Z' fill='%23efefef'/%3E%3Cpath d='M14.5 12C14.5 11.5858 14.8358 11.25 15.25 11.25H16.75C17.1642 11.25 17.5 11.5858 17.5 12C17.5 12.4142 17.1642 12.75 16.75 12.75H15.25C14.8358 12.75 14.5 12.4142 14.5 12Z' fill='%23efefef'/%3E%3Cpath d='M18.5 12C18.5 11.5858 18.8358 11.25 19.25 11.25H20.75C21.1642 11.25 21.5 11.5858 21.5 12C21.5 12.4142 21.1642 12.75 20.75 12.75H19.25C18.8358 12.75 18.5 12.4142 18.5 12Z' fill='%23efefef'/%3E%3Cpath d='M4.75 2C4.33579 2 4 2.33579 4 2.75V7C4 8.104 4.896 9 6 9H18C19.104 9 20 8.104 20 7V2.75C20 2.33579 19.6642 2 19.25 2C18.8358 2 18.5 2.33579 18.5 2.75V7C18.5 7.275 18.276 7.5 18 7.5H6C5.724 7.5 5.5 7.275 5.5 7V2.75C5.5 2.33579 5.16421 2 4.75 2Z' fill='%23efefef'/%3E%3Cpath d='M19.25 22C19.6642 22 20 21.6642 20 21.25V17C20 15.896 19.104 15 18 15L6 15C4.896 15 4 15.896 4 17L4 21.25C4 21.6642 4.33579 22 4.75 22C5.16421 22 5.5 21.6642 5.5 21.25L5.5 17C5.5 16.725 5.724 16.5 6 16.5L18 16.5C18.276 16.5 18.5 16.725 18.5 17V21.25C18.5 21.6642 18.8358 22 19.25 22Z' fill='%23efefef'/%3E%3C/svg%3E");
    background-position: center;
}

[data-theme="dark"] .page-break-command:after {
    background-color: #303238;
}

.alert-message-container {
    position: relative;
}

.alert-message {
    transition: all .5s ease-in-out;
    font-size: var(--font-size-small);
    margin: 0;
    display: flex;
    align-items: center;
    color: var(--text-color);
    position: absolute;
    width: max-content;
    top: 50%;
    left: 0;
    transform: translateY(-40%);
}

[dir="rtl"] .alert-message {
    right: 0;
    left: auto;
}

.font-size-small {
    font-size: var(--font-size-small);
}

/* Dropdown menu */
.dropdown {
    position: relative;
    display: inline-block;
    z-index: 100;
}

/* .dropdown:has(.dropbtn:hover):before,
.dropdown:has(.dropdown-content:hover):before {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: -1;
    display: block;
    transition: 0.3s;
} */

.dropdown.open:before {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: -1;
    display: block;
    transition: 0.3s;
}

.dropbtn {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    line-height: 0;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: auto;
    left: auto;
    background-color: var(--bg-color);
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.dropdown-content button,
.dropdown-item {
    color: var(--text-color);
    padding: 8px 16px;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    direction: ltr;
    text-align: left;
    border-radius: 0;
    line-height: 1.4;
}

.dropdown-content button:hover,
.dropdown-item:hover {
    background-color: var(--hover-bg);
}

.dropdown-content hr {
    background-color: transparent;
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item input[type="checkbox"] {
    margin: 0;
}

.dropdown-item span {
    position: relative;
    top: 3px;
}

.version-info {
    font-size: 12px;
    color: var(--text-color-note);
    margin-top: -7px;
}

.version-info:hover {
    background-color: transparent;
    cursor: default;
}

#aiAssistantBtn {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
}

.toastui-editor-md-code-block-line-background,
.toastui-editor-md-preview pre {
    direction: ltr !important;
    text-align: left;
}

.ProseMirror {
    height: 100%;
}


/* ///////////////////////////////////  Start RTL Override CSS  /////////////////////////////////// */

[dir="rtl"] .task-list-item {
    margin-right: 0;
    padding-right: 0;
    /* margin-right: -24px; */
    padding-right: 24px;
}

[dir="rtl"] .task-list-item:before {
    left: auto;
    right: 0;
}

[dir="rtl"] .toastui-editor-contents dir,
[dir="rtl"] .toastui-editor-contents menu,
[dir="rtl"] .toastui-editor-contents ol,
[dir="rtl"] .toastui-editor-contents ul {
    padding-right: 24px;
}

[dir="rtl"] .toastui-editor-contents ul>li:before {
    margin-right: -17px;
}

/* ///////////////////////////////////  End RTL Override CSS  /////////////////////////////////// */

/* ///////////////////////////////////  Start Page Break CSS  /////////////////////////////////// */

del:has(+ del + del) {
    display: block;
    page-break-after: always;
    height: 1px;
    /* visibility: hidden; */
    margin: 20px 0;
    /* padding: 0; */
    border-top: 2px dashed #aaa;
    position: relative;
    color: var(--bg-color) !important;
}

del:has(+ del + del):before {
    content: '.';
    display: inline-block;
    position: absolute;
    margin: 0 auto;
    left: 0;
    right: 0;
    width: 94px;
    top: -10px;
    background-color: var(--bg-color);
    color: var(--bg-color);
}

del:has(+ del + del):after {
    content: 'Page Break';
    display: block;
    width: 100%;
    text-align: center;
    position: absolute;
    top: -10px;
    /* background: #fff; */
    color: var(--text-color);
}

del:has(+ del + del)+del,
del:has(+ del + del)+del+del {
    display: none;
}


/* ///////////////////////////////////  End Page Break CSS  /////////////////////////////////// */

/* AI Assistant Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    direction: ltr;
    text-align: left;
    color: var(--text-color);
}

.modal-content {
    background-color: var(--bg-color);
    /* padding: 20px; */
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    /* overflow-y: auto; */
    overflow-y: hidden;
    position: relative;
}

.modal-header {
    /* background-color: red; */
    padding: 10px 20px 6px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 55px;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    /* background-color: cyan; */
    padding: 20px;
    height: calc(80vh - 100px);
    overflow-y: auto;
}

.modal-footer {
    /* background-color: lime; */
    padding: 10px 20px;
    height: 45px;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
}

/* .modal-alert {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: #00000073;
    padding: 5px 10px 3px;
    border-radius: 5px;
    backdrop-filter: blur(5px);
    border: 1px solid #5558;
    display: flex;
    font-size: 14px;
}

.modal-alert button {
    margin: 0;
    padding: 5px 8px;
    border: 0;
    line-height: 0;
    background-color: transparent;
    font-size: 16px;
    margin-left: 5px;
} */

.modal .modal-header .close {
    /* position: absolute; */
    /* top: 10px; */
    /* right: 15px; */
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    width: 24px;
    height: 24px;
    text-align: center;
}

/* [dir="rtl"] .close {
    right: auto;
    left: 15px;
} */

/* .modal h2 {
    margin-bottom: 15px;
} */

.role-selection,
.panel {
    margin-bottom: 15px;
}

.panel {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 10px;
}

.modal details {
    margin-bottom: 10px;
}

.modal summary {
    cursor: pointer;
    padding: 8px;
    background-color: var(--hover-bg);
    border-radius: 4px;
    font-weight: bold;
}

.modal label {
    display: block;
    /* margin-bottom: 8px; */
}

.modal input[type="text"],
.modal input[type="password"],
.modal input[type="number"],
.modal textarea,
.modal select {
    display: block;
    width: 100%;
    padding: 8px;
    /* margin-bottom: 10px; */
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.modal textarea {
    min-height: 100px;
    resize: vertical;
}

.modal button {
    margin-right: 8px;
    margin-bottom: 8px;
}

/* #customInstructionsSection {
    margin-top: 10px;
} */

#customInstructionsSection input,
#customInstructionsSection textarea {
    margin-bottom: 5px;
}

#outlinePreview {
    padding: 10px;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    margin: 10px 0;
    min-height: 50px;
    background-color: var(--hover-bg);
}

.error {
    color: #e74c3c;
    /* margin-top: 10px; */
}

.success {
    color: #25a85c;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--secondary-color);
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 10px auto;
}

.note {
    /* margin-top: -7px; */
    font-size: 13px;
    color: var(--text-color-note);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.form-group {
    margin-bottom: 8px;
}

.popup-message {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: #84ffbe;
    color: #000;
    padding: 5px 10px;
    line-height: 1.5;
    border-radius: 5px;
    transition: .6s;
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    font-size: 14px;
    direction: ltr;
    text-align: left;
}

.hidden {
    display: none;
}

.dropdown,
.toolbar,
.modal {
    user-select: none;
    -moz-user-select: none;
}

.footer-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    display: flex;
    gap: 0;
    transition: all 0.05s ease;
    /* direction: ltr; */
}

.footer-buttons button {
    font-size: 12px;
    height: 28px;
    width: 96px;
    padding: 0px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.footer-buttons button:hover {
    background-color: var(--primary-color-hover);
}

[dir="rtl"] .footer-buttons button svg {
    transform: scale(-1, 1);
}

@media (min-width: 992px) {
    .dropdown:hover .dropdown-content {
        display: block;
    }
}

@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
    }

    .device-alert {
        display: flex;
    }

    .alert-message {
        display: none;
    }

    .toastui-editor-tooltip {
        display: none !important;
    }

    #aiAssistantBtn span {
        display: none;
    }
}