html,
body {
    height: 100%;
}

body {
    margin: 0;
    margin-bottom: 0;
    overflow: hidden;
    background: #111;
    color: #1f1f1f;
    font-family: "Segoe UI", Arial, sans-serif;
}
.hide{
    display: none;
}
header:not(.notebook-titlebar),
footer {
    display: none;
}

body > .container {
    width: 100%;
    max-width: none;
    padding: 0;
    margin: 0;
}

main.pb-3 {
    padding-bottom: 0 !important;
}

.notebook-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #fff;
}

.notebook-titlebar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 44px;
    padding: 0 14px;
    background: #7f18b8;
    color: #fff;
    font-size: 15px;
}

.window-button {
    justify-self: end;
    width: 32px;
    height: 28px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 20px;
    line-height: 1;
}

.notebook-tabs {
    display: flex;
    align-items: end;
    height: 42px;
    padding-left: 18px;
    gap: 4px;
    background: #7f18b8;
}

.notebook-tabs button {
    height: 38px;
    min-width: 78px;
    border: 0;
    background: transparent;
    color: #fff;
    font-weight: 600;
}

.notebook-tabs button.active {
    background: #fff;
    color: #7f18b8;
}

.ribbon {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 48px;
    padding: 6px 18px;
    background: #f5f5f5;
    border-bottom: 1px solid #d0d0d0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.text-toolbar,
.draw-toolbar,
.layout-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.draw-toolbar,
.layout-toolbar {
    padding-left: 18px;
    border-left: 1px solid #cfcfcf;
}

.text-toolbar select,
.text-toolbar button,
.tool-button {
    height: 32px;
    border: 1px solid #bdbdbd;
    background: #fff;
    color: #222;
}

.text-toolbar select {
    min-width: 86px;
    padding: 0 8px;
}

.text-toolbar button {
    width: 34px;
    font-size: 17px;
}

.tool-button {
    min-width: 74px;
    padding: 0 10px;
    font-weight: 600;
}

.tool-button.icon-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    padding: 0;
}

.tool-button.icon-tool .icon {
    width: auto;
    margin: 0;
    font-size: 17px;
}

.tool-svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tool-button.active,
.text-toolbar button.ql-active {
    border-color: #7f18b8;
    background: #eadcf4;
    color: #5f118b;
}

.tool-button.danger {
    color: #9f1d1d;
}

#colorPicker {
    width: 36px;
    height: 32px;
    border: 1px solid #bdbdbd;
    background: #fff;
}

.brush-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    white-space: nowrap;
}

.brush-control input {
    width: 92px;
}

.notebook-body {
    display: grid;
    grid-template-columns: 20px 215px 235px minmax(0, 1fr);
    flex: 1 1 auto;
    min-height: 0;
    background: #fff;
}
.notebook-body.no-page-list {
    grid-template-columns: 20px 215px minmax(0, 1fr);
}
.section-rail {
    padding-top: 56px;
    background: #f8f8f8;
    border-right: 1px solid #ddd;
}

.section-tab {
    display: block;
    width: 14px;
    height: 42px;
    margin: 6px 0 0 auto;
    border-radius: 6px 0 0 6px;
}

.section-tab.green {
    background: #18b957;
}

.section-tab.red {
    background: #ed3138;
}

.section-tab.purple {
    background: #ba0aa2;
}

.section-tab.teal {
    background: #1bb9a8;
}

.section-list,
.page-list {
    min-width: 0;
    background: #f7f7f7;
    border-right: 1px solid #d8d8d8;
}

.notebook-name {
    height: 52px;
    padding: 17px 22px 0;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-list button,
.page-list button {
    display: block;
    width: 100%;
    height: 43px;
    padding: 0 26px;
    border: 0;
    background: transparent;
    color: #151515;
    text-align: left;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.add-note-form {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #ddd;
}

.add-note-form input {
    width: 100%;
    height: 34px;
    min-width: 0;
    padding: 0 10px;
    border: 1px solid #cfcfcf;
    background: #fff;
    font: inherit;
}

.section-list .add-note-button {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #7f18b8;
    background: #7f18b8;
    color: #fff;
    text-align: center;
    font-weight: 600;
}

.section-list button.active,
.page-list button.active {
    background: #f3d3d7;
}

.page-list {
    padding-top: 52px;
}

.page-stage {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #fff;
}

.page-header {
    flex: 0 0 auto;
    padding: 20px 38px 10px;
}

.page-header h1 {
    display: inline-block;
    margin: 0;
    padding: 0 0 7px;
    border-bottom: 2px solid #cfcfcf;
    font-size: 28px;
    font-weight: 400;
    line-height: 1.2;
}

.page-header div {
    margin-top: 2px;
    color: #777;
    font-size: 12px;
}

.workspace {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px 38px 32px;
    gap: 22px;
}

.left-panel,
.right-panel {
    flex: 1 1 50%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.draw-mode .left-panel,
.text-mode .right-panel {
    flex-basis: 100%;
}

.draw-mode .right-panel,
.text-mode .left-panel {
    display: none;
}

#canvasContainer,
#editor {
    flex: 1 1 auto;
    min-height: 0;
    background: #fff;
}

#canvasContainer {
    overflow: auto;
    border: 1px solid #e3e3e3;
}

canvas {
    width: 100%;
    display: block;
    background:
        linear-gradient(#fff 31px, #f0f4ff 32px),
        #fff;
    background-size: 100% 32px;
}

canvas.pen-cursor {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M4 20h8' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M14.7 4.3l5 5L9 20H4v-5L14.7 4.3z' fill='white' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M13 6l5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") 4 22, crosshair;
}

canvas.eraser-cursor {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 15l8-8 5 5-8 8H7z' fill='white' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M11 11l5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") 8 18, cell;
}

#editor {
    overflow: hidden;
    border: 1px solid #e3e3e3;
}

#editor.ql-container {
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 16px;
}

#editor .ql-editor {
    min-height: 100%;
    padding: 24px 28px;
    line-height: 1.6;
}

@media (max-width: 900px) {
    .notebook-body {
        grid-template-columns: 16px 145px minmax(0, 1fr);
    }

    .page-list {
        display: none;
    }

    .ribbon {
        flex-wrap: wrap;
        gap: 8px;
    }
}


