/* Structural base for every front-end component the plugin renders (.drx-* markup):
   product widgets (Woo Bridge) + resource rows/panels. Structural only, no !important,
   inherits the page font. The visual DROIX look lives in the selected skin
   (assets/css/skins/droix.css) so `skin: inherit` sites keep their own styling. */

/* ── Product widgets ─────────────────────────────────────────────── */

.drx-products-rail {
	display: flex;
	gap: 16px;
	overflow-x: auto;
	padding: 4px 0 12px;
}

.drx-product {
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	padding: 12px;
	background: #fff;
}

.drx-product--card,
.drx-product--rail {
	max-width: 220px;
	flex: 0 0 auto;
}

.drx-product--inline {
	display: flex;
	align-items: center;
	gap: 12px;
}

.drx-product__image img {
	max-width: 100%;
	height: auto;
	display: block;
}

.drx-product__name {
	display: block;
	font-weight: 600;
	text-decoration: none;
	margin-top: 8px;
}

.drx-product__price {
	font-weight: 700;
	margin-top: 4px;
}

.drx-product__stock {
	font-size: 0.85em;
	margin-top: 4px;
}

.drx-product__stock--oos {
	color: #b3261e;
}

.drx-product__stock--preorder {
	color: #8a5a00;
}

.drx-product__stock--instock {
	color: #1b7a3d;
}

.drx-product__stock--external {
	color: #666;
}

.drx-product__cta {
	display: inline-block;
	margin-top: 8px;
	padding: 6px 14px;
	border-radius: 4px;
	text-decoration: none;
	font-size: 0.9em;
}

.drx-product--fallback {
	color: #666;
	font-style: italic;
}

/* ── Resource rows / panels (dkr_resource_row / dkr_resources_panel) ── */

.drx-files {
	border: 1px solid #e2e2e2;
	border-radius: 8px;
	padding: 14px 16px;
	background: #fff;
}

.drx-files__title {
	font-size: 1em;
	font-weight: 700;
	margin: 0 0 8px;
}

.drx-topic-files__head,
.drx-topic-files__head > div {
	display: flex;
	align-items: baseline;
	gap: 14px;
	flex-wrap: wrap;
}

.drx-topic-files__head {
	justify-content: space-between;
	margin-bottom: 18px;
}

.drx-topic-files__head .drx-files__title {
	margin: 0;
}

.drx-topic-files__count,
.drx-topic-files__library {
	font-size: 0.85em;
}

.drx-topic-files__library {
	font-weight: 700;
	text-decoration: none;
}

.drx-res {
	border-top: 1px solid #f0f0f0;
	padding: 8px 0;
}

.drx-res:first-of-type,
.drx-files__title + .drx-res {
	border-top: 0;
}

.drx-res__row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.drx-res__badge {
	flex: 0 0 auto;
	font-size: 0.75em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	padding: 2px 8px;
	border-radius: 999px;
	background: #f0f0f0;
}

.drx-res__badge[data-type="fix_patch"] {
	background: #fde7e7;
	color: #9b1c1c;
}

.drx-res__info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.drx-res__name {
	font-weight: 600;
}

.drx-res__meta {
	font-size: 0.8em;
	color: #888;
}

.drx-res__devices {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin: 2px 0;
}

.drx-res__device {
	font-size: 0.75em;
	font-weight: 600;
	padding: 2px 9px;
	border-radius: 999px;
	background: #f0f0f0;
	text-decoration: none;
	color: inherit;
}

.drx-res__guide {
	flex: 0 0 auto;
	padding: 4px 12px;
	border-radius: 8px;
	border: 1px solid #d9d9d9;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.85em;
	color: inherit;
}

.drx-res__cta {
	flex: 0 0 auto;
	padding: 4px 12px;
	border-radius: 8px;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.85em;
}

/* Theme-prose bleed guard: generic article-body link rules (e.g. `.gsk-prose a`, 0-1-1
   specificity) must never restyle the download CTA — these 0-2-1 selectors outrank them
   regardless of stylesheet load order. Colours still come from the active skin's variables. */
.drx-res a.drx-res__cta,
.drx-files a.drx-res__cta {
	text-decoration: none;
}

.drx-res__versions {
	margin: 6px 0 0;
}

.drx-res__toggle {
	cursor: pointer;
	font-size: 0.85em;
	font-weight: 600;
	color: #555;
}

.drx-res__version {
	border: 1px solid #ececec;
	border-radius: 8px;
	padding: 8px 12px;
	margin-top: 6px;
}

.drx-res__version-head {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.drx-res__vbadge {
	font-size: 0.7em;
	font-weight: 700;
	letter-spacing: 0.05em;
	padding: 1px 6px;
	border-radius: 4px;
	background: #eef4d2;
}

.drx-res__vmeta {
	font-size: 0.8em;
	color: #888;
}

.drx-res__vdl {
	margin-left: auto;
	font-size: 0.8em;
	font-weight: 600;
	text-decoration: none;
	border: 1px solid #d9d9d9;
	border-radius: 6px;
	padding: 2px 10px;
}

.drx-res__notes {
	margin: 6px 0 0;
	padding-left: 18px;
	font-size: 0.85em;
	color: #666;
}

.drx-res__cta-icon {
	display: inline-block;
	width: 13px;
	height: 13px;
	flex: 0 0 auto;
}

.drx-res__chevron {
	display: inline-block;
	width: 9px;
	height: 9px;
	margin-left: 6px;
	flex: 0 0 auto;
}

.drx-res__current {
	flex: 0 0 auto;
	margin-left: auto;
	align-self: center;
	font-size: 0.8em;
	font-weight: 600;
}

.drx-res__rollback-note {
	margin: 8px 0 0;
	padding: 0 4px;
	font-size: 0.78em;
	color: #999;
}

/* ── Resource panel grouping (dkr_device_downloads() family view) ──────────── */

.drx-files__group + .drx-files__group {
	margin-top: 18px;
}

.drx-files__group-title {
	font-size: 0.95em;
	font-weight: 700;
	margin: 0 0 8px;
}

/* ── Download gate modal (dkr_gate_modal() / assets/js/front.js) ───────────── */

.drx-gate[hidden] {
	display: none;
}

.drx-gate {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: var( --drx-overlay, rgba( 0, 0, 0, 0.4 ) );
}

.drx-gate__card {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: 92vh;
	overflow-y: auto;
	box-sizing: border-box;
	padding: 26px 28px;
	background: var( --drx-card-bg, #fff );
	border-radius: var( --drx-card-radius, 24px );
	box-shadow: var( --drx-card-shadow, 0 24px 60px rgba( 17, 24, 39, 0.25 ) );
}

.drx-gate__close {
	position: absolute;
	top: 18px;
	right: 18px;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 10px;
	background: transparent;
	cursor: pointer;
	line-height: 1;
	font-size: 18px;
}

.drx-gate__badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 0.7em;
	font-weight: 700;
	letter-spacing: 0.05em;
}

.drx-gate__heading {
	margin: 14px 0 6px;
	padding-right: 32px;
	font-size: 1.35em;
	font-weight: 700;
}

.drx-gate__file {
	margin: 0 0 18px;
	font-size: 0.85em;
	line-height: 1.55;
}

.drx-gate__tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	border-radius: 14px;
	padding: 4px;
	margin-bottom: 16px;
}

.drx-gate__tab {
	box-sizing: border-box;
	cursor: pointer;
	height: 36px;
	border: 0;
	border-radius: 10px;
	font-size: 0.85em;
	font-weight: 700;
	background: transparent;
}

.drx-gate__form[hidden] {
	display: none;
}

.drx-gate__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 13px;
	font-size: 0.8em;
	font-weight: 600;
}

.drx-gate__input {
	box-sizing: border-box;
	width: 100%;
	height: 46px;
	border-radius: 14px;
	padding: 0 14px;
	font-size: 0.9em;
}

.drx-gate__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 16px;
	font-size: 0.8em;
}

.drx-gate__remember {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	cursor: pointer;
}

.drx-gate__cta {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	height: 48px;
	border: 0;
	border-radius: 16px;
	font-weight: 700;
	cursor: pointer;
}

.drx-gate__otp-request {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.drx-gate__otp-request[hidden],
.drx-gate__otp-verify[hidden] {
	display: none;
}

.drx-gate__codes {
	display: grid;
	grid-template-columns: repeat( 6, 1fr );
	gap: 8px;
	margin-bottom: 12px;
}

.drx-gate__code {
	box-sizing: border-box;
	width: 100%;
	height: 52px;
	text-align: center;
	font-size: 20px;
	font-weight: 700;
	border-radius: 14px;
}

.drx-gate__resend {
	display: block;
	margin: 0 auto 14px;
	border: 0;
	background: transparent;
	cursor: pointer;
	font-size: 0.78em;
}

.drx-gate__error {
	margin-bottom: 10px;
	font-size: 0.8em;
}

.drx-gate__error[hidden] {
	display: none;
}

.drx-gate__signup {
	margin: 18px 0 0;
	padding-top: 16px;
	border-top: 1px solid var( --drx-stroke, #f0f0f0 );
	text-align: center;
	font-size: 0.85em;
}

.drx-gate__signup-link {
	font-weight: 700;
	text-decoration: none;
}

.drx-gate__step[hidden] {
	display: none;
}

.drx-gate__step--success {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 10px 0 4px;
	text-align: center;
}

.drx-gate__check {
	width: 60px;
	height: 60px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-size: 26px;
}

.drx-gate__success-msg {
	margin: 0;
	font-size: 0.9em;
	line-height: 1.5;
}

/* ── Gate modal: liability disclaimer step (0.26.0, plugin-owned modal) ─────────────
   Structure only; skins colour it. The droix-kb theme renders its own step from the same
   dkr_disclaimer_copy() and styles it in the theme, so nothing here targets the theme. */
.drx-gate__step--disc .drx-gate__heading {
	margin-bottom: 4px;
}

.drx-gate__disc-file {
	margin-bottom: 10px;
}

.drx-gate__disc-intro {
	margin: 0 0 10px;
	font-size: 0.85em;
	line-height: 1.55;
}

.drx-gate__disc-list {
	margin: 0 0 14px;
	padding-left: 18px;
	font-size: 0.8em;
	line-height: 1.5;
}

.drx-gate__disc-list li + li {
	margin-top: 6px;
}

.drx-gate__disc-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0 0 14px;
	padding: 12px;
	border-radius: 12px;
	font-size: 0.8em;
	line-height: 1.45;
	cursor: pointer;
}

.drx-gate__disc-check input {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 1px 0 0;
	cursor: pointer;
}

.drx-gate__cta[disabled] {
	opacity: 0.45;
	cursor: not-allowed;
}

.drx-gate__cancel {
	display: block;
	width: 100%;
	margin-top: 8px;
	padding: 10px;
	border: 0;
	background: transparent;
	font-size: 0.8em;
	font-weight: 600;
	cursor: pointer;
}

.drx-gate__disc-fine {
	margin: 12px 0 0;
	font-size: 0.7em;
	line-height: 1.5;
	text-align: center;
}

.drx-gate__disc-fine a {
	text-decoration: underline;
}

/* Product-page downloads wrapper (dkr_product_downloads(), 0.26.0). */
.drx-product-downloads > .drx-files + .drx-files {
	margin-top: 24px;
}

/* Lazy PDP Downloads placeholder (dkr_product_downloads_placeholder(), 0.29.0). The skeleton
   reuses the `.drx-files.drx-files--panel` shell (skin surface, radius, padding and the phone
   trim below) with one bar per resource, sized like a resource row, so swapping in the fetched
   panel barely moves the layout (heights measured on gpdstore's GPD WIN 5 PDP, where every row
   carries a Changelog/Versions expander: ~122px desktop/tablet, 153–216px at 390px). Bars are 6%
   of the panel's text colour so every skin tints them without per-skin colours. */
.drx-lazy__label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* One row per resource; height = measured average loaded card incl. per-variant group headings
   (desktop/tablet ≈130px, ≤600px ≈182px, no gap on the GPD skin) so replacement barely shifts layout. */
.drx-lazy__row {
	position: relative;
	height: 130px; /* measured avg .drx-res outer height (desktop 129.6 / tablet 132.6) */
	margin: 0; /* real rows are border-separated, not gapped — a gap here alone measured 120px of CLS */
	border-radius: 14px;
	overflow: hidden;
}

/* Reserves the "Show more downloads" toggle's own box (0.29.1) when
   dkr_product_downloads_placeholder() folds the skeleton — height = the rendered
   .drx-files__more button's outer height including its top margin, so the CLS between
   skeleton and loaded panel stays at zero. Still `.drx-lazy__row`, so it keeps the shimmer. */
.drx-lazy__row--more {
	height: 55px; /* measured: 14px margin-top + 41px button box */
}

/* A folded skeleton (drx-lazy--folded, added by dkr_product_downloads_placeholder() when there's
   more than the fold) only ever shows its FIRST couple of rows — it can't benefit from averaging
   across many rows the way the unfolded skeleton does, and those first rows run taller on some
   fixtures (multi-line titles) or sit inside a group with a heading the skeleton never reserves.
   Height picked to minimise the worst-case gap across a flat panel (e.g. gpd-win-5) and a grouped
   one (e.g. gpd-win-mini-2025, whose real group heading this skeleton still doesn't reserve) —
   see CHANGELOG 0.29.1 for the measured deltas. The 8px gap matches the gpd-dark skin's real
   `.drx-res { margin-bottom: 8px }` between cards; it only applies here, never to the unfolded
   "no gap, border-separated" skeleton above. */
.drx-lazy--folded .drx-lazy__row:not(.drx-lazy__row--more) {
	height: 130px;
}

.drx-lazy--folded .drx-lazy__row + .drx-lazy__row:not(.drx-lazy__row--more) {
	margin-top: 8px;
}

.drx-lazy__row::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: currentColor;
	opacity: 0.06;
}

@media (prefers-reduced-motion: no-preference) {
	.drx-lazy__row::before {
		animation: drx-lazy-pulse 1.4s ease-in-out infinite;
	}
}

@keyframes drx-lazy-pulse {
	0%,
	100% {
		opacity: 0.06;
	}
	50% {
		opacity: 0.11;
	}
}

.drx-lazy__failed {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin: 0;
	font-size: 0.9em;
}

/* Styled like a secondary `.drx-res__cta` (skins recolour it). */
.drx-lazy__retry {
	flex: 0 0 auto;
	padding: 4px 12px;
	border: 1px solid #d9d9d9;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.95em;
	font-weight: 600;
	line-height: inherit;
	cursor: pointer;
}

/* "Show N more downloads" toggle (0.29.1, front.js fold()) — appended at the bottom of the
   fetched panel by front.js when dkr_product_downloads_fold() folds resources past the first N.
   Text styled like `.drx-res__toggle`; `.drx-lazy__row--more` above must reserve this button's
   own outer height (incl. its top margin) for zero CLS between skeleton and loaded panel. */
.drx-files__more {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	margin: 14px 0 0;
	padding: 10px 0;
	border: 0;
	background: transparent;
	color: #555;
	font: inherit;
	font-size: 0.85em;
	font-weight: 600;
	cursor: pointer;
}

.drx-files__more:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.drx-files__more::after {
	content: "";
	width: 7px;
	height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s ease;
}

.drx-files__more[aria-expanded="true"]::after {
	transform: rotate(-135deg);
}

/* Phone rows (0.28.2): the badge and CTA never shrink, so inside a 32px/36px-padded
   `.drx-files--panel` a 400px viewport left the title column ~50–80px wide and every word
   wrapped onto its own line. Let the row wrap with the title on a full-width second line,
   and trim the panel/card padding. `.drx-files.drx-files--panel` (0-2-0) outranks the skins'
   `.drx-files--panel` padding regardless of load order. */
@media (max-width: 600px) {
	.drx-res__row {
		flex-wrap: wrap;
		row-gap: 8px;
	}
	.drx-res__info {
		order: 2;
		flex-basis: 100%;
	}
	.drx-files.drx-files--panel {
		padding: 18px 16px;
		border-radius: 18px;
	}
	.drx-files.drx-files--panel .drx-res {
		padding: 12px 14px;
	}
	/* Phone rows wrap onto two lines (badge + CTA, then the title/meta). */
	.drx-lazy__row {
		height: 182px; /* measured avg at 390px: 181.8 */
	}
	.drx-lazy__row--more {
		height: 55px; /* toggle text doesn't wrap at 390px — same box as desktop */
	}
	/* Folded first two rows run much taller at this width (a phone-wrapped title is two lines) —
	   see the desktop rule's comment. 193px minimises the worst-case gap between a flat panel
	   (gpd-win-5, real folded height ≈494px at 412px wide) and a grouped one (gpd-win-mini-2025,
	   ≈474px) — see CHANGELOG 0.29.1. */
	.drx-lazy--folded .drx-lazy__row:not(.drx-lazy__row--more) {
		height: 193px;
	}
}
