/**
 * File Upload Component (shared, single source of truth)
 *
 * Styles the attachment dropzone + selected-file list rendered by the shared
 * assets/js/file-upload-handler.js. Enqueued everywhere that script loads
 * (admin add-ticket / reply / forward & update modals, and the client portal),
 * so every surface renders identically.
 *
 * Branding accent uses --mshd-color-primary (defined on the portal) with a
 * WP-admin-blue fallback for the admin context.
 */

/* Field wrapper */
.mshd-file-upload-field {
	margin-bottom: 20px;
}

.mshd-file-upload-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 12px;
}

/* Optional "Add Files" button (rendered only when show_add_button is true) */
.mshd-add-files-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	background: var(--mshd-color-primary, var(--mshd-accent));
	color: var(--mshd-white);
	border: none;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.2s ease;
}

.mshd-add-files-btn:hover {
	background: var(--mshd-color-primary-aaa, var(--mshd-accent-dark));
}

.mshd-add-files-btn svg {
	width: 18px;
	height: 18px;
}

/* Visually hidden but focusable native file input */
.mshd-file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Dropzone = a <label> wrapping the input; the whole panel is the target */
.mshd-drop-zone {
	display: block;
	margin-top: 16px;
	padding: 40px 24px;
	border: 2px dashed var(--mshd-border-strong);
	border-radius: 8px;
	text-align: center;
	background: var(--mshd-bg-soft);
	cursor: pointer;
	transition: all 0.2s ease;
}

.mshd-drop-zone:hover {
	border-color: var(--mshd-color-primary, var(--mshd-accent));
	background: var(--mshd-accent-soft);
}

.mshd-drop-zone:focus-within {
	outline: 2px solid var(--mshd-color-primary, var(--mshd-accent));
	outline-offset: 2px;
	border-color: var(--mshd-color-primary, var(--mshd-accent));
}

.mshd-drop-zone.mshd-dragover {
	border-color: var(--mshd-color-primary, var(--mshd-accent));
	background: var(--mshd-accent-soft);
}

.mshd-drop-zone svg {
	width: 40px;
	height: 40px;
	color: var(--mshd-text-faint);
}

/* Prompt line (icon + single continuous text) */
.mshd-drop-zone .mshd-dropzone-prompt {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	flex-wrap: wrap;
	margin: 0;
	font-weight: 600;
	font-size: 14px;
	color: var(--mshd-text);
}

/* Constraints helper text, inside the panel */
.mshd-drop-zone .mshd-upload-constraints {
	margin: 12px 0 0;
	padding: 0;
	background: none;
	border: 0;
	font-size: 12px;
	font-weight: 400;
	font-style: normal;
	color: var(--mshd-text-soft);
	line-height: 1.5;
}

.mshd-upload-constraints .mshd-upload-limit-line,
.mshd-upload-constraints .mshd-upload-types-line {
	display: block;
}

.mshd-upload-constraints strong {
	color: var(--mshd-text);
	font-weight: 600;
}

/* Selected-file list */
.mshd-file-preview-list {
	margin-top: 16px;
}

.mshd-file-preview-list:empty {
	margin-top: 0;
}

.mshd-file-items {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.mshd-file-item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 16px;
	background: var(--mshd-surface);
	border: 1px solid var(--mshd-border);
	border-radius: 8px;
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.mshd-file-item:hover {
	border-color: var(--mshd-accent);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mshd-file-icon {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	color: var(--mshd-accent);
}

.mshd-file-icon svg {
	width: 24px;
	height: 24px;
}

.mshd-file-name {
	flex: 1;
	min-width: 0;
	font-weight: 600;
	font-size: 14px;
	color: var(--mshd-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
}

.mshd-file-name:hover {
	color: var(--mshd-accent);
}

.mshd-file-size {
	flex-shrink: 0;
	color: var(--mshd-text-muted);
	font-size: 12px;
}

.mshd-remove-file {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	background: var(--mshd-surface);
	color: var(--mshd-accent);
	border: 1px solid var(--mshd-border-strong);
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.15s ease;
}

.mshd-remove-file:hover,
.mshd-remove-file:focus-visible {
	color: var(--mshd-danger-dark);
	border-color: var(--mshd-danger-dark);
	background: var(--mshd-danger-bg);
}

.mshd-remove-file svg {
	width: 16px;
	height: 16px;
}
