.editor-wrapper {
    width: 45%;
    border: 1px solid #d2ddec;
    position: relative;
    overflow: visible;
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.editor-toolbar {
    display: flex;
    gap: 5px;
    align-items: center;
    background-color: #ffffff;
    padding: 10px;
    border: none;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
    white-space: nowrap;
}

.editor-toolbar::-webkit-scrollbar {
    height: 3px;
}

.editor-toolbar::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 2px;
    margin-left: 8px;
}

.editor-toolbar::-webkit-scrollbar-thumb {
    background: #b9ceeb;
    border-radius: 2px;
}

.editor-toolbar::-webkit-scrollbar-thumb:hover {
    background: #2c7be5;
}

.editor-toolbar.fixed {
    position: fixed;
    top: 0;
    z-index: 1000;
    width: calc(100% - 40px);
    max-width: calc(100% - 40px);
    left: calc(50% - (45% / 2));
    padding: 10px 10px 10px 30px;
    border: 1px solid #d2ddec;
    border-radius: 0;
    background-color: #ffffff;
    box-sizing: border-box;
}

.editor-toolbar.fixed .linkBlock {
    left: 30px;
}

.editor-toolbar.bottom-aligned {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-bottom: 1px solid #d2ddec;
    border-radius: 0;
}

.editor-toolbar .btn {
    background-color: #ffffff;
    border: 1px solid #d2ddec;
    border-radius: 4px;
    padding: 6px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.editor-toolbar .btn:hover {
    background-color: #d5e5fa;
    border-color: #2c7be5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.editor-toolbar .btn.active {
    background-color: #2c7be5;
    color: #ffffff;
    border-color: #2c7be5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.editor-toolbar .divider {
    width: 1px;
    height: 20px;
    background-color: #98aecc;
    margin: 0 5px;
    flex-shrink: 0;
}

#custom-editor {
    border: none;
    min-height: 250px;
    padding: 0 12px 20px;
    outline: none;
    font-size: 16px;
    line-height: 1.6;
    position: relative;
    z-index: 0;
}

.editor-wrapper:focus-within {
    border-width: 0.5px;
    border-color: #2c7be5;
}

#custom-editor p,
#custom-editor h1,
#custom-editor h2,
#custom-editor h3,
#custom-editor ul,
#custom-editor ol {
    margin: 10px 0;
    text-align: left;
}

#custom-editor b,
#custom-editor strong {
    font-weight: bold;
}

#custom-editor i,
#custom-editor em {
    font-style: italic;
}

#custom-editor a {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
}

#custom-editor a:hover {
    color: #007bff;
    text-decoration: underline;
}

#custom-editor h1 {
    font-size: 1.4rem;
    font-weight: 500;
}

#custom-editor h2 {
    font-size: 1.1rem;
    font-weight: 500;
}

#custom-editor h3 {
    font-size: 1rem;
    font-weight: 500;
}

.linkBlock {
    display: none;
    position: absolute;
    z-index: 100000;
    background: #ffffff;
    border: 1px solid #d2ddec;
    border-radius: 0 0 0.375rem 0.375rem;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    left: 10px;
    top: 100%;
    width: 325px;
    transform: translateY(0);
}

.linkBlock.active {
    display: block;
}

#linkDropdown .input-group {
    margin-bottom: 10px;
}

#linkDropdown .form-check {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

#linkDropdown .form-check small {
    margin-right: 8px;
}

#linkDropdown .btn {
    font-size: 0.875rem;
}

.d-none {
    display: none;
}

#linkDropdown .btn-primary {
    background-color: #2c7be5;
    color: #ffffff;
    border: 1px solid #2c7be5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

#linkDropdown .btn-primary:hover {
    background-color: #1a5bb8;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

#linkDropdown .btn-danger {
    background-color: #dc3545;
    color: #ffffff;
    border: 1px solid #dc3545;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

#linkDropdown .btn-danger:hover {
    background-color: #c82333;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

#custom-editor ul,
#custom-editor ol {
    margin: 0 0 16px 0;
    padding-left: 24px;
}

#custom-editor li {
    margin-bottom: 8px;
    line-height: 1.2;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #007bff;
    border: 1px solid #fff;
    border-radius: 50%;
    z-index: 10;
    transition: background 0.2s ease;
    cursor: pointer;
}

.resize-handle:hover {
    background: #0056b3;
}

.delete-image-btn {
    position: absolute;
    top: -30px;
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    z-index: 10;
    transition: background 0.2s ease;
    user-select: none;
}

.delete-image-btn:hover {
    background: #c82333;
}

.delete-image-btn:focus {
    outline: none;
    box-shadow: none;
    background: #dc3545;
}

#custom-editor .image-container {
    position: relative;
    display: block;
    width: fit-content;
    user-select: none;
}

#custom-editor .resizable-image {
    cursor: pointer;
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
}

#custom-editor .image-selected {
    outline: 2px solid #007bff;
    outline-offset: -2px;
    position: relative;
    z-index: 5;
}

#custom-editor .image-container.align-left {
    margin-right: auto;
    margin-left: 0;
}

#custom-editor .image-container.align-center {
    margin-left: auto;
    margin-right: auto;
}

#custom-editor .image-container.align-right {
    margin-left: auto;
    margin-right: 0;
}

@media (max-width: 576px) {
    .mb-none {
        display: none;
    }

    .linkBlock {
        left: 15px;
        width: calc(100% - 30px);
        max-width: 280px;
        z-index: 100000;
        top: 100%;
        display: none;
    }

    .linkBlock.active {
        display: block;
    }

    .editor-toolbar.fixed::-webkit-scrollbar-track {
        margin-left: 25px;
    }
    
    .editor-wrapper {
        width: 80%;
        border-radius: 0.375rem;
        margin: 0 auto;
        padding: 15px;
    }

    .editor-toolbar.fixed {
        width: calc(100% - 30px);
        max-width: calc(100% - 30px);
        left: calc(50% - (80% / 2));
        padding: 8px 8px 8px 25px;
    }

    .editor-toolbar {
        display: flex;
        flex-wrap: nowrap;
        flex-direction: row;
        gap: 3px;
        padding: 8px;
        overflow-x: auto;
        white-space: nowrap;
    }

    .editor-toolbar .btn {
        padding: 4px;
        min-width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .editor-toolbar .btn svg {
        width: 16px;
        height: 16px;
    }

    .editor-toolbar .divider {
        height: 16px;
        margin: 0 3px;
    }

    #custom-editor {
        padding: 8px 12px;
        font-size: 14px;
        min-height: 200px;
    }

    #custom-editor p {
        font-size: 0.9rem;
    }

    #custom-editor h1 {
        font-size: 1.3rem;
    }

    #custom-editor h2 {
        font-size: 1.1rem;
    }

    #custom-editor h3 {
        font-size: 1rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .mb-none {
        display: none;
    }

    .linkBlock {
        left: 20px;
        width: 300px;
        z-index: 100000;
        top: 100%;
        display: none;
    }

    .linkBlock.active {
        display: block;
    }

    .editor-toolbar .btn {
        padding: 5px;
        min-width: 36px;
        height: 36px;
    }

    .editor-toolbar.fixed {
        padding-left: 10px;
    }

    .editor-toolbar .btn svg {
        width: 18px;
        height: 18px;
    }

    #custom-editor {
        font-size: 15px;
        padding: 10px 15px;
    }
}

.pb-2 {
    padding-bottom: 8px;
}

#linkUrlInput.form-control {
    border: 1px solid #d2ddec;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 0.875rem;
    width: 95%;
    color: #12263f;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#linkUrlInput.form-control:focus {
    border-color: #2c7be5;
    box-shadow: 0 0 0 3px rgba(44, 123, 229, 0.1);
    outline: none;
}

#linkUrlInput.form-control::placeholder {
    color: #95aac9;
    opacity: 1;
}

.linkBlock .d-flex.align-items-center.mb-1 {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    padding-top: 5px;
}

.linkBlock .d-flex.align-items-center.mb-1 small.text-body-secondary {
    color: #95aac9;
    font-size: 0.95rem;
    margin-right: 0;
    padding-bottom: 12px;
}

.linkBlock .form-check.form-check-sm.form-switch {
    display: flex;
    align-items: center;
    min-height: unset;
    padding-left: 0;
    margin-bottom: 0;
}

.linkBlock .form-check.form-check-sm.form-switch .form-check-input {
    width: 2rem;
    height: 1rem;
    margin-right: 8px;
    background-color: #b1c2d9;
    border: none;
    cursor: pointer;
}

.linkBlock .form-check.form-check-sm.form-switch .form-check-input:checked {
    background-color: #2c7be5;
}

.linkBlock .form-check.form-check-sm.form-switch .form-check-label {
    font-size: 0.75rem;
    color: #12263f;
    cursor: pointer;
}