/**
 * TinyEditor - Estilos base
 */

.tinyeditor-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.tinyeditor-menubar {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding: 4px;
}

.tinyeditor-menu {
    background: none;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    border-radius: 3px;
    margin-right: 2px;
}

.tinyeditor-menu:hover {
    background: #e9ecef;
}

/* Submenús */
.tinyeditor-submenu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10002;
    min-width: 200px;
    padding: 4px 0;
}

.tinyeditor-submenu .tinyeditor-menu-item {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.tinyeditor-submenu .tinyeditor-menu-item:hover {
    background: #f5f5f5;
}

.tinyeditor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding: 4px;
    gap: 2px;
}

.tinyeditor-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    border-radius: 3px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tinyeditor-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.tinyeditor-btn:active {
    background: #dee2e6;
}

.tinyeditor-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.tinyeditor-separator {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 4px;
}

.tinyeditor-editor {
    flex: 1;
    min-height: 0;
    padding: 15px;
    outline: none;
    overflow-y: auto;
    overflow-x: hidden;
    line-height: 1.6;
    color: #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
}

.tinyeditor-editor:empty:before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
}

.tinyeditor-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
    cursor: pointer;
    position: relative;
}

.tinyeditor-editor img[width],
.tinyeditor-editor img[style*="width"] {
    max-width: 100% !important;
}

.tinyeditor-editor img.tinyeditor-image-selected {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Handles de redimensionamiento */
.tinyeditor-image-handles {
    position: absolute;
    pointer-events: none;
    z-index: 1000;
}

.tinyeditor-resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border: 2px solid #007bff;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: block;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease;
    z-index: 1001;
}

.tinyeditor-resize-handle:hover {
    background: #007bff;
    border-color: #0056b3;
    transform: translate(-50%, -50%) scale(1.3);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Cursor específico para cada dirección */
.tinyeditor-handle-nw,
.tinyeditor-handle-se {
    cursor: nwse-resize;
}

.tinyeditor-handle-ne,
.tinyeditor-handle-sw {
    cursor: nesw-resize;
}

.tinyeditor-handle-n,
.tinyeditor-handle-s {
    cursor: ns-resize;
}

.tinyeditor-handle-e,
.tinyeditor-handle-w {
    cursor: ew-resize;
}

.tinyeditor-editor a {
    color: #007bff;
    text-decoration: underline;
}

.tinyeditor-editor ul,
.tinyeditor-editor ol {
    padding-left: 30px;
    margin: 10px 0;
}

.tinyeditor-editor h1,
.tinyeditor-editor h2,
.tinyeditor-editor h3,
.tinyeditor-editor h4,
.tinyeditor-editor h5,
.tinyeditor-editor h6 {
    margin: 15px 0 10px 0;
    font-weight: bold;
}

.tinyeditor-editor h1 { font-size: 2em; }
.tinyeditor-editor h2 { font-size: 1.5em; }
.tinyeditor-editor h3 { font-size: 1.17em; }
.tinyeditor-editor h4 { font-size: 1em; }
.tinyeditor-editor h5 { font-size: 0.83em; }
.tinyeditor-editor h6 { font-size: 0.67em; }

.tinyeditor-editor p {
    margin: 10px 0;
}

.tinyeditor-editor blockquote {
    border-left: 4px solid #ddd;
    padding-left: 15px;
    margin: 15px 0;
    color: #666;
    font-style: italic;
}

.tinyeditor-textarea {
    border: none;
    outline: none;
    resize: none;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    background: #f8f9fa;
    color: #333;
}

/* Estilos para contenido editado */
.tinyeditor-editor [style*="text-align: left"] {
    text-align: left;
}

.tinyeditor-editor [style*="text-align: center"] {
    text-align: center;
}

.tinyeditor-editor [style*="text-align: right"] {
    text-align: right;
}

.tinyeditor-editor [style*="text-align: justify"] {
    text-align: justify;
}

/* Scrollbar personalizado */
.tinyeditor-editor::-webkit-scrollbar {
    width: 8px;
}

.tinyeditor-editor::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.tinyeditor-editor::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.tinyeditor-editor::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Handle de redimensionamiento del editor */
.tinyeditor-resize-editor-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: #007bff;
    color: white;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-radius: 4px 0 0 0;
    z-index: 100;
    user-select: none;
    transition: background 0.2s;
}

.tinyeditor-resize-editor-handle:hover {
    background: #0056b3;
}

/* Iconos de alineación SVG */
.tinyeditor-btn svg {
    display: block;
    width: 16px;
    height: 16px;
}
