/*------------------------------
| Shared File Upload Zone
|
| Canonical styles for the shared drag & drop file upload component
| (itg_file_upload_zone() / ITGFileUpload). Consolidates the rules that were
| previously duplicated in form-builder-style.css and uploaded-documents-style.css.
------------------------------*/

.itg-file-upload-zone {
	max-width: 500px;
	margin-bottom: 1.5rem;
}

.itg-file-upload-zone--fluid {
	max-width: 100%;
	margin-bottom: 0;
}

/* Let the field label run past the dropzone width so it stays on one line
   (reverts to wrapping on narrow viewports to avoid horizontal scroll). */
@media (min-width: 576px) {
	.itg-file-upload-zone > .itg-file-upload-label {
		white-space: nowrap;
	}
}

/* Uploaded file names can contain long unbroken runs (e.g. underscores), so
   allow them to break instead of overflowing the modal/panel. */
.itg-file-upload-zone .itg-form-text-dark {
	overflow-wrap: anywhere;
	word-break: break-word;
}

.itg-file-upload-dropzone {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 140px;
	border: 2px dashed var(--muted);
	border-radius: 12px;
	background: var(--secondary);
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease;
	padding: 20px;
}

.itg-file-upload-dropzone:hover,
.itg-file-upload-dropzone:focus {
	border-color: var(--primary-light);
	background: rgba(var(--primary-light-rgb), 0.04);
}

.itg-file-upload-dropzone--drag-over {
	border-color: var(--primary);
	background: rgba(var(--primary-light-rgb), 0.08);
}

.itg-file-upload-dropzone--has-file {
	border-style: solid;
	border-color: var(--muted);
	min-height: 80px;
	cursor: default;
}

.itg-file-upload-prompt {
	text-align: center;
	pointer-events: none;
}

.itg-file-upload-icon {
	color: var(--muted-darker);
	margin-bottom: 8px;
}

.itg-file-upload-text {
	font-family: 'Outfit', sans-serif;
	font-size: 0.9rem;
	color: var(--muted-darker);
	margin: 0 0 4px;
	font-weight: 500;
}

.itg-file-upload-hint {
	font-family: 'Outfit', sans-serif;
	font-size: 0.78rem;
	color: var(--muted-alt);
	margin: 0;
}

.itg-file-upload-file,
.itg-file-upload-existing {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
}

.itg-file-upload-preview {
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	border-radius: 8px;
	background: var(--secondary);
	border: 1px solid var(--muted);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.itg-file-upload-thumb {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.itg-file-upload-icon-file {
	color: var(--muted-darker);
	display: flex;
	align-items: center;
	justify-content: center;
}

.itg-file-upload-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.itg-file-upload-name {
	font-family: 'Outfit', sans-serif;
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--primary);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.itg-file-upload-size {
	font-family: 'Outfit', sans-serif;
	font-size: 0.78rem;
	color: var(--muted-alt);
}

.itg-file-upload-remove {
	flex-shrink: 0 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 32px !important;
	height: 32px !important;
	border: none !important;
	border-radius: 50% !important;
	background: transparent !important;
	color: var(--muted-darker) !important;
	cursor: pointer !important;
	transition: background 0.15s ease, color 0.15s ease !important;
	padding: 0 !important;
}

.itg-file-upload-remove svg {
	color: currentColor !important;
	fill: currentColor !important;
	width: 100% !important;
	height: 100% !important;
}

.itg-file-upload-remove:hover svg {
	color: var(--primary-red) !important;
	fill: var(--primary-red) !important;
}

.itg-file-upload-remove:hover {
	background: rgba(var(--primary-red-rgb), 0.1) !important;
	color: var(--primary-red) !important;
}

.itg-file-upload-replace {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid var(--primary);
	border-radius: 8px;
	background: transparent;
	color: var(--primary);
	font-family: 'Outfit', sans-serif;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1;
	padding: 8px 12px;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease, color 0.15s ease;
}

.itg-file-upload-replace:hover,
.itg-file-upload-replace:focus {
	background: var(--primary);
	color: var(--secondary);
}

.itg-file-upload-error {
	font-family: 'Outfit', sans-serif;
	font-size: 0.82rem;
	color: var(--primary-red);
	margin-top: 6px;
	padding: 6px 12px;
	border-radius: 6px;
	background: rgba(var(--primary-red-rgb), 0.06);
}

.itg-file-upload-dropzone--error {
	border-color: var(--primary-red);
	background: rgba(var(--primary-red-rgb), 0.04);
}
