/* Task Message Image Styles */
/* Tambahkan ke assets/css/style.css atau global.css */

/* Comment content image styling */
.comment-content .message-image {
    max-width: 300px !important;
    height: auto !important;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 10px 0;
    display: block;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-content .message-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Image container untuk CKEditor */
.comment-content figure.image {
    margin: 15px 0;
    text-align: left;
}

.comment-content figure.image img {
    max-width: 300px !important;
    height: auto !important;
}

.comment-content figure.image.image_resized {
    max-width: 300px;
    display: inline-block;
}

/* Image modal styles */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: pointer;
    animation: fadeIn 0.3s ease;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* CKEditor custom styles untuk image upload */
.ck-editor__editable {
    min-height: 150px !important;
}

.ck-toolbar {
    border-top: 1px solid #d1d5db !important;
    border-left: 1px solid #d1d5db !important;
    border-right: 1px solid #d1d5db !important;
    border-radius: 0.375rem 0.375rem 0 0 !important;
}

.ck-editor__editable_inline {
    border-bottom: 1px solid #d1d5db !important;
    border-left: 1px solid #d1d5db !important;
    border-right: 1px solid #d1d5db !important;
    border-radius: 0 0 0.375rem 0.375rem !important;
}

/* Image upload progress indicator */
.ck-editor__editable .ck-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    background: var(--secondary-color);
    transition: width 0.3s ease;
}

/* Loading state untuk image upload */
.image-uploading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.image-uploading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive image handling */
@media (max-width: 768px) {
    .comment-content .message-image {
        max-width: 100% !important;
        width: 100%;
    }
    
    .comment-content figure.image img {
        max-width: 100% !important;
    }
    
    .image-modal img {
        max-width: 95%;
        max-height: 95%;
    }
}

/* Image error state */
.message-image.error {
    border: 2px dashed #dc3545;
    opacity: 0.5;
}

.message-image.error::after {
    content: 'Image failed to load';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #dc3545;
    font-size: 12px;
    background: white;
    padding: 5px 10px;
    border-radius: 4px;
}

/* Image caption styling */
.comment-content figcaption {
    font-style: italic;
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 8px;
    padding: 0 10px;
}

/* Drag and drop image upload area styling */
.ck-editor__editable .ck-image-upload-placeholder {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #666;
    background-color: #f9f9f9;
    transition: all 0.3s ease;
}

.ck-editor__editable .ck-image-upload-placeholder:hover {
    border-color: var(--secondary-color);
    background-color: rgba(209, 57, 100, 0.05);
}

.ck-editor__editable .ck-image-upload-placeholder.drag-over {
    border-color: var(--secondary-color);
    background-color: rgba(209, 57, 100, 0.1);
}

/* Image resize handles */
.ck-editor__editable .ck-widget.ck-widget_selected .ck-widget__resizer {
    display: block;
}

.ck-editor__editable .ck-widget__resizer__handle {
    background: var(--secondary-color);
    border: 1px solid white;
}

/* Notification untuk upload success/error */
.upload-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

.upload-notification.success {
    background-color: #28a745;
}

.upload-notification.error {
    background-color: #dc3545;
}

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

/* Image gallery view untuk multiple images */
.comment-images-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.comment-images-gallery .message-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    margin: 0;
}

/* Print styles - hide interactive elements */
@media print {
    .image-modal,
    .ck-toolbar,
    .upload-notification {
        display: none !important;
    }
    
    .comment-content .message-image {
        max-width: 200px !important;
        page-break-inside: avoid;
    }
}