/**
 * Shuster Cookie — front-end banner styles.
 *
 * Written entirely against CSS custom properties injected from settings
 * (see SHCO_Banner::print_inline_vars). RTL-first, logical properties for
 * anything that follows text flow, so LTR falls back without a separate
 * stylesheet.
 *
 * EXCEPTION: screen-corner placement (banner positions, trigger corners) uses
 * PHYSICAL left/right. A corner labelled "ימין" means the right of the screen
 * whatever the text direction; using inset-inline-* there silently mirrored
 * every corner against its label under direction: rtl.
 */

.shco-root {
	direction: rtl;
	font-family: var(--shco-font-family, inherit);
	font-size: var(--shco-font-size, 14px);
}

.shco-root [hidden] {
	display: none !important;
}

/*
 * Visibility contract (must stay in sync with banner.js).
 *
 * Each surface is hidden by default and revealed by a modifier CLASS, not by
 * setting inline style.display in JS. The hide rules carry !important so they
 * win the cascade against the layout display types below; the reveal happens by
 * REMOVING the match (adding the modifier), which lets each surface fall back to
 * its own intended display value (block for the box banner, flex for the bar
 * banner and for the preference overlay). JS never hardcodes a display value.
 *
 *   banner  -> .shco-banner--visible
 *   panel   -> .shco-preferences--open
 *   overlay -> .shco-overlay--visible
 */
.shco-banner:not(.shco-banner--visible) { display: none !important; }
.shco-preferences:not(.shco-preferences--open) { display: none !important; }
.shco-overlay:not(.shco-overlay--visible) { display: none !important; }

/* ---- Overlay ---- */
.shco-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 2147483000;
}

/* ---- Banner container ---- */
.shco-banner {
	position: fixed;
	z-index: 2147483001;
	box-sizing: border-box;
	max-width: var(--shco-max-width, 440px);
	width: calc(100% - 32px);
	background: var(--shco-bg, #ffffff);
	color: var(--shco-text, #1a1a1a);
	border-radius: var(--shco-banner-radius, 10px);
	box-shadow: var(--shco-shadow, 0 6px 24px rgba(0, 0, 0, 0.12));
	padding: 22px 22px 18px;
	line-height: 1.6;
}

/*
 * Positions — PHYSICAL properties, deliberately.
 *
 * A corner picker labelled "תחתון-ימין" names a physical corner of the screen;
 * it is not a text-flow concept. These rules previously used inset-inline-*,
 * which resolves against the element's direction — and .shco-root is rtl, so
 * inset-inline-end became physical LEFT. Every corner therefore rendered
 * mirrored from its label (verified: "bottom-right" computed to left: 20px).
 *
 * left/right keep the corner meaning fixed regardless of direction. The banner's
 * TEXT direction is unaffected: .shco-root keeps direction: rtl, and symmetric
 * insets below stay logical since they cannot mirror.
 */
.shco-pos-bottom-right { inset-block-end: 20px; right: 20px; }
.shco-pos-bottom-left  { inset-block-end: 20px; left: 20px; }
.shco-pos-bottom-center {
	inset-block-end: 20px;
	left: 50%;
	transform: translateX(-50%);
}
.shco-pos-top {
	inset-block-start: 0;
	left: 0;
	right: 0;
	max-width: none;
	width: 100%;
	border-radius: 0;
}
.shco-pos-center-modal {
	inset-block-start: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

/* Layout: bar spans full width, buttons inline */
.shco-layout-bar {
	max-width: none;
	width: 100%;
	inset-inline: 0;
	border-radius: 0;
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
}
.shco-layout-bar .shco-body { flex: 1 1 320px; }
.shco-layout-bar .shco-heading { flex: 0 0 100%; margin-block-end: 4px; }

/*
 * The bar is edge-to-edge and flush with the viewport edge (spec §7). The
 * position classes above are written for the BOXED variant, so they leak
 * boxed-only spacing into the bar: a 20px inset-block-end (the unexplained gap
 * under the bar) and, for bottom-center, a translateX(50%) centring transform
 * that shoves an already-full-width element half a viewport sideways. Neutralise
 * both here, per bottom position, so a bar is genuinely full-width and flush.
 *
 * Deliberately NOT applied to .shco-pos-top: that variant sets inset-block-start
 * only, and forcing inset-block-end on it would pin both edges and stretch the
 * bar to the full viewport height.
 */
.shco-layout-bar.shco-pos-bottom-right,
.shco-layout-bar.shco-pos-bottom-left,
.shco-layout-bar.shco-pos-bottom-center {
	inset-block-end: 0;
	inset-inline: 0;
	transform: none;
}
/* The centre slide keyframe animates translateX(50%); on a full-width bar that
   would re-introduce the sideways shift for the duration of the animation. */
.shco-layout-bar.shco-pos-bottom-center.shco-anim-slide.shco-banner--visible {
	animation-name: shco-slide;
}

/* ---- Typography ---- */
.shco-heading {
	margin: 0 0 8px;
	font-size: 1.15em;
	font-weight: 700;
	color: var(--shco-text, #1a1a1a);
}
.shco-body {
	margin: 0 0 16px;
	color: var(--shco-text, #1a1a1a);
}
.shco-body p { margin: 0 0 8px; }
.shco-body a { color: var(--shco-accent, #2c2c2c); text-decoration: underline; }

.shco-logo {
	max-height: 40px;
	width: auto;
	margin-block-end: 12px;
}

/* ---- Actions / buttons ---- */
.shco-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	align-items: stretch;
}

/*
 * Hard design constraint (spec §7): accept and reject buttons share the SAME
 * component, SAME size, SAME weight. They differ only in colour. Do not add
 * per-button size/weight modifiers here.
 *
 * Elementor injects high-specificity rules against `button`, `.elementor-button`
 * and `a`. We win WITHOUT !important by (a) scoping under .shco-root and (b) on
 * the colour rules, doubling the class (.shco-btn.shco-btn) to out-specify. We
 * also explicitly reset the properties Elementor (and themes) commonly set.
 */
.shco-root .shco-btn {
	appearance: none;
	background-image: none;
	border: 1px solid transparent;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	text-decoration: none;
	cursor: pointer;
	font-family: inherit;
	font-size: 1em;
	font-weight: 600;
	line-height: 1.2;
	padding: 11px 18px;
	margin: 0;
	border-radius: var(--shco-btn-radius, 6px);
	flex: 1 1 auto;
	min-width: 120px;
	width: auto;
	text-align: center;
	transition: filter 0.15s ease;
}
.shco-root .shco-btn:hover { filter: brightness(0.94); }
.shco-root .shco-btn:focus-visible { outline: 2px solid var(--shco-accent, #2c2c2c); outline-offset: 2px; }

/* Colours — doubled class raises specificity above Elementor's button rules. */
.shco-root .shco-btn--accept.shco-btn--accept {
	background: var(--shco-accept-bg, #2c2c2c);
	color: var(--shco-accept-text, #ffffff);
}
.shco-root .shco-btn--reject.shco-btn--reject {
	background: var(--shco-reject-bg, #2c2c2c);
	color: var(--shco-reject-text, #ffffff);
}
.shco-root .shco-btn--save.shco-btn--save {
	background: var(--shco-accent, #2c2c2c);
	color: #ffffff;
}
.shco-root .shco-btn--settings.shco-btn--settings {
	background: var(--shco-settings-bg, transparent);
	color: var(--shco-settings-text, #1a1a1a);
	border: 1px solid var(--shco-settings-text, #1a1a1a);
	flex: 0 1 auto;
	min-width: 90px;
}

/* ---- Animations (play on reveal, i.e. once the visible modifier is added) ---- */
.shco-anim-fade.shco-banner--visible  { animation: shco-fade 0.3s ease; }
.shco-anim-slide.shco-banner--visible { animation: shco-slide 0.35s ease; }
@keyframes shco-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shco-slide {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: translateY(0); }
}
.shco-pos-bottom-center.shco-anim-slide.shco-banner--visible { animation: shco-slide-center 0.35s ease; }
@keyframes shco-slide-center {
	/* Must match .shco-pos-bottom-center's centring transform, or the banner
	   jumps sideways for the duration of the animation. */
	from { opacity: 0; transform: translateX(-50%) translateY(16px); }
	to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Preference centre ---- */
.shco-preferences {
	position: fixed;
	inset: 0;
	z-index: 2147483002;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	padding: 16px;
}
.shco-preferences__panel {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 560px;
	max-height: 88vh;
	overflow-y: auto;
	background: var(--shco-bg, #ffffff);
	color: var(--shco-text, #1a1a1a);
	border-radius: var(--shco-banner-radius, 10px);
	box-shadow: var(--shco-shadow, 0 10px 40px rgba(0, 0, 0, 0.28));
	padding: 26px 24px 20px;
}
.shco-preferences__close {
	position: absolute;
	inset-block-start: 12px;
	/* Top-left in RTL. inline-END resolves to the physical LEFT edge under
	   direction: rtl (inline-START would be the right edge). */
	inset-inline-start: auto;
	inset-inline-end: 16px;
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: var(--shco-text, #1a1a1a);
}
/* Elementor injects high-specificity rules on `button`/`a` that recolour this
   × control (pink pill + border). Same fix as .shco-btn: scope under .shco-root
   and double the class to out-specify WITHOUT !important, resetting exactly the
   properties Elementor sets globally. Layout (position/inset) is left to the
   rule above. */
.shco-root .shco-preferences__close.shco-preferences__close {
	appearance: none;
	background: none;
	background-image: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	padding: 0;
	text-transform: none;
	letter-spacing: normal;
	font-family: inherit;
	font-size: 26px;
	line-height: 1;
	color: var(--shco-text, #1a1a1a);
}

/* ---- Categories ---- */
.shco-categories { margin: 16px 0; }
.shco-category {
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 8px;
	padding: 14px 16px;
	margin-block-end: 10px;
}
.shco-category__head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-block-end: 6px;
}
.shco-category__title { font-weight: 700; }
.shco-category__badge {
	margin-inline-start: auto;
	font-size: 0.8em;
	background: rgba(0, 0, 0, 0.08);
	padding: 2px 8px;
	border-radius: 10px;
}
.shco-category__desc { font-size: 0.92em; opacity: 0.85; }

/* Per-category cookie detail (additive disclosure) */
.shco-category__expand {
	margin-inline-start: 6px;
	background: none;
	border: 0;
	padding: 4px;
	cursor: pointer;
	color: inherit;
	font: inherit;
	line-height: 1;
	flex: 0 0 auto;
}
.shco-category__expand--push { margin-inline-start: auto; }
.shco-category__expand .shco-chevron {
	display: inline-block;
	transition: transform 0.2s ease;
}
.shco-category__expand.is-open .shco-chevron { transform: rotate(180deg); }
/* Same Elementor override as the × control: a global `button` rule was
   recolouring this ▾ toggle and its chevron glyph (pink border + arrow). Raise
   specificity with the doubled class and reset only Elementor's properties —
   margin/flex/transform stay with the rules above, so no layout change. */
.shco-root .shco-category__expand.shco-category__expand {
	appearance: none;
	background: none;
	background-image: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	padding: 4px;
	text-transform: none;
	letter-spacing: normal;
	font-family: inherit;
	font-size: inherit;
	line-height: 1;
	color: var(--shco-text, #1a1a1a);
}
.shco-root .shco-category__expand.shco-category__expand .shco-chevron {
	color: var(--shco-text, #1a1a1a);
	fill: currentColor;
}
.shco-category__cookies {
	margin-block-start: 10px;
	overflow-x: auto;
}
.shco-category__cookies table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85em;
}
.shco-category__cookies th,
.shco-category__cookies td {
	border: 1px solid rgba(0, 0, 0, 0.1);
	padding: 6px 8px;
	text-align: start;
	vertical-align: top;
}
.shco-category__cookies th { font-weight: 700; }
.shco-category__cookies code { word-break: break-all; }

/* Toggle switch */
.shco-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 auto; }
.shco-switch input { opacity: 0; width: 0; height: 0; }
.shco-switch__slider {
	position: absolute;
	cursor: pointer;
	inset: 0;
	background: #ccc;
	border-radius: 24px;
	transition: background 0.2s;
}
.shco-switch__slider::before {
	content: "";
	position: absolute;
	height: 18px;
	width: 18px;
	inset-block-start: 3px;
	/* Knob rests at the inline START (off). Animating inset-inline-start is
	   direction-aware — the knob always slides toward the inline END ("on")
	   whether the container is RTL or LTR. No physical translateX (which would
	   not flip under direction: rtl). */
	inset-inline-start: 3px;
	background: #fff;
	border-radius: 50%;
	transition: inset-inline-start 0.2s ease;
}
/* Active = green. This is the near-universal "on" convention in consent UIs and
   is read pre-attentively; it is deliberately NOT a design setting. */
.shco-switch input:checked + .shco-switch__slider { background: #22c55e; }
.shco-switch input:checked + .shco-switch__slider::before {
	inset-inline-start: calc(100% - 21px); /* 44 (track) - 18 (knob) - 3 (inset) */
}
.shco-switch input:disabled + .shco-switch__slider { opacity: 0.6; cursor: not-allowed; }

/* ---- Policy links ---- */
.shco-policy-links {
	margin-block-start: 14px;
	font-size: 0.88em;
	opacity: 0.85;
}
.shco-policy-links a { color: var(--shco-accent, #2c2c2c); }

/* ---- Persistent withdrawal trigger ---- */
/* Doubled class + resets so Elementor's button rules can't recolour it. */
.shco-root .shco-trigger.shco-trigger {
	position: fixed;
	z-index: 2147482999;
	inset-block-end: 18px;
	background: var(--shco-accent, #2c2c2c);
	background-image: none;
	color: #fff;
	border: 0;
	cursor: pointer;
	font-family: inherit;
	font-size: 0.85em;
	font-weight: 600;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	padding: 8px 14px;
	margin: 0;
	width: auto;
	border-radius: 999px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
/* Physical, for the same reason as the banner corners above. */
.shco-trigger--bottom-left  { left: 18px; }
.shco-trigger--bottom-right { right: 18px; }

/*
 * ---- Trigger: icon mode (opt-in) ----
 *
 * Gated on .shco-trigger--icon, emitted only when an admin selects icon mode.
 * Text mode keeps the base rule above verbatim, so an existing site renders
 * byte-identically.
 *
 * POSITION is fixed here on purpose — icon mode exposes no position setting,
 * which is what stopped the icon drifting to the centre on mobile. SIZE is
 * driven by --shco-trigger-size, set per breakpoint from the settings.
 *
 * The numbers come from the Shuster Accessibility widget's stylesheet so both
 * floating controls match: 56px badge box, bottom-right at 20px offsets, and a
 * 0 4px 14px rgba(0,0,0,.25) shadow.
 *
 * The glyph is 62% of the badge (~34.7px at the 56px default). Only the OUTER
 * footprint needs to match the Shuster Accessibility trigger; the internal
 * proportion is our own. Matching that plugin's 24px glyph exactly (42.857%)
 * left the cookie reading as a faint mark inside a mostly-empty circle — the
 * cookie outline plus its four chip dots needs more of the badge than a simple
 * pictogram does. Expressed as a ratio so it tracks the size slider rather than
 * freezing at one pixel value.
 *
 * SPECIFICITY: the base trigger rule is `.shco-root .shco-trigger.shco-trigger`
 * (0,3,0) — it was hardened that way against Elementor. A single-class rule here
 * would silently lose width / inset-block-end / border-radius / box-shadow to it
 * (measured: the badge collapsed to 34px wide and sat at the text button's 18px
 * offset). So icon mode matches that specificity and comes later.
 *
 * The vertical offset uses inset-block-end: the block axis never mirrors under
 * RTL — only the inline axis does — so the corner-mapping bug cannot recur here.
 * The horizontal side is physical, per the convention established above.
 */
.shco-root .shco-trigger--icon.shco-trigger--icon {
	position: fixed;
	inset-block-start: auto;
	inset-block-end: 20px;
	right: 20px;
	left: auto;
	width: var(--shco-trigger-size, 56px);
	height: var(--shco-trigger-size, 56px);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--shco-trigger-badge-bg, #000000);
	background-image: none;
	color: var(--shco-trigger-icon-color, #ffffff);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	text-transform: none;
	letter-spacing: normal;
	transition: transform 0.15s ease;
}
.shco-root .shco-trigger--icon.shco-trigger--icon:hover { transform: scale(1.06); }

/* The cookie glyph. currentColor is driven by the icon-colour setting, which is
   independent of the badge background. 62% keeps the outline and its four chip
   dots legible at a glance; as a ratio it scales with the size slider. */
.shco-root .shco-trigger--icon.shco-trigger--icon .shco-trigger__icon {
	width: 62%;
	height: 62%;
	display: block;
	color: var(--shco-trigger-icon-color, #ffffff);
}

/* Green check badge overlapping the badge's lower-left. Its ring is painted in
   the badge background so it reads as cut into the circle. The green is fixed
   (#22c55e — the same success green as the preference toggles) and deliberately
   not a setting. Sized as a ratio of the badge so it stays in proportion. */
.shco-root .shco-trigger--icon.shco-trigger--icon .shco-trigger__check {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 34.4%;
	height: 34.4%;
	box-sizing: border-box;
	border-radius: 50%;
	background: #22c55e;
	border: 2px solid var(--shco-trigger-badge-bg, #000000);
	display: flex;
	align-items: center;
	justify-content: center;
}
.shco-root .shco-trigger--icon.shco-trigger--icon .shco-trigger__check svg {
	width: 68%;
	height: 68%;
	display: block;
}

.shco-preferences-link {
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	color: inherit;
	text-decoration: underline;
	font: inherit;
}

/* ---- Blocked iframe placeholder ---- */
.shco-iframe-placeholder {
	direction: rtl;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 220px;
	background: #f2f2f2;
	border: 1px dashed #bbb;
	border-radius: 8px;
	text-align: center;
	padding: 20px;
}
.shco-iframe-placeholder__text { margin: 0 0 12px; color: #444; }
/* The placeholder is injected into page content (not under .shco-root), so we
   raise specificity with the doubled class alone to beat Elementor's rules. */
.shco-iframe-placeholder__btn.shco-iframe-placeholder__btn {
	background: var(--shco-accent, #2c2c2c);
	background-image: none;
	color: #fff;
	border: 0;
	box-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	padding: 9px 16px;
	border-radius: var(--shco-btn-radius, 6px);
	font: inherit;
}

/* ---- Cookie policy table (shortcode) ---- */
.shco-cookie-policy {
	width: 100%;
	border-collapse: collapse;
	direction: rtl;
}
.shco-cookie-policy th,
.shco-cookie-policy td {
	border: 1px solid #ddd;
	padding: 8px 10px;
	text-align: start;
	vertical-align: top;
}
.shco-cookie-policy th { background: #f6f6f6; font-weight: 700; }

/* ---- Small screens ---- */
@media (max-width: 480px) {
	.shco-banner {
		inset-inline: 12px;
		width: calc(100% - 24px);
		max-width: none;
	}
	.shco-pos-bottom-center { transform: none; left: 12px; }
	.shco-btn { min-width: 100%; }

	/* Same leak as above: the boxed 12px side inset must not narrow the bar. */
	.shco-layout-bar {
		inset-inline: 0;
		width: 100%;
	}
	.shco-layout-bar.shco-pos-bottom-right,
	.shco-layout-bar.shco-pos-bottom-left,
	.shco-layout-bar.shco-pos-bottom-center {
		inset-block-end: 0;
		inset-inline: 0;
		transform: none;
	}
}
