/**
 * Handifable Review Media — frontend styles (hrm- prefix).
 */

/* ------------------------------------------------------------------ *
 * Review form: upload button + previews
 * ------------------------------------------------------------------ */

.hrm-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	margin-bottom: 0.4rem;
}

.hrm-tb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2rem;
	height: 1.75rem;
	padding: 0 0.45rem;
	background: #f6f6f6;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	color: #333;
	cursor: pointer;
	font-size: 0.8rem;
	font-family: inherit;
	line-height: 1;
}

.hrm-tb-btn:hover {
	background: #ececec;
	color: #111;
}

.hrm-tb-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 1px;
}

.comment-form-hrm {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin: 0 0 0.75rem;
}

.hrm-add-button {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.4rem 0.9rem;
	background: #fff;
	border: 1px dashed #c9c9c9;
	border-radius: 8px;
	color: #444;
	cursor: pointer;
	font-size: 0.875rem;
	font-family: inherit;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.hrm-add-button:hover:not([disabled]) {
	border-color: #8f8f8f;
	color: #111;
}

.hrm-add-button.is-dragover {
	border-color: #111;
	border-style: solid;
	background: #f4f4f4;
}

.hrm-add-button[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

.hrm-add-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.hrm-hint {
	font-size: 0.75rem;
	color: #757575;
}

/* Previews */

.hrm-previews {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}

.hrm-preview {
	position: relative;
	width: 64px;
	height: 64px;
	border: 1px solid #e3e3e3;
	border-radius: 8px;
	overflow: hidden;
	background: #f6f6f6;
}

.hrm-preview img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hrm-preview.is-uploading::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(45deg, transparent 45%, rgba(255, 255, 255, 0.9) 50%, transparent 55%, transparent)
		no-repeat;
	background-size: var(--hrm-progress, 0%) 200%;
	background-color: rgba(0, 0, 0, 0.25);
}

.hrm-preview-remove {
	position: absolute;
	top: 2px;
	right: 2px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.1rem;
	height: 1.1rem;
	padding: 0;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 9999px;
	color: #222;
	cursor: pointer;
	font-size: 0.7rem;
	line-height: 1;
}

.hrm-preview-remove:hover {
	background: #111;
	color: #fff;
}

/* Errors */

.hrm-errors {
	margin-bottom: 0.75rem;
}

.hrm-error {
	padding: 0.4rem 0.7rem;
	background: #fdf0ef;
	border: 1px solid #f0c5c4;
	border-left: 3px solid #b32d2e;
	border-radius: 4px;
	color: #7a1f1f;
	font-size: 0.8125rem;
}

/* ------------------------------------------------------------------ *
 * Review display: gallery
 * ------------------------------------------------------------------ */

.hrm-review-gallery {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: 0.6rem;
}

.hrm-review-img {
	display: block;
	width: 72px;
	height: 72px;
	border: 1px solid #e3e3e3;
	border-radius: 8px;
	overflow: hidden;
	cursor: zoom-in;
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.hrm-review-img:hover {
	border-color: #9a9a9a;
	transform: translateY(-1px);
}

.hrm-review-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ------------------------------------------------------------------ *
 * Lightbox
 * ------------------------------------------------------------------ */

.hrm-modal[hidden] {
	display: none;
}

.hrm-modal {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hrm-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.68);
}

.hrm-modal__body {
	position: relative;
	z-index: 1;
	display: flex;
	margin: 0;
	animation: hrm-modal-in 0.15s ease-out;
}

.hrm-modal__img {
	display: block;
	max-width: min(92vw, 1200px);
	max-height: 88vh;
	width: auto;
	height: auto;
	object-fit: contain;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 10px 45px rgba(0, 0, 0, 0.35);
}

.hrm-modal__close {
	position: absolute;
	top: 0;
	right: 0;
	transform: translate(40%, -40%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 9999px;
	color: #111;
	cursor: pointer;
	box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

.hrm-modal__close:hover {
	background: #f3f3f3;
}

.hrm-modal__close:focus-visible {
	outline: 2px solid #111;
	outline-offset: 2px;
}

@keyframes hrm-modal-in {
	from {
		opacity: 0;
		transform: scale(0.96);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

body.hrm-modal-open {
	overflow: hidden;
}
