/* Post Images Upload Styles */
/* 2025-12-02 | cms.idea4me.pl 25.04 */

.image-upload-zone {
    width: 100%;
}

.image-upload-dropzone {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background-color: #f7fafc;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.image-upload-dropzone:hover {
    border-color: #4299e1;
    background-color: #ebf8ff;
}

.image-upload-dropzone.drag-over {
    border-color: #3182ce;
    background-color: #bee3f8;
    transform: scale(1.02);
}

.image-upload-dropzone .sprite {
    font-size: 48px;
    color: #a0aec0;
    margin-bottom: 10px;
    display: inline-block;
}

.image-upload-dropzone p {
    margin: 10px 0;
    color: #4a5568;
    font-size: 16px;
}

.upload-info {
    font-size: 13px !important;
    color: #718096 !important;
}

/* Preview Grid - 6 kolumn (miniaturki o połowę mniejsze) */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 20px;
}

/* Preview grid items */
.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background-color: #fff;
    transition: all 0.3s ease;
    cursor: move;
}

.image-preview-item:hover {
    border-color: #4299e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.image-preview-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Order Badge */
.image-order-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    z-index: 2;
}

/* Remove Button */
.image-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(239, 68, 68, 0.9);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s ease;
    z-index: 3;
    opacity: 0;
}

.image-preview-item:hover .image-remove-btn {
    opacity: 1;
}

.image-remove-btn:hover {
    background-color: rgba(220, 38, 38, 1);
    transform: scale(1.1);
}

/* Loading State */
.image-preview-item.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Error State */
.image-upload-error {
    background-color: #fed7d7;
    border: 1px solid #fc8181;
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: 10px;
    color: #c53030;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.image-upload-error::before {
    content: '⚠';
    font-size: 18px;
}

/* Responsive */
@media (max-width: 1024px) {
    .image-preview-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 640px) {
    .image-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .image-upload-dropzone {
        padding: 30px 15px;
    }

    .image-upload-dropzone p {
        font-size: 14px;
    }
}

/* Hide file input but keep it accessible for click() */
#image-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}