/**
 * Copy Code Boxes – frontend styles.
 * All colors/sizes come from CSS custom properties set inline per shortcode
 * (configured in wp-admin → Einstellungen → Copy Code Boxes). The values below are fallbacks.
 */

/* ===== Fallback values (used if the inline variables are missing) ===== */
.ccb {
	--ccb-box-bg: #f3f3f3;
	--ccb-box-border: transparent;
	--ccb-text: #6b6b6b;
	--ccb-desc: #8a8a8a;
	--ccb-font: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
	--ccb-size: 17px;
	--ccb-radius: 6px;
	--ccb-pad: 18px;
	--ccb-gap: 12px;
	--ccb-btn-bg: #0a6fd6;
	--ccb-btn-text: #fff;
	--ccb-btn-copied: #1f9d55;
	--ccb-btn-radius: 4px;
	--ccb-btn-size: 13px;
	--ccb-more-bg: #0a6fd6;
	--ccb-more-text: #fff;
	--ccb-more-size: 15px;
	--ccb-btn-edge: 10px; /* distance of the copy button to the box edge in "top" mode */

	position: relative;
	margin: 0 0 1.5em;
	box-sizing: border-box;
}

.ccb *,
.ccb *::before,
.ccb *::after {
	box-sizing: border-box;
}

/* ===== List (reset theme/page-builder list styles, e.g. Divi bullets + padding) ===== */
.ccb ul.ccb-list {
	display: flex;
	flex-direction: column;
	gap: var(--ccb-gap);
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
}

.ccb li.ccb-item {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-width: 0;
	margin: 0 !important;
	padding: var(--ccb-pad) !important;
	list-style: none !important;
	background: var(--ccb-box-bg);
	border: 1px solid var(--ccb-box-border);
	border-radius: var(--ccb-radius);
}

.ccb li.ccb-item::before,
.ccb li.ccb-item::marker {
	content: none;
}

.ccb li.ccb-item[hidden] {
	display: none !important;
}

/* ===== Code + description ===== */
.ccb .ccb-text {
	display: block;
	min-width: 0;
}

.ccb code.ccb-code {
	display: block;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	color: var(--ccb-text);
	font-family: var(--ccb-font);
	font-size: var(--ccb-size);
	line-height: 1.4;
	overflow-wrap: anywhere;
	white-space: normal;
}

.ccb .ccb-desc {
	display: block;
	margin-top: 4px;
	color: var(--ccb-desc);
	font-size: 0.8em;
	line-height: 1.4;
}

/* ===== Expired codes (below the active ones) ===== */
.ccb li.ccb-sep {
	margin: calc(var(--ccb-gap) * 1.5) 0 0 !important;
	padding: 0 !important;
	list-style: none !important;
	color: var(--ccb-desc);
	font-size: 0.85em;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.ccb li.ccb-sep::before,
.ccb li.ccb-sep::marker { content: none; }
.ccb li.ccb-sep[hidden] { display: none !important; }
.ccb li.ccb-item--expired { opacity: 0.6; }
.ccb li.ccb-item--expired code.ccb-code { text-decoration: line-through; text-decoration-thickness: 1px; }
.ccb .ccb-badge {
	display: inline-block;
	margin-left: 10px;
	padding: 2px 8px;
	border: 1px solid currentColor;
	border-radius: 999px;
	color: var(--ccb-desc);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.4;
	vertical-align: middle;
}
.ccb li.ccb-item--expired .ccb-text { display: flex; flex-wrap: wrap; align-items: center; }
.ccb li.ccb-item--expired .ccb-desc,
.ccb li.ccb-item--expired .ccb-date { flex-basis: 100%; }

/* "Hinzugefügt am" date below the code */
.ccb .ccb-date {
	display: block;
	margin-top: 3px;
	color: var(--ccb-desc);
	font-size: 12px;
	line-height: 1.4;
}

/* ===== Copy button ===== */
.ccb button.ccb-copy {
	flex: 0 0 auto;
	margin: 0;
	padding: 0.35em 0.9em;
	border: 0;
	border-radius: var(--ccb-btn-radius);
	background: var(--ccb-btn-bg);
	color: var(--ccb-btn-text);
	font-family: inherit;
	font-size: var(--ccb-btn-size);
	font-weight: 600;
	line-height: 1.3;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	transition: background-color 0.15s ease, filter 0.15s ease;
}

/* "top" mode: button sits in the top-right corner like in classic code lists */
.ccb--btn-top button.ccb-copy {
	align-self: flex-start;
	margin-top: calc(var(--ccb-btn-edge) - var(--ccb-pad));
	margin-right: calc(var(--ccb-btn-edge) - var(--ccb-pad));
}

.ccb button.ccb-copy:hover {
	filter: brightness(1.1);
}

.ccb button.ccb-copy:focus-visible,
.ccb button.ccb-more:focus-visible {
	outline: 2px solid var(--ccb-btn-bg);
	outline-offset: 2px;
}

.ccb button.ccb-copy.is-copied {
	background: var(--ccb-btn-copied);
}

.ccb button.ccb-copy.is-error {
	background: #c0392b;
}

/* ===== "Show all" button ===== */
.ccb .ccb-more-wrap {
	display: flex;
	margin-top: var(--ccb-gap);
}

.ccb .ccb-more-wrap[hidden] {
	display: none;
}

.ccb .ccb-align-left   { justify-content: flex-start; }
.ccb .ccb-align-center { justify-content: center; }
.ccb .ccb-align-right  { justify-content: flex-end; }

.ccb button.ccb-more {
	margin: 0;
	padding: 0.6em 1.4em;
	border: 0;
	border-radius: var(--ccb-btn-radius);
	background: var(--ccb-more-bg);
	color: var(--ccb-more-text);
	font-family: inherit;
	font-size: var(--ccb-more-size);
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.ccb .ccb-align-full button.ccb-more {
	width: 100%;
}

.ccb button.ccb-more:hover {
	filter: brightness(1.1);
}

/* ===== Screen-reader live region ("Kopiert: CODE") ===== */
.ccb .ccb-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ===== Small screens ===== */
@media (max-width: 480px) {
	.ccb code.ccb-code {
		font-size: calc(var(--ccb-size) * 0.9);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ccb button.ccb-copy,
	.ccb button.ccb-more {
		transition: none;
	}
}
