/**
 * Compact HivePress repeater fields.
 */

body.nh-hivepress-forms .hp-field--repeater,
.hp-modal .hp-field--repeater {
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
}

body.nh-hivepress-forms .hp-form__field:has(.nh-hp-repeater) .hp-field__label,
body.nh-hivepress-forms .hp-form__field:has(.nh-hp-repeater) .hp-form__label {
	margin-bottom: 10px !important;
}

.nh-hp-repeater__list {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--nh-hp-form-border, #e2e8f0);
	border-radius: 12px;
	background: #fff;
	overflow: hidden;
}

.nh-hp-repeater__item {
	border-bottom: 1px solid #eef2f7;
}

.nh-hp-repeater__item:last-child {
	border-bottom: 0;
}

.nh-hp-repeater__toolbar {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	padding: 8px 12px;
	background: #f8fafc;
	border-bottom: 1px solid #eef2f7;
}

.nh-hp-repeater__meta {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
}

.nh-hp-repeater__index {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: #e2e8f0;
	color: #475569;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.nh-hp-repeater__item.is-named .nh-hp-repeater__index {
	background: var(--nh-hp-form-primary-soft, #eef2ff);
	color: var(--nh-hp-form-primary, #1b4fd8);
}

.nh-hp-repeater__title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 13px;
	font-weight: 600;
	color: #64748b;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nh-hp-repeater__item.is-named .nh-hp-repeater__title {
	color: var(--nh-hp-form-label, #0b2d5b);
}

.nh-hp-repeater [data-sort],
.nh-hp-repeater [data-remove] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	color: #94a3b8;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.nh-hp-repeater [data-sort] {
	cursor: grab;
}

.nh-hp-repeater [data-sort]:hover {
	background: #eef2f7;
	color: #475569;
}

.nh-hp-repeater [data-remove]:hover {
	background: #fee2e2;
	color: #dc2626;
}

.nh-hp-repeater__fields-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px 12px;
	padding: 12px;
}

.nh-hp-repeater[data-repeater-name="opening_hours"] .nh-hp-repeater__fields-grid {
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr);
}

.nh-hp-repeater__field-slot--media,
.nh-hp-repeater__field-slot:has(.hp-field--attachment-upload),
.nh-hp-repeater__field-slot:has(.hp-field--attachment-select) {
	grid-column: 1 / -1;
}

.nh-hp-repeater__field {
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 0;
}

.nh-hp-repeater__field-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: #94a3b8;
	line-height: 1.2;
}

.nh-hp-repeater input.hp-field,
.nh-hp-repeater textarea.hp-field,
.nh-hp-repeater select.hp-field,
.nh-hp-repeater .hp-field--location input {
	min-height: 40px !important;
	padding: 8px 11px !important;
	font-size: 0.875rem !important;
	border-radius: 10px !important;
}

.nh-hp-repeater .select2-container--default .select2-selection--single {
	min-height: 40px !important;
	border-radius: 10px !important;
}

.nh-hp-repeater__add.button,
.nh-hp-repeater [data-add].button {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
	width: auto !important;
	min-height: 0 !important;
	margin: 10px 0 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
	color: var(--nh-hp-form-primary, #1b4fd8) !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	box-shadow: none !important;
}

.nh-hp-repeater__add.button:hover,
.nh-hp-repeater [data-add].button:hover {
	background: transparent !important;
	color: var(--nh-hp-form-primary-hover, #1640b8) !important;
	text-decoration: underline;
}

.nh-hp-repeater__add-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 999px;
	background: var(--nh-hp-form-primary-soft, #eef2ff);
	color: var(--nh-hp-form-primary, #1b4fd8);
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
}

.nh-hp-repeater .hp-field--attachment-select {
	display: flex;
	align-items: center;
	gap: 10px;
}

.nh-hp-repeater .hp-field--attachment-select > div:first-child {
	position: relative;
	width: auto;
	margin: 0;
}

.nh-hp-repeater .hp-field--attachment-select > div:first-child img {
	width: 40px;
	height: 40px;
	border-radius: 8px;
	object-fit: cover;
}

.nh-hp-repeater .hp-field--attachment-select .nh-hp-upload__select-zone {
	flex: 1 1 auto;
	min-width: 0;
}

.nh-hp-repeater .hp-field--attachment-select .nh-hp-upload__drop {
	padding: 8px 10px;
	min-height: 40px;
}

.nh-hp-repeater .hp-field--attachment-select .nh-hp-upload__icon {
	width: 28px;
	height: 28px;
}

.nh-hp-repeater__field-slot:has(.hp-field--url) {
	grid-column: 1 / -1;
}

.nh-hp-repeater__field-slot--media .nh-hp-repeater__field-label {
	display: none;
}

.nh-hp-repeater .hp-field--attachment-select .nh-hp-upload__copy {
	display: none;
}

.nh-hp-repeater .hp-field--attachment-select .nh-hp-upload__drop {
	justify-content: flex-start;
}

.nh-hp-repeater .hp-field--attachment-select .nh-hp-upload__choose {
	font-size: 13px;
	font-weight: 600;
}

.nh-hp-repeater .hp-field--attachment-select [data-component="file-remove"] {
	position: static;
	width: 24px;
	height: 24px;
}

.nh-hp-repeater .nh-hp-upload--compact .nh-hp-upload__drop {
	padding: 8px 10px;
}

@media (max-width: 640px) {
	.nh-hp-repeater__fields-grid,
	.nh-hp-repeater[data-repeater-name="opening_hours"] .nh-hp-repeater__fields-grid {
		grid-template-columns: 1fr;
	}
}
