/* ==========================================================================
   Custom Rich Text Editor CSS Plugin (Plug-and-Play)
   Author: GEO IAS / Custom Web Component
   ========================================================================== */

.custom-editor-wrapper {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

.custom-editor-toolbar {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 8px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.custom-editor-btn-group {
    display: inline-flex;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.custom-editor-btn {
    width: 36px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #495057;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    transition: background-color 0.15s, color 0.15s;
    outline: none;
}

.custom-editor-btn:hover {
    background-color: #e9ecef;
    color: #0d6efd;
}

.custom-editor-btn:not(:last-child) {
    border-right: 1px solid #ced4da;
}

.custom-editor-select {
    height: 34px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    padding: 0 8px;
    font-size: 13px;
    color: #495057;
    outline: none;
    cursor: pointer;
}

.custom-editor-color-wrapper {
    position: relative;
    overflow: hidden;
    width: 36px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.custom-editor-color-input {
    position: absolute;
    left: -10%;
    top: -10%;
    width: 120%;
    height: 120%;
    opacity: 0;
    cursor: pointer;
}

.custom-editor-content {
    min-height: 100px;
    max-height: 650px;
    overflow-y: auto;
    background-color: #fff;
    outline: none;
    padding: 16px;
    color: #212529;
    font-family: inherit;
    line-height: 1.45;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Paragraph and Line Spacing Tightness Fix */
.custom-editor-content p,
.custom-editor-content div {
    color: #212529;
    margin-top: 0 !important;
    margin-bottom: 4px !important;
    line-height: 1.45 !important;
}

.custom-editor-content h1,
.custom-editor-content h2,
.custom-editor-content h3,
.custom-editor-content h4,
.custom-editor-content h5,
.custom-editor-content h6 {
    margin-top: 8px;
    margin-bottom: 6px;
    line-height: 1.3;
    color: #212529;
}

/* List & Text fixes */
.custom-editor-content ul,
.custom-editor-content ol {
    margin-left: 0 !important;
    padding-left: 1.25rem !important;
    margin-bottom: 6px !important;
}

.custom-editor-content ul {
    list-style-type: disc !important;
}

.custom-editor-content ol {
    list-style-type: decimal !important;
}

.custom-editor-content ul ul,
.custom-editor-content ol ol,
.custom-editor-content ul ol,
.custom-editor-content ol ul {
    margin-left: 0 !important;
    padding-left: 1.25rem !important;
}

.custom-editor-content li {
    margin-bottom: 2px;
    color: #212529;
    line-height: 1.45;
}

.custom-editor-content blockquote {
    border-left: 4px solid #0d6efd;
    padding: 6px 14px;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    margin: 8px 0;
    line-height: 1.45;
}

.custom-editor-content table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.custom-editor-content td,
.custom-editor-content th {
    border: 1px solid #dee2e6;
    padding: 6px 10px;
}

.custom-editor-content img {
    cursor: pointer;
    max-width: 100%;
    height: auto;
    transition: outline 0.15s ease-in-out;
}

.custom-editor-content img.custom-editor-selected-img {
    outline: 2px solid #0d6efd !important;
    box-shadow: 0 0 8px rgba(13, 110, 253, 0.4);
}

/* Image Resizer Overlay */
.custom-editor-img-overlay {
    position: absolute;
    pointer-events: none;
    border: 2px dashed #0d6efd;
    box-sizing: border-box;
    z-index: 1050;
    display: none;
}

.custom-editor-img-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #0d6efd;
    border: 2px solid #fff;
    box-shadow: 0 0 3px rgba(0,0,0,0.5);
    pointer-events: auto;
    border-radius: 2px;
}

.custom-editor-img-handle.tl { top: -6px; left: -6px; cursor: nwse-resize; }
.custom-editor-img-handle.tr { top: -6px; right: -6px; cursor: nesw-resize; }
.custom-editor-img-handle.bl { bottom: -6px; left: -6px; cursor: nesw-resize; }
.custom-editor-img-handle.br { bottom: -6px; right: -6px; cursor: nwse-resize; }

/* Image Floating Toolbar */
.custom-editor-img-popup {
    position: absolute;
    background: #1e293b;
    color: #fff;
    padding: 5px 8px;
    border-radius: 6px;
    display: none;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    z-index: 1060;
    font-size: 12px;
}

.custom-editor-img-popup button {
    background: #334155;
    border: 1px solid #475569;
    color: #f8f9fa;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
}

.custom-editor-img-popup button:hover {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.custom-editor-img-popup button.btn-del:hover {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
}

.custom-editor-img-popup .divider {
    width: 1px;
    height: 18px;
    background: #475569;
    margin: 0 3px;
}
