/*
 * Cookie consent banner and the gate panel that stands in for a card form when
 * consent has been declined. See src/License/Consent/.
 */

.bc-consent {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 99999;
	background: #1e293b;
	color: #f8fafc;
	font-size: 14px;
	line-height: 1.55;
	box-shadow: 0 -2px 12px rgba( 0, 0, 0, 0.3 );
}

.bc-consent__inner {
	max-width: 1100px;
	margin: 0 auto;
	padding: 16px 24px;
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: flex-start;
	justify-content: space-between;
}

.bc-consent__text {
	flex: 1 1 420px;
	min-width: 260px;
}

.bc-consent__text p {
	margin: 0 0 8px;
}

.bc-consent__lede {
	font-weight: 600;
	font-size: 15px;
}

.bc-consent__controls {
	display: flex;
	gap: 16px;
	align-items: center;
	flex-wrap: wrap;
}

.bc-consent__toggle,
.bc-consent__link {
	background: none;
	border: 0;
	padding: 0;
	color: #93c5fd;
	text-decoration: underline;
	cursor: pointer;
	font-size: 14px;
	font-family: inherit;
}

.bc-consent__actions {
	display: flex;
	gap: 10px;
	flex: 0 0 auto;
	align-self: center;
}

.bc-consent__btn {
	border: 1px solid transparent;
	border-radius: 4px;
	padding: 9px 20px;
	font-size: 14px;
	font-family: inherit;
	cursor: pointer;
	white-space: nowrap;
}

/*
 * Decline is a real refusal, so it is a real button rather than a muted link --
 * a decline that looks like a dismissal invites accidental acceptance.
 */
.bc-consent__btn--decline {
	background: transparent;
	color: #f8fafc;
	border-color: #64748b;
}

.bc-consent__btn--accept {
	background: #3b82f6;
	color: #fff;
}

.bc-consent__details {
	margin-top: 12px;
	max-height: 40vh;
	overflow-y: auto;
}

.bc-consent__table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 12px;
	font-size: 13px;
}

.bc-consent__table caption {
	text-align: left;
	font-weight: 600;
	padding: 8px 0 4px;
}

.bc-consent__table th,
.bc-consent__table td {
	text-align: left;
	vertical-align: top;
	padding: 5px 10px 5px 0;
	border-bottom: 1px solid rgba( 248, 250, 252, 0.15 );
}

.bc-consent__table code {
	background: rgba( 248, 250, 252, 0.12 );
	padding: 1px 4px;
	border-radius: 3px;
	font-size: 12px;
}

.bc-consent__note {
	margin: 0;
	font-size: 13px;
	opacity: 0.85;
}

/* The stand-in for a payment form the visitor has declined the cookies for. */
.bc-consent-gate {
	border: 1px solid #cbd5e1;
	border-left: 4px solid #3b82f6;
	border-radius: 4px;
	background: #f8fafc;
	padding: 16px 18px;
	margin: 12px 0;
}

.bc-consent-gate__lede {
	margin: 0 0 8px;
	font-weight: 600;
}

.bc-consent-gate__body {
	margin: 0 0 12px;
	font-size: 14px;
}

@media ( max-width: 600px ) {
	.bc-consent__inner {
		padding: 14px 16px;
	}

	.bc-consent__actions {
		width: 100%;
	}

	.bc-consent__btn {
		flex: 1 1 auto;
	}
}

/*
 * The "Cookie choices" control, for a visitor who already answered. Inherits
 * the theme's link styling deliberately: the shortcode enqueues this stylesheet
 * during content render, so it prints with the footer, and the control has to
 * be legible in the moment before it lands.
 */
.bc-consent-reopen {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/* ⚠⚠ **RESTORES `hidden` ON THIS PAGE'S OWN MARKUP, BECAUSE THE BROWSER'S RULE
 * CAN BE BEATEN BY A SINGLE LINE IN A THEME.** `[hidden] { display: none }` is a
 * *user-agent* rule, so ANY author rule setting `display` on the same element
 * outranks it outright and the element renders with the attribute still set.
 * The theme's `.bc-page .bc-form__field { display: flex }` did exactly that on
 * `/checkout/`, painting four empty boxes onto a live payment page; see the long
 * note in `checkout.css` for that instance.
 *
 * ⚠⚠ **THIS PAGE IS NOT AFFECTED TODAY, AND THAT IS WHY THE RULE IS HERE.** Its
 * toggled elements (the collapsible cookie inventory) happen to carry classes the theme does not
 * style — which is luck, not design, and one class rename away from the same
 * defect. **There is no runtime signal when it happens**: nothing throws, no
 * PHP test can observe computed style, and there is no vitest config in this
 * repository, so the only way it surfaces is somebody looking at the page.
 *
 * ⚠ **`!important` is deliberate.** Our selector and a theme's can have
 * identical specificity, so the winner would otherwise be decided by stylesheet
 * order between a theme and a plugin — which neither side controls and which
 * changes silently. `hidden` means *not rendered in any presentation*, so there
 * is no legitimate rule for this to override.
 *
 * ⚠ **Pinned by `tests/Architecture/HiddenAttributeRestoredTest.php`**, which
 * fails the build if this rule goes, and which also fails on a NEW page of this
 * plugin's own that hides markup without carrying the same line. **Do not delete
 * it if the theme is ever fixed** — this is what stops the plugin-side rules
 * being dropped as redundant, which would put the whole thing back the moment a
 * theme is changed or replaced. */
.bc-consent [hidden] {
	display: none !important;
}
