.rich-text-editor {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    min-height: 300px;
}

.rich-text-editor__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 4px 4px 0 0;
}

.rich-text-editor__toolbar-group {
    display: flex;
    gap: 2px;
    padding-right: 8px;
    border-right: 1px solid #ddd;
    margin-right: 8px;
}

.rich-text-editor__toolbar-group:last-child {
    border-right: none;
    margin-right: 0;
}

.rich-text-editor__button {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 6px 10px;
    cursor: pointer;
    color: #333;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 32px;
    height: 32px;
}

.rich-text-editor__button:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.rich-text-editor__button.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.rich-text-editor__button:active {
    transform: scale(0.95);
}

.rich-text-editor__button i {
    font-size: 16px;
}

.rich-text-editor__editor {
    padding: 15px;
    min-height: 250px;
    outline: none;
    overflow-y: auto;
    line-height: 1.6;
}

.rich-text-editor__editor:focus {
    outline: none;
}

.rich-text-editor__editor h1 {
    font-size: 2em;
    font-weight: bold;
    margin: 0.67em 0;
}

.rich-text-editor__editor h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0.75em 0;
}

.rich-text-editor__editor p {
    margin: 1em 0;
}

.rich-text-editor__editor ul,
.rich-text-editor__editor ol {
    margin: 1em 0;
    padding-left: 2em;
}

.rich-text-editor__editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.rich-text-editor__editor table td,
.rich-text-editor__editor table th {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.rich-text-editor__editor table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.rich-text-editor__editor img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 4px;
}

/* Contenedor para imágenes redimensionables */
.rich-text-editor__image-container {
    position: relative;
    display: inline-block;
    margin: 10px 0;
    max-width: 100%;
    vertical-align: middle;
}

.rich-text-editor__resizable-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    user-select: none;
    display: block;
    cursor: move;
}

.rich-text-editor__resizable-image:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Controlador de resize */
.rich-text-editor__resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: #007bff;
    border: 2px solid #fff;
    border-radius: 50% 0 0 0;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.rich-text-editor__image-container:hover .rich-text-editor__resize-handle {
    opacity: 1;
}

.rich-text-editor__resize-handle:hover {
    background: #0056b3;
}

.rich-text-editor__resize-handle:active {
    background: #004085;
}

.rich-text-editor__editor a {
    color: #007bff;
    text-decoration: underline;
}

.rich-text-editor__editor a:hover {
    color: #0056b3;
}

/* Placeholder cuando el editor está vacío */
.rich-text-editor__editor:empty:before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
}

/* Overrides para evitar conflictos con Bootstrap */
.rich-text-editor button.rich-text-editor__button {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    padding: 6px 10px;
    cursor: pointer;
    color: #333;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 32px;
    height: 32px;
    margin: 0;
    box-shadow: none;
    font-weight: normal;
    line-height: 1;
}

.rich-text-editor button.rich-text-editor__button:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #333;
}

.rich-text-editor button.rich-text-editor__button.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.rich-text-editor button.rich-text-editor__button:focus {
    outline: none;
    box-shadow: none;
}

.rich-text-editor button.rich-text-editor__button:active {
    transform: scale(0.95);
    background: #e9ecef;
}

.rich-text-editor button.rich-text-editor__button.active:active {
    background: #0056b3;
}

/* Estilos para el selector de tamaño (estilo Word) */
.rich-text-editor__select {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    color: #333;
    background-color: #fff;
    cursor: pointer;
    outline: none;
    height: 32px;
    transition: all 0.2s;
    min-width: 60px;
}

.rich-text-editor__select:hover {
    border-color: #adb5bd;
    background-color: #f8f9fa;
}

.rich-text-editor__select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.1);
}
