/* Global styles for TakumiHtmlEditor - Applied to dynamically inserted content */

/* Image wrapper for positioning resize handle */
.takumi-img-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0; /* Prevent extra spacing */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Image styles - must be global to work with contenteditable dynamic content */
.takumi-editor-content img {
    max-width: 100%;
    height: auto;
    display: block; /* Changed from inline-block to prevent spacing issues */
    transition: all 0.2s;
    cursor: pointer;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.takumi-editor-content img:hover {
    outline: 2px solid #cbd5e0;
    outline-offset: 1px;
}

.takumi-editor-content img.takumi-img-selected {
    outline: 3px solid #007bff;
    outline-offset: 2px;
    box-shadow: 0 0 12px rgba(0, 123, 255, 0.6);
    cursor: move !important;
}

.takumi-editor-content img.takumi-img-resizing {
    opacity: 0.7;
    cursor: nwse-resize !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    pointer-events: none !important;
}

/* Resize handle - visible when image is selected */
.takumi-img-resize-handle {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #007bff;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    cursor: nwse-resize;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    user-select: none;
    transition: transform 0.2s, background-color 0.2s;
}

.takumi-img-resize-handle:hover {
    transform: scale(1.15);
    background: #0056b3;
}

.takumi-img-resize-handle:active {
    transform: scale(1.05);
    background: #004494;
}

/* Dark theme support */
:root[data-theme="dark"] .takumi-editor-content img:hover {
    outline-color: #4a5568;
}

:root[data-theme="dark"] .takumi-editor-content img.takumi-img-selected {
    outline-color: #4299e1;
    box-shadow: 0 0 12px rgba(66, 153, 225, 0.6);
}

:root[data-theme="dark"] .takumi-img-resize-handle {
    background: #4299e1;
    border-color: #2d3748;
}

:root[data-theme="dark"] .takumi-img-resize-handle:hover {
    background: #3182ce;
}

:root[data-theme="dark"] .takumi-img-resize-handle:active {
    background: #2c5282;
}

/* Resizable Editor Content */
.takumi-editor-content--resizable {
    resize: vertical !important;
    overflow: auto !important;
    min-height: 200px !important;
    max-height: 600px !important;
}

/* Fullscreen Mode - Must be global to override parent container styles */
.takumi-html-editor--fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 10000 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
}

.takumi-html-editor--fullscreen .takumi-editor-content,
.takumi-html-editor--fullscreen .takumi-editor-source {
    flex: 1 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
}
