/**
 * Modern Drag & Drop Image Upload Styles
 * For Gravity Forms event submission
 */

/* Drop Zone */
.psl-image-dropzone {
    position: relative;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    background: #f7fafc;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 16px;
}

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

.psl-image-dropzone.psl-dragover {
    border-color: #4299e1;
    background: #bee3f8;
    transform: scale(1.02);
}

.psl-dropzone-inner {
    pointer-events: none;
}

.psl-dropzone-icon {
    margin-bottom: 16px;
}

.psl-dropzone-icon svg {
    color: #333;
    width: 48px;
    height: 48px;
}

.psl-dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.psl-dropzone-text strong {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
}

.psl-dropzone-text span {
    font-size: 14px;
    color: #555;
}

.psl-dropzone-requirements {
    font-size: 12px;
    color: #a0aec0;
    margin-top: 8px;
}

/* Image Preview */
.psl-image-preview {
    position: relative;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    margin-bottom: 16px;
}

.psl-preview-image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 12px;
}

.psl-preview-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.psl-preview-name {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    word-break: break-word;
}

.psl-preview-size {
    font-size: 12px;
    color: #718096;
}

.psl-remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #718096;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.psl-remove-image:hover {
    background: #fc8181;
    border-color: #fc8181;
    color: #fff;
    transform: scale(1.1);
}

/* Error Messages */
.psl-image-error {
    padding: 12px 16px;
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: 6px;
    color: #c53030;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
    margin-top: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    position: relative;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(252, 129, 129, 0.2);
}

.psl-image-error.visible {
    display: flex !important;
}

.psl-image-error.hidden {
    display: none !important;
}

.psl-error-icon {
    flex-shrink: 0;
    font-size: 18px;
    line-height: 1.2;
}

/* Gravity Forms Integration */
.ginput_container_fileupload.psl-dnd-initialized {
    position: relative;
}

.ginput_container_fileupload.psl-dnd-initialized input[type="file"] {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Ensure error appears after dropzone/preview */
.psl-image-error {
    order: 3; /* After dropzone (1) and preview (2) */
    width: 100%;
    clear: both;
}

/* Hide Gravity Forms default upload button */
.ginput_container_fileupload.psl-dnd-initialized .gform_button_select_files {
    display: none !important;
}

/* Validation message from Gravity Forms */
.ginput_container_fileupload .validation_message {
    margin-top: 8px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .psl-image-dropzone {
        padding: 30px 15px;
    }
    
    .psl-dropzone-icon svg {
        width: 40px;
        height: 40px;
    }
    
    .psl-dropzone-text strong {
        font-size: 15px;
    }
    
    .psl-dropzone-text span {
        font-size: 13px;
    }
    
    .psl-dropzone-requirements {
        font-size: 11px;
    }
}

/* Loading state (optional) */
.psl-image-dropzone.psl-loading {
    pointer-events: none;
    opacity: 0.6;
}

.psl-image-dropzone.psl-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #e2e8f0;
    border-top-color: #4299e1;
    border-radius: 50%;
    animation: psl-spin 0.6s linear infinite;
}

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

/* Success state */
.psl-image-preview.psl-success {
    border-color: #48bb78;
    background: #f0fff4;
}

/* Accessibility improvements */
.psl-image-dropzone:focus-within {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
}