/* Image Upload Styles */

.attach-button {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    color: #86868B;
}

.attach-button:hover {
    background: #F5F5F7;
    color: #1D1D1F;
}

.attach-button svg {
    width: 22px;
    height: 22px;
}

/* Image Preview */
.image-preview {
    padding: 12px 16px;
    border-top: 1px solid #E8E8ED;
    background: #FAFAFA;
}

.preview-container {
    position: relative;
    display: inline-block;
    max-width: 200px;
}

.preview-container img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 2px solid #E8E8ED;
}

.preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: #D32F2F;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.preview-remove:hover {
    background: #B71C1C;
}

/* Image in messages */
.message-image {
    margin-top: 8px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
}

.message-image img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-image img:hover {
    transform: scale(1.02);
}

/* Image loading */
.image-loading {
    display: inline-block;
    padding: 12px 20px;
    background: #F5F5F7;
    border-radius: 12px;
    color: #86868B;
    font-size: 14px;
}

.image-loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Image lightbox (optionnel) */
.image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

.image-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: white;
    color: black;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .attach-button svg {
        width: 20px;
        height: 20px;
    }
    
    .preview-container {
        max-width: 150px;
    }
}
