/**
 * Image Preview Styles
 * Custom styles for image preview functionality
 * 
 * @version 1.0.0
 */

/* Preview Wrapper */
.image-preview-wrapper {
    margin-top: 12px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* Preview Containers */
.existing-image-preview,
.new-image-preview {
    position: relative;
    width: 200px;
    height: 200px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    transition: all 0.3s ease;
}

.existing-image-preview:hover,
.new-image-preview:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Images */
.existing-image-preview img,
.new-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Badges */
.existing-image-preview .badge,
.new-image-preview .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    border-radius: 4px;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(34, 197, 94, 0.9) !important;
}

/* Remove Button */
.btn-remove-preview {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
}

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

/* No Image Placeholder */
.no-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    text-align: center;
    padding: 16px;
}

.no-image-placeholder iconify-icon,
.no-image-placeholder i {
    font-size: 48px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.no-image-placeholder p {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .image-preview-wrapper {
        gap: 12px;
    }
    
    .existing-image-preview,
    .new-image-preview {
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 576px) {
    .image-preview-wrapper {
        flex-direction: column;
    }
    
    .existing-image-preview,
    .new-image-preview {
        width: 100%;
        max-width: 300px;
        height: 200px;
    }
}

/* Loading State (optional) */
.image-preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.image-preview-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Multiple Images Grid */
.image-preview-wrapper.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.image-preview-wrapper.grid-layout .existing-image-preview,
.image-preview-wrapper.grid-layout .new-image-preview {
    width: 100%;
    height: 150px;
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
    .existing-image-preview,
    .new-image-preview {
        background: #1f2937;
        border-color: #374151;
    }
    
    .no-image-placeholder {
        color: #6b7280;
    }
}
