/**
 * File Upload Component Styles
 * Styles for file upload preview and success states
 * @version 1.0.1
 */

/* File upload input wrapper */
.file-upload-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* File input styling */
.file-upload-input {
    position: relative;
    width: 100%;
}

.file-upload-input input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed #D1D5DB;
    border-radius: 8px;
    background: #F9FAFB;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-input input[type="file"]:hover {
    border-color: #4F46E5;
    background: #EEF2FF;
}

.file-upload-input input[type="file"]:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* File preview container */
.file-preview {
    margin-top: 1rem;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.file-preview.show {
    opacity: 1;
    transform: translateY(0);
}

.file-preview.success {
    border-left: 4px solid #10B981;
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    border-radius: 8px;
    padding: 1rem;
    animation: successPulse 0.5s ease;
}

@keyframes successPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Upload success message */
.upload-success-message {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: #059669;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 0.625rem 1rem;
    background: white;
    border-radius: 6px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.upload-success-message.show {
    opacity: 1;
    transform: translateY(0);
}

.upload-success-message i {
    color: #10B981;
    font-size: 1.125rem;
}

/* Upload progress */
.upload-progress {
    margin-top: 0.75rem;
    margin-bottom: 1rem;
}

.upload-progress-bar {
    width: 100%;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4F46E5 0%, #7C3AED 100%);
    transition: width 0.3s ease;
    animation: progressShimmer 1.5s infinite;
}

@keyframes progressShimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Preview item */
.preview-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.preview-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Preview thumbnail */
.preview-thumbnail {
    width: 56px;
    height: 56px;
    overflow: hidden;
    border-radius: 6px;
    border: 2px solid #E5E7EB;
    background: #F9FAFB;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Preview icon for non-image files */
.preview-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    border-radius: 6px;
    color: #3B82F6;
    font-size: 1.5rem;
}

.preview-icon.pdf {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #DC2626;
}

.preview-icon.doc {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    color: #2563EB;
}

.preview-icon.excel {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    color: #059669;
}

/* Preview info */
.preview-info {
    overflow: hidden;
    flex: 1;
}

.preview-filename {
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9375rem;
}

.preview-meta {
    font-size: 0.8125rem;
    color: #6B7280;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.preview-meta i {
    font-size: 0.75rem;
}

/* Remove file button */
.remove-file {
    width: 32px;
    height: 32px;
    border: none;
    background: #FEE2E2;
    color: #DC2626;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.remove-file:hover {
    background: #FEcaca;
    transform: scale(1.1);
}

.remove-file:active {
    transform: scale(0.95);
}

.remove-file i {
    font-size: 1rem;
}

/* File upload dropzone */
.file-dropzone {
    border: 2px dashed #D1D5DB;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #F9FAFB;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-dropzone:hover,
.file-dropzone.drag-over {
    border-color: #4F46E5;
    background: #EEF2FF;
}

.file-dropzone-icon {
    font-size: 3rem;
    color: #9CA3AF;
    margin-bottom: 1rem;
}

.file-dropzone-text {
    color: #6B7280;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.file-dropzone-hint {
    color: #9CA3AF;
    font-size: 0.8125rem;
}

/* Error state */
.file-preview.error {
    border-left: 4px solid #EF4444;
    background: #FEF2F2;
}

.upload-error-message {
    color: #DC2626;
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.upload-error-message i {
    color: #EF4444;
}

/* Responsive styles */
@media (max-width: 640px) {
    .preview-item {
        gap: 0.75rem;
        padding: 0.625rem 0.75rem;
    }

    .preview-thumbnail,
    .preview-icon {
        width: 48px;
        height: 48px;
    }

    .preview-icon {
        font-size: 1.25rem;
    }

    .preview-filename {
        font-size: 0.875rem;
    }

    .preview-meta {
        font-size: 0.75rem;
    }

    .remove-file {
        width: 28px;
        height: 28px;
    }

    .file-dropzone {
        padding: 1.5rem 1rem;
    }

    .file-dropzone-icon {
        font-size: 2.5rem;
    }
}

/* Accessibility */
.remove-file:focus {
    outline: 2px solid #DC2626;
    outline-offset: 2px;
}

.file-upload-input input[type="file"]:focus-visible {
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
}

/* Loading state */
.file-preview.loading {
    opacity: 0.6;
    pointer-events: none;
}

.file-preview.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    margin-left: -12px;
    border: 3px solid #E5E7EB;
    border-top-color: #4F46E5;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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