/* Templates Rocket Catalog Manager — frontend.
   The download button is a plain <button>, so it inherits your active theme's
   button styling. We only add icon/label alignment — no colors are forced. */

.catr-download-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	cursor: pointer;
}

.catr-download-btn svg {
	flex-shrink: 0;
}

.catr-download-btn[disabled] {
	opacity: 0.6;
	cursor: default;
}

/* Download trigger while a request is in flight (works for links/divs too) */
[data-catr-catalog][aria-disabled="true"],
.catr-download-btn[aria-disabled="true"] { pointer-events: none; opacity: .6; }

/* ------------------------------------------------------------------
   Download form dialog.
   Uses the theme's font. The button color comes from the form settings
   (--catr-accent, --catr-accent-text); everything else stays neutral.
   Selectors carry the dialog class so theme rules for inputs and buttons
   do not reshape the form.
   ------------------------------------------------------------------ */

html.catr-lock { overflow: hidden; }

.catr-overlay {
	--catr-accent: #1d2327;
	--catr-accent-text: #ffffff;
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	overflow-y: auto;
	background: rgba(15, 23, 42, .55);
	box-sizing: border-box;
}

.catr-overlay[hidden] { display: none; }

/* Open as a popover (top layer): drop the browser's popover box so the overlay
   still covers the whole window. */
.catr-overlay[popover] {
	width: auto;
	height: auto;
	margin: 0;
	border: 0;
	color: inherit;
}

.catr-overlay .catr-dialog {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 440px;
	margin: auto;
	padding: 28px 26px 24px;
	border-radius: 12px;
	background: #fff;
	color: #1e1e1e;
	box-shadow: 0 24px 64px rgba(0, 0, 0, .28);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	text-align: left;
	animation: catr-in .18s ease-out;
}

@keyframes catr-in {
	from { opacity: 0; transform: translateY(8px) scale(.98); }
	to { opacity: 1; transform: none; }
}

.catr-overlay .catr-dialog *,
.catr-overlay .catr-dialog *::before,
.catr-overlay .catr-dialog *::after { box-sizing: border-box; }

.catr-overlay .catr-close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #50575e;
	box-shadow: none;
	cursor: pointer;
}

.catr-overlay .catr-close:hover { background: #f0f0f1; color: #1e1e1e; }

.catr-overlay .catr-title {
	margin: 0 40px 6px 0;
	padding: 0;
	color: inherit;
	font-family: inherit;
	font-size: 1.35em;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
}

.catr-overlay .catr-intro { margin: 0 0 4px; color: #50575e; font-size: .95em; }
.catr-overlay .catr-catalog-name { margin: 0; color: #1e1e1e; font-weight: 600; }

.catr-overlay .catr-fields { display: flex; flex-direction: column; gap: 14px; margin: 18px 0 0; }

.catr-overlay .catr-field { min-width: 0; margin: 0; padding: 0; border: 0; }

.catr-overlay .catr-label {
	display: block;
	float: none;
	width: auto;
	margin: 0 0 5px;
	padding: 0;
	color: #1e1e1e;
	font-size: .9em;
	font-weight: 600;
	line-height: 1.4;
}

.catr-overlay .catr-req { color: #b32d2e; }

.catr-overlay .catr-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.catr-overlay .catr-dialog .catr-input {
	display: block;
	width: 100%;
	max-width: none;
	min-height: 44px;
	margin: 0;
	padding: 10px 12px;
	border: 1px solid #8c8f94;
	border-radius: 6px;
	background: #fff;
	color: #1e1e1e;
	box-shadow: none;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.3;
}

.catr-overlay .catr-dialog textarea.catr-input { min-height: 88px; resize: vertical; }

.catr-overlay .catr-dialog .catr-input:focus {
	border-color: var(--catr-accent);
	outline: 2px solid var(--catr-accent);
	outline-offset: 0;
	box-shadow: none;
}

.catr-overlay .catr-dialog .catr-input[aria-invalid="true"] { border-color: #b32d2e; }

.catr-overlay .catr-choices { display: flex; flex-direction: column; gap: 6px; }

.catr-overlay .catr-choice {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0;
	font-size: .95em;
	font-weight: 400;
	line-height: 1.45;
	cursor: pointer;
}

.catr-overlay .catr-choice input {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	accent-color: var(--catr-accent);
}

.catr-overlay .catr-choice input:focus-visible { outline: 2px solid var(--catr-accent); outline-offset: 2px; }
.catr-overlay .catr-consent a { color: inherit; text-decoration: underline; }
.catr-overlay .catr-help { margin: 5px 0 0; color: #50575e; font-size: .85em; }
.catr-overlay .catr-error { margin: 5px 0 0; color: #b32d2e; font-size: .85em; font-weight: 500; }

.catr-overlay .catr-form-error {
	margin: 16px 0 0;
	padding: 10px 12px;
	border-radius: 6px;
	background: #fcf0f1;
	color: #8a2424;
	font-size: .9em;
}

.catr-overlay .catr-turnstile { margin: 16px 0 0; }

.catr-overlay .catr-dialog .catr-submit {
	display: block;
	width: 100%;
	min-height: 48px;
	margin: 20px 0 0;
	padding: 12px 18px;
	border: 0;
	border-radius: 6px;
	background: var(--catr-accent);
	color: var(--catr-accent-text);
	box-shadow: none;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: normal;
	text-align: center;
	text-transform: none;
	cursor: pointer;
}

.catr-overlay .catr-dialog .catr-submit:hover { filter: brightness(1.1); }
.catr-overlay .catr-dialog .catr-submit[aria-busy="true"] { opacity: .75; cursor: progress; }

.catr-overlay .catr-dialog .catr-submit:focus-visible,
.catr-overlay .catr-close:focus-visible {
	outline: 2px solid var(--catr-accent);
	outline-offset: 2px;
}

.catr-overlay .catr-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.catr-overlay .catr-success { padding: 16px 0 4px; text-align: center; }
.catr-overlay .catr-success-icon { color: var(--catr-accent); }
.catr-overlay .catr-success-text { margin: 10px 0 0; font-size: 1.05em; }
.catr-overlay .catr-success-link { margin: 10px 0 0; }
.catr-overlay .catr-success-link a { color: inherit; font-weight: 600; text-decoration: underline; }

@media (max-width: 480px) {
	.catr-overlay { padding: 10px; }
	.catr-overlay .catr-dialog { padding: 24px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
	.catr-overlay .catr-dialog { animation: none; }
}
