.ql-container {
    min-height: 450px;
    background: white;
    font-size: 16px;
}

.ql-editor {
    min-height: 450px;
    line-height: 1.8;
}

.ql-toolbar.ql-snow {
    border-color: var(--border);
    border-radius: 8px 8px 0 0;
}

.ql-container.ql-snow {
    border-color: var(--border);
    border-radius: 0 0 8px 8px;
}

.editor-wrapper {
    position: relative;
}

.ql-editor img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 450px;
    height: auto;
    object-fit: contain;
    margin: 18px auto;
    cursor: pointer;
    transition:
        outline 0.15s ease,
        opacity 0.15s ease;
}

.ql-editor img.selected-image {
    outline: 3px solid #4f46e5;
    outline-offset: 3px;
}


/* Image sizes */

.ql-editor img[data-size="small"],
.chapter-content img[data-size="small"] {
    width: 25%;
}

.ql-editor img[data-size="medium"],
.chapter-content img[data-size="medium"] {
    width: 50%;
}

.ql-editor img[data-size="large"],
.chapter-content img[data-size="large"] {
    width: 75%;
}

.ql-editor img[data-size="full"],
.chapter-content img[data-size="full"] {
    width: 100%;
}


/* Floating toolbar */

.image-toolbar {
    position: absolute;
    display: none;
    z-index: 1000;

    padding: 6px;

    background: #1f2937;
    border-radius: 8px;

    box-shadow:
        0 8px 24px
        rgba(0, 0, 0, 0.18);

    gap: 4px;
}

.image-toolbar.active {
    display: flex;
}

.image-toolbar button {
    border: none;
    background: transparent;
    color: white;

    padding: 7px 10px;

    border-radius: 5px;
    cursor: pointer;

    font-size: 12px;
}

.image-toolbar button:hover,
.image-toolbar button.active {
    background: rgba(
        255,
        255,
        255,
        0.18
    );
}

/* -------------------------
   LEFT — TEXT WRAPS RIGHT
-------------------------- */

.ql-editor img[data-align="left"],
.chapter-content img[data-align="left"] {
    float: left;
    margin: 8px 20px 12px 0;
}


/* -------------------------
   RIGHT — TEXT WRAPS LEFT
-------------------------- */

.ql-editor img[data-align="right"],
.chapter-content img[data-align="right"] {
    float: right;
    margin: 8px 0 12px 20px;
}


/* -------------------------
   CENTER — NO TEXT WRAPPING
-------------------------- */

.ql-editor img[data-align="center"],
.chapter-content img[data-align="center"] {
    display: block;
    float: none;
    margin: 20px auto;
}


/* Prevent floated images escaping container */
.ql-editor::after,
.chapter-content::after {
    content: "";
    display: table;
    clear: both;
}

.chapter-content {
    line-height: 1.8;
    font-size: 17px;
    word-wrap: break-word;
}

.chapter-content p {
    margin-bottom: 1rem;
}

.chapter-content h1,
.chapter-content h2,
.chapter-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: bold;
}

.chapter-content blockquote {
    border-left: 4px solid #ddd;
    padding-left: 15px;
    color: #666;
    margin: 1rem 0;
}

.chapter-content ul,
.chapter-content ol {
    padding-left: 2rem;
}

.chapter-content img {
    max-width: 100%;
    height: auto;
}