/* Inline Content Editor Styles */

/* Editable content container - override existing styles */
.editable {
    position: relative;
    border: none !important; /* Override any existing border */
    padding-top: 40px; /* Add space for the edit box to appear inside */
    margin-top: -40px; /* Compensate for padding to prevent layout shifts */
}

/* Override existing hover styles to prevent content reflow */
.editable:hover {
    border: none !important; /* Override the existing border: 1px solid #C0C0C0 */
    background-color: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Edit icon/button - positioned above content */
.edit-box {
    display: none;
    position: absolute;
    top: 5px; /* Position inside the new padded area */
    left: 50%;
    transform: translateX(-50%);
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    width: 60px;
    height: 30px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    line-height: 30px;
    text-decoration: none;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

/* Triangle pointer pointing down to content */
.edit-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #007bff;
}

.edit-box:hover {
    background-color: #0056b3;
    color: white;
    text-decoration: none;
    transform: scale(1.1);
}

/* Show edit button on hover */
.editable:hover .edit-box {
    display: block;
}

/* Content element styling */
.editable [id^="content-element-"] {
    display: block;
    word-wrap: break-word;
}

/* Modal styling for content editor */
.content-editor-modal .modal-dialog {
    max-width: 800px;
}

.content-editor-modal .modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.content-editor-modal .modal-title {
    font-weight: 600;
    color: #495057;
}

.content-editor-modal .modal-body {
    padding: 1.5rem;
}

.content-editor-modal .modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Summernote editor specific adjustments */
.content-editor-modal .note-editor {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

.content-editor-modal .note-editor .note-toolbar {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.content-editor-modal .note-editor .note-editing-area {
    min-height: 200px;
}

/* Loading state */
.content-editor-saving {
    opacity: 0.6;
    pointer-events: none;
}

.content-editor-saving .modal-body::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 9999;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error states */
.content-editor-error {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Success indicator */
.content-editor-success {
    color: #28a745;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .content-editor-modal .modal-dialog {
        margin: 0.5rem;
    }
    
    .edit-box {
        width: 50px;
        height: 25px;
        line-height: 25px;
        font-size: 10px;
        top: -30px;
    }
    
    .edit-box::after {
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 5px solid #007bff;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .editable:hover {
        border-color: #000;
        background-color: rgba(0, 0, 0, 0.1);
    }
    
    .edit-box {
        background-color: #000;
        border: 1px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .editable,
    .edit-box {
        transition: none;
    }
    
    .edit-box:hover {
        transform: none;
    }
    
    .content-editor-saving .modal-body::after {
        animation: none;
    }
}

/* Print styles - hide edit functionality when printing */
@media print {
    .editable {
        border: none !important;
        background-color: transparent !important;
        box-shadow: none !important;
    }
    
    .edit-box {
        display: none !important;
    }
}
