@font-face {
    font-family: 'Segoe UI Emoji';
    src: local('Segoe UI Emoji'),        /* Сначала ищем в системе */
         local('SegoeUIEmoji'),          /* Альтернативное имя */
         url('/fonts/SegoeUIEmoji.ttf') format('truetype'); /* Загрузка из файла */
    font-weight: normal;
    font-style: normal;
}

/* Стили для состояния загрузки */
.loadding {
    position: relative;
    overflow: hidden;
    background: #e6e6e6;
    cursor: wait;
    pointer-events: none;
}
.loadding::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        #e6e6e6 0%,
        #f0f0f0 50%,
        #e6e6e6 100%
    );
    background-size: 200% 200%;
    animation: loadingPulse 1.5s ease-in-out infinite;
    z-index: 0;
    border-radius: 5px;
}
@keyframes loadingPulse {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

body {
    font-family: "Segoe UI Emoji", "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    color: #24292f;
}
.header {
    background-color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #d0d7de;
}
.container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background-color: #ffffff;
}
.editor, .preview {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}
.editor {
    border-right: 1px solid #d0d7de;
    background-color: #f6f8fa;
}
textarea {
    width: 100%;
    height: calc(100% - 4px);
    min-height: 80vh;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 16px;
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    box-sizing: border-box;
    background-color: #ffffff;
    color: #24292f;
}
textarea:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: inset 0 0 0 1px #0969da;
}
.preview {
    background-color: #ffffff;
    padding: 32px;
}
.markdown-body {
    box-sizing: border-box;
    min-width: 200px;
    max-width: 980px;
    margin: 0 auto;
    padding: 0;
}
body .markdown-body pre,
body .markdown-body code {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}
button {
    background-color: #2a994f;
    color: white;
    border: 1px solid rgba(27, 31, 36, 0.15);
    padding: 10px 15px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    line-height: 20px;
    font-family: inherit;
    transition: background-color 0.2s;
}
button:hover {
    background-color: #248043;
}
button:active {
    background-color: #248043;
}
button:disabled {
    opacity: 0.8;
    cursor: wait;
}
.header h1 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}
.doc_name {
    flex: 1;
}
.doc_name p {
    text-transform: uppercase;
    font-size: 12px;
    color: #57606a;
    margin: 0;
}
.doc_name input[name="file-title"] {
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
    font-size: 18px;
    font-weight: normal;
    color: #000;
    margin: 0;
    outline: none;
    border: none;
    width: calc(100% - 20px);
}

.app-wrapper {
    display: flex;
}

.app-sidebar {
    width: 220px;
    background-color: #ffffff;
    border-right: 1px solid #d0d7de;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.app-logo img {
    display: block;
    margin: 0 auto;
}
.app-content {
    flex: 1;
}
#addNewDocument {
    width: 100%;
}
.app-footer {
    text-align: center;
    font-family: "Segoe UI", sans-serif;
    color: #5b5b5b;
}
.app-footer a {
    color: #2a994f;
    text-decoration: none;
}
.app-footer a:hover {
    text-decoration: underline;
}

.app-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.app-history {
    flex: 1;
    max-height: calc(100vh - 173px);
    overflow: auto;
    margin-left: -15px;
    margin-right: -15px;
}

.app-history .document-item {
    position: relative;
    margin-top: 5px;
    padding: 0px 15px;
}
.app-history .document-item:first-child {
    margin-top: 0px;
}
.app-history .document-name {
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 10px;
    transition: 0.1s background;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-history .document-item.active .document-name,
.app-history .document-item:hover .document-name {
    padding-right: 30px;
    background: #f0f0f0;
}

.app-history .document-item.active .document-delete-btn,
.app-history .document-item:hover .document-delete-btn {
    display: block;
}

.document-delete-btn {
    display: none;
    cursor: pointer;
    position: absolute;
    top: 8px;
    right: 22px;
    padding: 10px;
    border-radius: 20px;
    background: transparent;
    transition: 0.1s background;
}
.document-delete-btn:hover {
    background: #ffc7c7;
}
.document-delete-btn:hover::before ,
.document-delete-btn:hover::after {
    background: #dd1919;
}
.document-delete-btn::before ,
.document-delete-btn::after {
    content: '';
    position: absolute;
    top: 9px;
    left: 5px;
    width: 10px;
    height: 1px;
    background: #4b4b4b;
}
.document-delete-btn::before {
    transform: rotate(45deg);
}
.document-delete-btn::after {
    transform: rotate(-45deg);
}

@media (max-width: 767px) {
    .markdown-body { padding: 15px; }
}
@media print {
    body { display: block; height: auto; }
    .preview, .markdown-body { padding: 0px; max-width: auto; }
    .markdown-body { font-size: 14px; }
    .header, .editor { display: none; }
    .container { display: block; overflow: auto; }
}