﻿/* Modern File Upload Styles */
.modern-file-upload-wrapper {
	position: relative;
	width: 100%;
	margin-bottom: 10px;
}

.modern-file-upload-area {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	padding: 24px;
	border: 2px dashed #e2e8f0;
	border-radius: 12px;
	background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
	cursor: pointer;
	transition: all 0.3s ease;
	position: relative;
	overflow: hidden;
	z-index: 1;
	user-select: none;
}

.modern-file-upload-area::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.modern-file-upload-area:hover {
	border-color: #667eea;
	background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.modern-file-upload-area:hover::before {
	opacity: 1;
}

.modern-file-upload-area.drag-over {
	border-color: #4f46e5;
	background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
	transform: scale(1.02);
	box-shadow: 0 12px 30px rgba(79, 70, 229, 0.2);
}

.modern-file-upload-area.has-files {
	border-color: #10b981;
	background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
}

.file-upload-icon {
	width: 48px;
	height: 48px;
	margin-bottom: 16px;
	color: #667eea;
	transition: all 0.3s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(102, 126, 234, 0.1);
	border-radius: 12px;
	position: relative;
	z-index: 1;
}

.modern-file-upload-area:hover .file-upload-icon {
	color: #5a67d8;
	transform: scale(1.1);
	background: rgba(90, 103, 216, 0.15);
}

.modern-file-upload-area.has-files .file-upload-icon {
	color: #10b981;
	background: rgba(16, 185, 129, 0.1);
}

.file-upload-text {
	text-align: center;
	position: relative;
	z-index: 1;
}

.file-upload-title {
	font-size: 16px;
	font-weight: 600;
	color: #374151;
	margin-bottom: 4px;
	transition: color 0.3s ease;
}

.modern-file-upload-area:hover .file-upload-title {
	color: #667eea;
}

.modern-file-upload-area.has-files .file-upload-title {
	color: #10b981;
}

.file-upload-subtitle {
	font-size: 14px;
	color: #6b7280;
	transition: color 0.3s ease;
}

.modern-file-upload-area:hover .file-upload-subtitle {
	color: #9ca3af;
}

/* Selected Files Display */
.selected-files-display {
	margin-top: 16px;
}

.selected-files {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.selected-file {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	border-bottom: 1px solid #f3f4f6;
	transition: background-color 0.2s ease;
}

.selected-file:last-child {
	border-bottom: none;
}

.selected-file:hover {
	background-color: #f9fafb;
}

.file-name {
	font-size: 14px;
	font-weight: 500;
	color: #374151;
	flex: 1;
	margin-right: 12px;
	word-break: break-word;
}

.file-size {
	font-size: 12px;
	color: #6b7280;
	background: #f3f4f6;
	padding: 4px 8px;
	border-radius: 4px;
	font-weight: 500;
}

.remove-file {
	background: none;
	border: none;
	color: #dc2626;
	cursor: pointer;
	font-size: 18px;
	font-weight: bold;
	padding: 4px 8px;
	border-radius: 4px;
	transition: all 0.2s ease;
}

.remove-file:hover {
	background: #fef2f2;
	color: #b91c1c;
}

/* File Field Info */
.file-field-info {
	font-size: 13px;
	color: #6b7280;
	margin-top: 8px;
	padding: 8px 12px;
	background: #f8fafc;
	border-radius: 6px;
	border-left: 3px solid #e2e8f0;
}

/* Responsive Design */
@media (max-width: 768px) {
	.modern-file-upload-area {
		min-height: 100px;
		padding: 20px 16px;
	}

	.file-upload-icon {
		width: 40px;
		height: 40px;
		margin-bottom: 12px;
	}

	.file-upload-title {
		font-size: 15px;
	}

	.file-upload-subtitle {
		font-size: 13px;
	}

	.selected-file {
		padding: 10px 12px;
	}

	.file-name {
		font-size: 13px;
	}
}

/* Animation for file drop */
@keyframes fileDropAnimation {
	0% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(1.05);
		opacity: 0.8;
	}
	100% {
		transform: scale(1);
		opacity: 1;
	}
}

.modern-file-upload-area.file-dropped {
	animation: fileDropAnimation 0.4s ease;
}

/* Focus styles for accessibility */
.modern-file-input:focus + .modern-file-upload-area {
	outline: 2px solid #667eea;
	outline-offset: 2px;
}

/* Error states */
.modern-file-upload-wrapper.error .modern-file-upload-area {
	border-color: #ef4444;
	background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.modern-file-upload-wrapper.error .file-upload-icon {
	color: #ef4444;
	background: rgba(239, 68, 68, 0.1);
}

.modern-file-upload-wrapper.error .file-upload-title {
	color: #dc2626;
}

/* Loading state */
.modern-file-upload-area.loading {
	pointer-events: none;
	opacity: 0.7;
}

.modern-file-upload-area.loading .file-upload-icon {
	animation: spin 1s linear infinite;
}

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

/* Dark mode support */
@media (prefers-color-scheme: dark) {
	.modern-file-upload-area {
		background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
		border-color: #374151;
	}

	.modern-file-upload-area:hover {
		background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
		border-color: #3b82f6;
	}

	.file-upload-title {
		color: #f9fafb;
	}

	.file-upload-subtitle {
		color: #d1d5db;
	}

	.selected-files {
		background: #1f2937;
		border-color: #374151;
	}

	.selected-file {
		border-color: #374151;
	}

	.selected-file:hover {
		background-color: #111827;
	}

	.file-name {
		color: #f9fafb;
	}

	.file-size {
		color: #d1d5db;
		background: #374151;
	}

	.file-field-info {
		background: #1f2937;
		color: #d1d5db;
		border-left-color: #374151;
	}
}

/* Professional File Preview Styling */
.selected-files-display {
	margin-top: 16px;
	padding: 0;
	background: transparent;
	border-radius: 12px;
}

/* Force image preview sizing - highest specificity */
.auto-form-builder-wrapper .selected-files-display .file-image-preview,
.modern-file-upload-wrapper .file-image-preview,
div.file-image-preview {
	width: 48px !important;
	height: 48px !important;
	max-width: 48px !important;
	max-height: 48px !important;
	min-width: 48px !important;
	min-height: 48px !important;
	box-sizing: border-box !important;
	overflow: hidden !important;
	position: relative !important;
}

.auto-form-builder-wrapper .selected-files-display .file-image-preview img,
.modern-file-upload-wrapper .file-image-preview img,
div.file-image-preview img {
	width: 48px !important;
	height: 48px !important;
	max-width: 48px !important;
	max-height: 48px !important;
	min-width: 48px !important;
	min-height: 48px !important;
	object-fit: cover !important;
	display: block !important;
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	border-radius: 6px !important;
}

.selected-file-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	margin-bottom: 8px;
	background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
	transition: all 0.3s ease;
	position: relative;
	opacity: 1;
	transform: none;
}

.selected-file-item.animate-in {
	opacity: 1;
	transform: translateY(0);
}

.selected-file-item:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
	border-color: #c7d2fe;
}

.file-preview-container {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1;
	min-width: 0;
}

.file-image-preview {
	width: 48px !important;
	height: 48px !important;
	max-width: 48px !important;
	max-height: 48px !important;
	min-width: 48px !important;
	min-height: 48px !important;
	border-radius: 8px !important;
	overflow: hidden !important;
	border: 2px solid #e5e7eb !important;
	flex-shrink: 0 !important;
	background: #f3f4f6 !important;
	position: relative !important;
}

.file-image-preview img {
	width: 48px !important;
	height: 48px !important;
	max-width: 48px !important;
	max-height: 48px !important;
	min-width: 48px !important;
	min-height: 48px !important;
	object-fit: cover !important;
	display: block !important;
	border-radius: 6px !important;
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
}

.file-icon-preview {
	width: 48px;
	height: 48px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
	border-radius: 8px;
	border: 1px solid #cbd5e1;
	flex-shrink: 0;
}

.file-info {
	flex: 1;
	min-width: 0;
	overflow: hidden;
}

.file-name {
	font-weight: 600;
	color: #1e293b;
	font-size: 14px;
	margin-bottom: 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	line-height: 1.2;
}

.file-details {
	display: flex;
	gap: 12px;
	align-items: center;
}

.file-size {
	color: #64748b;
	font-size: 12px;
	font-weight: 500;
	background: #f1f5f9;
	padding: 2px 8px;
	border-radius: 12px;
	border: 1px solid #e2e8f0;
}

.file-type {
	color: #7c3aed;
	font-size: 9px;
	font-weight: 500;
	background: #f3e8ff;
	padding: 1px 4px;
	border-radius: 4px;
	text-transform: uppercase;
	letter-spacing: 0.3px;
	line-height: 1;
}

.remove-file-btn {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	color: #dc2626;
	cursor: pointer;
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.remove-file-btn:hover {
	background: #fee2e2;
	border-color: #fca5a5;
	color: #b91c1c;
	transform: scale(1.05);
}

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

.selected-files-header {
	background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
	padding: 12px 16px;
	border-bottom: 1px solid #e5e7eb;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-weight: 600;
	color: #374151;
	font-size: 14px;
}

.selected-files-header .clear-all-btn {
	color: #dc2626;
	background: none;
	border: none;
	cursor: pointer;
	text-decoration: none;
	font-size: 12px;
	font-weight: 500;
	padding: 4px 8px;
	border-radius: 6px;
	transition: all 0.2s ease;
}

.selected-files-header .clear-all-btn:hover {
	background: #fef2f2;
	color: #b91c1c;
}

.selected-file-item {
	padding: 12px 16px;
	border-bottom: 1px solid #f3f4f6;
	display: flex;
	justify-content: space-between;
	align-items: center;
	transition: all 0.2s ease;
	background: #ffffff;
	min-height: 64px;
	box-sizing: border-box;
}

.selected-file-item:last-child {
	border-bottom: none;
}

.selected-file-item:hover {
	background: #f9fafb;
}

.file-info-container {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1;
	min-width: 0;
	overflow: hidden;
}

.file-icon {
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-radius: 8px;
	color: white;
	font-size: 16px;
	font-weight: bold;
	flex-shrink: 0;
}

.file-icon.image { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.file-icon.pdf { background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%); }
.file-icon.doc { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.file-icon.excel { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.file-icon.archive { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }

.file-details {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.file-name {
	font-weight: 600;
	color: #374151;
	font-size: 14px;
	margin-bottom: 2px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.file-meta {
	display: flex;
	gap: 12px;
	font-size: 12px;
	color: #6b7280;
}

.file-size-badge {
	background: #f3f4f6;
	color: #374151;
	padding: 2px 8px;
	border-radius: 12px;
	font-weight: 500;
}

.file-type-badge {
	background: #ede9fe;
	color: #7c3aed;
	padding: 2px 8px;
	border-radius: 12px;
	font-weight: 500;
	text-transform: uppercase;
}

.remove-file-btn {
	color: #6b7280;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 18px;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.remove-file-btn:hover {
	background: #fef2f2;
	color: #dc2626;
}

/* Image preview styling */
.file-image-preview {
	width: 40px !important;
	height: 40px !important;
	max-width: 40px !important;
	max-height: 40px !important;
	min-width: 40px !important;
	min-height: 40px !important;
	object-fit: cover;
	border-radius: 6px;
	border: 2px solid #e5e7eb;
	flex-shrink: 0;
	display: block;
}

/* Animation for file addition */
.selected-file-item.newly-added {
	animation: slideInFade 0.3s ease-out;
}

@keyframes slideInFade {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Empty state styling */
.files-empty-state {
	padding: 24px;
	text-align: center;
	color: #6b7280;
	font-style: italic;
	background: #f9fafb;
}

/* Responsive design */
@media (max-width: 640px) {
	.selected-files-header {
		padding: 10px 12px;
		font-size: 13px;
	}

	.selected-file-item {
		padding: 10px 12px;
		gap: 10px;
	}

	.file-preview-container {
		gap: 8px;
	}

	.file-icon-preview {
		width: 40px;
		height: 40px;
	}

	.file-image-preview {
		width: 40px !important;
		height: 40px !important;
		max-width: 40px !important;
		max-height: 40px !important;
		min-width: 40px !important;
		min-height: 40px !important;
	}

	.file-image-preview img {
		width: 40px !important;
		height: 40px !important;
		max-width: 40px !important;
		max-height: 40px !important;
		min-width: 40px !important;
		min-height: 40px !important;
	}

	.file-name {
		font-size: 13px;
	}

	.file-details {
		font-size: 11px;
		gap: 8px;
	}

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