/**
 * Rabattcodes (gt-rc-*) — Dashboard-Tabelle, Modals-Ergänzungen,
 * Feld-Feedback im Anfrage-Formular, Hinweis in den Schnellaktionen.
 * Style Guide: UI neutral, Lila NUR für den primären CTA.
 */

.gt-rc {
	--gt-rc-dark: #1C1139;
	--gt-rc-accent: #6B35E9;
	--gt-rc-accent-hover: #8B5CF6;
	--gt-rc-border: #E1E0E6;
	--gt-rc-subtle: #F0EEF5;
	--gt-rc-muted: #8E8BA3;
	--gt-rc-success: #22C55E;
	--gt-rc-error: #E24B4A;
	--gt-rc-warning: #F59E0B;
	--gt-rc-info: #3B82F6;
	font-size: 15px;
	color: var(--gt-rc-dark);
}

.gt-rc-notice {
	background: #fff;
	border: 1px solid #E1E0E6;
	border-radius: 10px;
	padding: 14px 18px;
	color: #1C1139;
}

.gt-rc-notice-setup {
	border-left: 3px solid #F59E0B;
	margin-bottom: 16px;
}

/* ── Topbar: Chips + CTA ── */

.gt-rc-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}

.gt-rc-chips {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.gt-rc-chip {
	border: 1px solid var(--gt-rc-border);
	background: #fff;
	border-radius: 999px;
	padding: 6px 14px;
	font-size: 13px;
	color: var(--gt-rc-dark);
	cursor: pointer;
}

.gt-rc-chip:hover {
	border-color: var(--gt-rc-muted);
}

.gt-rc-chip.is-active {
	background: var(--gt-rc-dark);
	border-color: var(--gt-rc-dark);
	color: #fff;
}

.gt-rc-chip-count {
	opacity: 0.65;
	margin-left: 2px;
}

.gt-rc-btn-create {
	background: var(--gt-rc-accent);
	color: #fff;
	border: 0;
	border-radius: 8px;
	padding: 10px 18px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.gt-rc-btn-create:hover {
	background: var(--gt-rc-accent-hover);
}

/* ── Toolbar ── */

.gt-rc-toolbar {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}

.gt-rc-field-q input,
.gt-rc-field-haus select {
	border: 1px solid var(--gt-rc-border);
	border-radius: 8px;
	padding: 8px 12px;
	font-size: 14px;
	background: #fff;
	color: var(--gt-rc-dark);
	min-width: 220px;
}

.gt-rc-field-q input:focus {
	outline: none;
	border-color: var(--gt-rc-accent);
}

/* ── Tabelle ── */

.gt-rc-table-wrap {
	position: relative;
	background: #fff;
	border: 1px solid var(--gt-rc-border);
	border-radius: 12px;
	overflow-x: auto;
}

.gt-rc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.gt-rc-table thead th {
	text-align: left;
	padding: 12px 14px;
	background: var(--gt-rc-subtle);
	color: var(--gt-rc-muted);
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
}

.gt-rc-table tbody td {
	padding: 12px 14px;
	border-bottom: 1px solid var(--gt-rc-border);
	vertical-align: middle;
}

.gt-rc-table tbody tr:last-child td {
	border-bottom: 0;
}

.gt-rc-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-weight: 700;
	letter-spacing: 0.03em;
}

.gt-rc-copy,
.gt-rc-copy-link {
	border: 0;
	background: none;
	cursor: pointer;
	color: var(--gt-rc-muted);
	font-size: 14px;
	padding: 2px 4px;
	margin-left: 4px;
}

.gt-rc-copy:hover,
.gt-rc-copy-link:hover {
	color: var(--gt-rc-dark);
}

.gt-rc-usage {
	white-space: nowrap;
}

.gt-rc-usage-bar {
	display: block;
	width: 72px;
	height: 4px;
	background: var(--gt-rc-subtle);
	border-radius: 2px;
	margin-top: 4px;
	overflow: hidden;
}

.gt-rc-usage-fill {
	display: block;
	height: 100%;
	background: var(--gt-rc-success);
	border-radius: 2px;
}

.gt-rc-badge {
	display: inline-block;
	border-radius: 999px;
	padding: 3px 10px;
	font-size: 12px;
	font-weight: 600;
	background: var(--gt-rc-subtle);
	color: var(--gt-rc-muted);
}

.gt-rc-badge.is-success {
	background: rgba(34, 197, 94, 0.12);
	color: #15803D;
}

.gt-rc-badge.is-warn {
	background: rgba(245, 158, 11, 0.14);
	color: #B45309;
}

.gt-rc-badge.is-info {
	background: rgba(59, 130, 246, 0.12);
	color: #1D4ED8;
}

.gt-rc-notiz {
	color: var(--gt-rc-muted);
	font-size: 13px;
}

.gt-rc-actions {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.gt-rc-actions button {
	border: 1px solid var(--gt-rc-border);
	background: #fff;
	border-radius: 7px;
	padding: 5px 10px;
	font-size: 12px;
	color: var(--gt-rc-dark);
	cursor: pointer;
	white-space: nowrap;
}

.gt-rc-actions button:hover:not(:disabled) {
	border-color: var(--gt-rc-muted);
}

.gt-rc-actions button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.gt-rc-act-delete:not(:disabled) {
	color: var(--gt-rc-error);
}

/* Lade-Overlay — [hidden] explizit, sonst gewinnt display:flex (bekannte Falle). */
.gt-rc-overlay {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.65);
	display: flex;
	align-items: center;
	justify-content: center;
}

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

.gt-rc-spinner {
	width: 26px;
	height: 26px;
	border: 3px solid var(--gt-rc-border);
	border-top-color: var(--gt-rc-accent);
	border-radius: 50%;
	animation: gt-rc-spin 0.8s linear infinite;
}

@keyframes gt-rc-spin {
	to { transform: rotate(360deg); }
}

/* ── Busy-Zustand: Button gesperrt + Spinner (Doppelklick-Schutz) ── */

.gt-rc button.is-busy,
.gt-ad-overlay button.is-busy {
	position: relative;
	pointer-events: none;
	color: transparent !important;
	opacity: 1;
}

.gt-rc button.is-busy::after,
.gt-ad-overlay button.is-busy::after {
	content: '';
	position: absolute;
	inset: 0;
	margin: auto;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(28, 17, 57, 0.25);
	border-top-color: #1C1139;
	border-radius: 50%;
	animation: gt-rc-spin 0.8s linear infinite;
}

/* Auf gefüllten Buttons (Lila-CTA, Speichern) weißer Spinner. */
.gt-rc .gt-ad-btn.is-busy::after,
.gt-ad-overlay .gt-ad-btn.is-busy::after,
.gt-rc .gt-rc-btn-create.is-busy::after {
	border-color: rgba(255, 255, 255, 0.45);
	border-top-color: #fff;
}

/* ── Footer / Pagination ── */

.gt-rc-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 12px;
	color: var(--gt-rc-muted);
	font-size: 13px;
}

.gt-rc-pagination {
	display: flex;
	align-items: center;
	gap: 10px;
}

.gt-rc-pagination button {
	border: 1px solid var(--gt-rc-border);
	background: #fff;
	border-radius: 7px;
	padding: 6px 14px;
	font-size: 13px;
	cursor: pointer;
	color: var(--gt-rc-dark);
}

.gt-rc-pagination button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* ── Empty-State ── */

.gt-rc-empty {
	text-align: center;
	padding: 36px 24px;
	max-width: 520px;
	margin: 0 auto;
}

.gt-rc-empty h4 {
	margin: 0 0 8px;
	font-size: 18px;
	color: var(--gt-rc-dark);
}

.gt-rc-empty p {
	color: var(--gt-rc-muted);
	line-height: 1.7;
	margin: 0 0 14px;
}

.gt-rc-empty ol {
	text-align: left;
	display: inline-block;
	color: var(--gt-rc-dark);
	line-height: 1.9;
	margin: 0 0 18px;
	padding-left: 20px;
}

/* ── Statistik-Drawer ── */

.gt-rc-stats-row > td {
	background: #FAFAFB;
}

.gt-rc-stats-body {
	padding: 6px 4px;
	font-size: 14px;
}

.gt-rc-funnel {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}

.gt-rc-funnel-step b {
	font-size: 16px;
	color: var(--gt-rc-dark);
}

.gt-rc-funnel-sep {
	color: var(--gt-rc-muted);
}

.gt-rc-stats-meta {
	color: var(--gt-rc-muted);
	margin: 0 0 10px;
}

.gt-rc-stats-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	margin-bottom: 10px;
}

.gt-rc-stats-table th {
	text-align: left;
	color: var(--gt-rc-muted);
	font-weight: 600;
	padding: 6px 10px;
	border-bottom: 1px solid var(--gt-rc-border);
}

.gt-rc-stats-table td {
	padding: 6px 10px;
	border-bottom: 1px solid var(--gt-rc-subtle);
}

.gt-rc-stats-table a {
	color: #0969DA;
	text-decoration: none;
}

.gt-rc-mini {
	font-size: 12px;
	color: var(--gt-rc-muted);
}

.gt-rc-mini.is-ok {
	color: #15803D;
}

.gt-rc-mini.is-warn {
	color: #B45309;
}

.gt-rc-stats-foot {
	color: var(--gt-rc-muted);
	font-size: 12px;
	margin: 0;
}

.gt-rc-recount {
	border: 0;
	background: none;
	color: #0969DA;
	cursor: pointer;
	font-size: 12px;
	padding: 0;
	text-decoration: underline;
}

/* ── Modal-Ergänzungen (Basis-Styles kommen aus anfrage-detail.css) ── */

/* Grid statt Flex — die AD-CSS setzt input UND select auf width:100%,
   im Flex-Container quetscht das den Input zusammen. Gleiche Lösung wie
   AD selbst bei .gt-ad-of-rabatt-wrap (1fr + feste Spalte). */
.gt-rc-code-wrap {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 8px;
}

.gt-rc-wert-wrap {
	display: grid;
	grid-template-columns: 1fr 72px;
	gap: 8px;
}

.gt-rc-scope {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.gt-rc-scope-opt {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 14px;
	cursor: pointer;
	white-space: nowrap;
}

/* Radios nicht auf 100 % ziehen (AD-CSS setzt .gt-ad-form-row input breit). */
.gt-rc-scope-opt input[type="radio"] {
	width: auto;
	margin: 0;
	accent-color: #6B35E9;
}

.gt-rc-field-error {
	color: #E24B4A;
	font-size: 13px;
	margin: 4px 0 0;
}

.gt-rc-field-error[hidden] {
	display: none;
}

.gt-rc-hint-inline {
	color: #8E8BA3;
	font-size: 12px;
	margin: 4px 0 0;
}

.gt-rc-code-preview {
	font-size: 12px;
	color: #8E8BA3;
	margin: 4px 0 0;
}

.gt-rc-code-preview code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color: #1C1139;
}

/* Fallback-Basics, falls anfrage-detail (Modal-CSS) inaktiv ist. */
.gt-rc .gt-ad-overlay {
	position: fixed;
	inset: 0;
	background: rgba(28, 17, 57, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	padding: 16px;
}

.gt-rc .gt-ad-overlay[hidden] {
	display: none;
}

/* ── Feld-Feedback im Anfrage-Formular ── */

.gt-rc-feedback {
	font-size: 13px;
	line-height: 1.5;
	margin: 6px 0 0;
}

.gt-rc-feedback[hidden] {
	display: none;
}

.gt-rc-feedback.is-checking {
	color: #8E8BA3;
}

.gt-rc-feedback.is-ok {
	color: #15803D;
}

.gt-rc-feedback.is-warn {
	color: #B45309;
}

/* ── Hinweis in den Schnellaktionen (Betreiber, Detailseite) ── */

.gt-rc-anfrage-hint {
	display: flex;
	align-items: baseline;
	gap: 8px;
	border: 1px solid #E1E0E6;
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 14px;
	color: #1C1139;
	background: #fff;
	margin: 0 0 12px;
}

.gt-rc-anfrage-hint.is-ok {
	border-left: 3px solid #22C55E;
}

.gt-rc-anfrage-hint.is-warn {
	border-left: 3px solid #F59E0B;
}

.gt-rc-anfrage-hint-icon {
	flex: 0 0 auto;
}

/* ── Chip in der Anfragen-Tabelle (hinter dem Namen) ── */

.gt-rc-af-chip {
	display: inline-block;
	margin-left: 6px;
	border-radius: 999px;
	padding: 1px 8px;
	font-size: 11px;
	font-weight: 700;
	vertical-align: middle;
	cursor: help;
}

.gt-rc-af-chip.is-ok {
	background: rgba(34, 197, 94, 0.12);
	color: #15803D;
}

.gt-rc-af-chip.is-warn {
	background: rgba(245, 158, 11, 0.14);
	color: #B45309;
}

/* ── Hinweis-Box im Angebots-Kalkulator ── */

.gt-rc-offer-hint[hidden] {
	display: none;
}

.gt-rc-hint-box {
	border: 1px solid #E1E0E6;
	border-left: 3px solid #22C55E;
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 13px;
	line-height: 1.6;
	background: #fff;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.gt-rc-hint-box.is-warn {
	border-left-color: #F59E0B;
}

.gt-rc-hint-box .gt-rc-hint-title {
	white-space: nowrap;
}

.gt-rc-hint-box .gt-rc-hint-text {
	flex: 1;
	min-width: 140px;
	color: #8E8BA3;
}

/* ── Responsive ── */

@media (max-width: 782px) {
	.gt-rc-topbar,
	.gt-rc-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.gt-rc-btn-create {
		width: 100%;
	}

	.gt-rc-field-q input,
	.gt-rc-field-haus select {
		width: 100%;
		min-width: 0;
	}
}
