/**
 * Elementor-like Content Editor Styles
 */

/* Edit mode indicator */
.content-editor-mode .editable-content {
    position: relative;
    transition: all 0.2s ease;
    min-height: 20px;
    pointer-events: auto !important;
}

/* Make elements with UUID IDs editable when logged in */
.user-logged-in .editable-content-uuid {
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 20px;
}

/* Hover styles for logged-in users (Elementor-style) */
.user-logged-in .editable-content-uuid:hover {
    outline: 2px dashed #07beb8;
    outline-offset: 2px;
    background-color: rgba(7, 190, 184, 0.08);
    border-radius: 2px;
}

.user-logged-in .editable-content-uuid:hover::before {
    content: '✏️ Click to edit';
    position: absolute;
    top: -28px;
    left: 0;
    background: #07beb8;
    color: white;
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 9999;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

/* Edit mode styles (when explicitly enabled) */
.content-editor-mode .editable-content {
    pointer-events: auto !important;
}

.content-editor-mode .editable-content:hover {
    outline: 2px dashed #07beb8;
    outline-offset: 2px;
    background-color: rgba(7, 190, 184, 0.08);
    border-radius: 2px;
}

.content-editor-mode .editable-content:hover::before {
    content: '✏️ Click to edit';
    position: absolute;
    top: -28px;
    left: 0;
    background: #07beb8;
    color: white;
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 9999;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.editable-content.editing {
    outline: 2px solid #07beb8;
    outline-offset: 2px;
    background-color: rgba(7, 190, 184, 0.12);
    border-radius: 2px;
}

/* Input Overlay (Elementor-style) */
.content-input-overlay {
    background: white;
    border: 2px solid #07beb8;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0;
    animation: contentOverlayFadeIn 0.2s ease;
    border-bottom: none;
}

@keyframes contentOverlayFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    background: #fafafa;
    transition: all 0.2s ease;
    pointer-events: auto !important;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.content-input-field:focus {
    background: white;
    border-color: #07beb8;
    box-shadow: 0 0 0 3px rgba(7, 190, 184, 0.1);
}

.content-input-field:disabled,
.content-input-field[readonly] {
    background: #f5f5f5 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.content-input-field:not(:disabled):not([readonly]) {
    cursor: text;
    background: #fafafa;
}

.content-input-field[type="text"] {
    height: 48px;
}

.content-input-field[type="textarea"] {
    min-height: 80px;
    max-height: 200px;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Toolbar - Fixed at bottom */
.content-input-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: white;
    border-top: 2px solid #07beb8;
    align-items: flex-end;
    z-index: 10001;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    animation: toolbarSlideUp 0.3s ease;
}

/* Input wrapper inside toolbar */
.content-input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 200px);
}

/* Button wrapper inside toolbar */
.content-button-wrapper {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

@keyframes toolbarSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.content-input-save,
.content-input-cancel {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.content-input-save {
    background: #07beb8;
    color: white;
}

.content-input-save:hover {
    background: #059b96;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(7, 190, 184, 0.3);
}

.content-input-cancel {
    background: #6c757d;
    color: white;
}

.content-input-cancel:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.content-input-save i,
.content-input-cancel i {
    font-size: 12px;
}

/* Success/Error Messages */
.content-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    font-size: 14px;
    z-index: 10001;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-message.show {
    opacity: 1;
    transform: translateX(0);
}

.content-message-success {
    background: #28a745;
}

.content-message-error {
    background: #dc3545;
}

.content-message-info {
    background: #17a2b8;
}

/* Prevent text selection when in edit mode */
.content-editor-mode .editable-content {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto !important;
}

.content-editor-mode .editable-content.editing {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    pointer-events: auto !important;
}

/* Add bottom padding when toolbar is visible */
body.content-toolbar-visible {
    padding-bottom: 120px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .content-input-overlay {
        max-width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px !important;
        width: auto !important;
    }
    
    .content-editor-mode .editable-content:hover::before,
    .user-logged-in .editable-content-uuid:hover::before {
        font-size: 10px;
        padding: 3px 8px;
        top: -24px;
    }
    
    .content-input-toolbar {
        flex-direction: column;
        padding: 12px 16px;
        gap: 12px;
    }
    
    .content-input-wrapper {
        max-width: 100%;
        width: 100%;
    }
    
    .content-button-wrapper {
        width: 100%;
        justify-content: flex-end;
    }
    
    .content-input-save,
    .content-input-cancel {
        padding: 10px 20px;
        font-size: 14px;
        flex: 1;
        max-width: 150px;
    }
    
    body.content-toolbar-visible {
        padding-bottom: 180px;
    }
}
