/* Feedback dialog (ui/feedback-dialog.js) and its header button */

.feedback-trigger {
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 8px;
	padding: 0;
	border: 1px solid var(--theme-border-primary, #3e3e42);
	border-radius: 9px;
	background: var(--theme-bg-tertiary, #252526);
	color: var(--theme-text-secondary, #9ca3af);
	cursor: pointer;
	transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.feedback-trigger:hover {
	background: var(--theme-bg-active, #4e4e52);
	color: var(--theme-text-primary, #e5e7eb);
}

.feedback-trigger svg {
	width: 18px;
	height: 18px;
	display: block;
}

/* ── Dialog ──────────────────────────────────────────────────── */

.feedback-dialog {
	/* main.css resets every margin; a modal dialog is centred by margin: auto */
	margin: auto;
	width: min(520px, calc(100vw - 32px));
	max-height: calc(100vh - 48px);
	padding: 0;
	border: 1px solid var(--theme-border-primary, #3e3e42);
	border-radius: 12px;
	background: var(--theme-bg-secondary, #2d2d30);
	color: var(--theme-text-primary, #e5e7eb);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
	font-size: 13px;
}

/* Keeps wheel and touch scrolling inside the dialog instead of moving the
   page behind it. ::backdrop only honours overscroll-behavior once it is a
   scroll container, hence overflow: hidden. */
.feedback-dialog:modal {
	overscroll-behavior: contain;
}

.feedback-dialog::backdrop {
	background: rgba(0, 0, 0, 0.55);
	overflow: hidden;
	overscroll-behavior: contain;
}

.feedback-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
}

.feedback-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.feedback-head h1 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.feedback-close {
	border: none;
	background: none;
	color: var(--theme-text-secondary, #9ca3af);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 8px;
	border-radius: 6px;
}

.feedback-close:hover {
	color: var(--theme-text-primary, #e5e7eb);
	background: var(--theme-bg-hover, #3e3e42);
}

.feedback-intro,
.feedback-privacy {
	margin: 0;
	color: var(--theme-text-secondary, #9ca3af);
	line-height: 1.45;
}

.feedback-privacy {
	font-size: 12px;
}

.feedback-link {
	color: var(--theme-text-accent, #4ec9b0);
}

.feedback-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.feedback-label {
	font-weight: 600;
	padding: 0;
}

.feedback-hint {
	display: block;
	color: var(--theme-text-secondary, #9ca3af);
	font-size: 12px;
	line-height: 1.4;
}

.feedback-categories {
	margin: 0;
	padding: 0;
	border: none;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.feedback-category-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.feedback-category {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	border: 1px solid var(--theme-border-primary, #3e3e42);
	border-radius: 999px;
	background: var(--theme-bg-tertiary, #252526);
	cursor: pointer;
}

.feedback-category:has(input:checked) {
	border-color: var(--theme-primary, #4ec9b0);
	color: var(--theme-text-accent, #4ec9b0);
}

.feedback-category:has(input:focus-visible) {
	outline: 2px solid var(--theme-primary, #4ec9b0);
	outline-offset: 2px;
}

.feedback-category input {
	margin: 0;
	accent-color: var(--theme-primary, #4ec9b0);
}

.feedback-input {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid var(--theme-border-primary, #3e3e42);
	border-radius: 8px;
	background: var(--theme-bg-primary, #1e1e1e);
	color: var(--theme-text-primary, #e5e7eb);
	font: inherit;
}

textarea.feedback-input {
	resize: vertical;
	min-height: 96px;
}

.feedback-input:focus-visible {
	outline: 2px solid var(--theme-primary, #4ec9b0);
	outline-offset: 1px;
}

/* Errors appear only after the user worked on a field or tried to send. */
.feedback-error {
	display: none;
	color: var(--theme-text-error);
	font-size: 12px;
}

.feedback-input:user-invalid {
	border-color: #f87171;
	border-width: 2px;
}

.feedback-input:user-invalid + .feedback-error {
	display: block;
}

.feedback-compile {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 8px 10px;
	border-left: 4px solid #ef4444;
	border-radius: 6px;
	background: var(--theme-bg-primary, #1e1e1e);
}

.feedback-compile-first {
	font-family: 'Consolas', 'Menlo', monospace;
	font-size: 12px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	max-height: 4.5em;
	overflow: hidden;
	color: var(--theme-text-secondary, #9ca3af);
}

.feedback-shot-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.feedback-thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.feedback-thumbs:empty {
	display: none;
}

.feedback-thumb {
	position: relative;
	width: 96px;
	height: 64px;
	border: 1px solid var(--theme-border-primary, #3e3e42);
	border-radius: 6px;
	overflow: hidden;
	background: var(--theme-bg-primary, #1e1e1e);
}

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

.feedback-thumb-remove {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 20px;
	height: 20px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
}

.feedback-check {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	cursor: pointer;
}

.feedback-check input {
	margin: 2px 0 0;
	accent-color: var(--theme-primary, #4ec9b0);
}

.feedback-details summary {
	cursor: pointer;
	color: var(--theme-text-secondary, #9ca3af);
}

.feedback-details dl {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 2px 12px;
	margin: 8px 0 0;
	font-size: 12px;
}

.feedback-details dt {
	color: var(--theme-text-secondary, #9ca3af);
}

.feedback-details dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.feedback-status {
	min-height: 1.4em;
	font-size: 12px;
	color: var(--theme-text-secondary, #9ca3af);
}

.feedback-status.error {
	color: var(--theme-text-error);
}

.feedback-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.feedback-btn {
	padding: 7px 14px;
	border: 1px solid var(--theme-border-primary, #3e3e42);
	border-radius: 8px;
	background: var(--theme-bg-tertiary, #252526);
	color: var(--theme-text-primary, #e5e7eb);
	font: inherit;
	cursor: pointer;
}

.feedback-btn:hover {
	background: var(--theme-bg-hover, #3e3e42);
}

.feedback-btn.primary {
	border-color: var(--theme-primary, #4ec9b0);
	background: var(--theme-primary, #4ec9b0);
	color: var(--theme-on-primary, #0b1210);
	font-weight: 600;
}

.feedback-btn.primary:hover {
	background: var(--theme-primary-hover, #5fd9c0);
}

.feedback-btn:disabled {
	opacity: 0.6;
	cursor: default;
}
