/*
 * The price block (spec §2.1-2.3): price, then the caption under a struck amount, then the bazna line.
 * Both lines: smaller than the theme's price, never bold, never struck. Sizes are relative to the price, so they follow
 * the theme on every screen. Colour and font: below.
 */
.sidrena-cijena {
	display: block;
	position: relative;
	margin-top: 0.35em;
	font-size: 0.8em !important;
	font-weight: 400 !important;
	line-height: 1.4;
	text-decoration: none !important;
}

p.price .sidrena-cijena,
.price .sidrena-cijena,
span.price .sidrena-cijena,
.elementor-widget-woocommerce-product-price .sidrena-cijena,
.et_pb_wc_price .sidrena-cijena,
.brxe-product-price .sidrena-cijena,
.oxy-product-price .sidrena-cijena,
.wd-single-price .sidrena-cijena,
.fusion-tb-woo-price .sidrena-cijena,
.jet-single-price .sidrena-cijena,
.wc-block-components-product-price .sidrena-cijena {
	display: block;
	margin-top: 0.35em;
}

/* Caption under the struck amount: tied to it (no more than 2 px between), a little smaller than the bazna line. */
.bazna-najniza30 {
	display: block;
	margin-top: 2px;
	font-size: 0.75em !important;
	font-weight: 400 !important;
	line-height: 1.35;
	text-decoration: none !important;
}

/* After a theme's own price wrapper (CX-SID-93: div.price, in a flex row on S8's product page): the caption and the bazna
 * line each on a row of their own under the price, as inside WooCommerce's p.price. Nothing outside a flex row. */
.cx-sidrena-own-row {
	flex-basis: 100%;
}

.price .lowest_price,
p.price .lowest_price,
span.price .lowest_price {
	display: block;
	margin-top: 0.35em;
}

.sidrena-cijena + br,
.sidrena-cijena + .lowest_price {
	margin-top: 0.35em;
}

.sidrena-cijena__text {
	display: inline;
}

.sidrena-cijena__prefix,
.sidrena-cijena__sep,
.sidrena-cijena__amount {
	display: inline;
}

/* Everything inside a line takes the line's size, weight and colour, whatever the theme does to prices and amounts. */
.sidrena-cijena .sidrena-cijena__text,
.sidrena-cijena .sidrena-cijena__prefix,
.sidrena-cijena .sidrena-cijena__sep,
.sidrena-cijena .sidrena-cijena__amount,
.sidrena-cijena .woocommerce-Price-amount,
.sidrena-cijena .amount,
.sidrena-cijena bdi,
p.price .sidrena-cijena .woocommerce-Price-amount.amount,
.elementor-widget-woocommerce-product-price .sidrena-cijena .woocommerce-Price-amount {
	font-size: inherit !important;
	font-weight: inherit !important;
	color: inherit !important;
	text-decoration: none !important;
}

/* The currency symbol in a line sits on the line, at the line's size (CX-SID-101): a theme may shrink and raise the
 * symbol of its prices (one: ".product-summary .woocommerce-Price-currencySymbol {font-size: .75em; vertical-align: top}"),
 * and that rule reached the symbol in our line. :not(#cx-sidrena-none) counts as an id: see the colour rules below. */
.sidrena-cijena:not(#cx-sidrena-none) .woocommerce-Price-currencySymbol {
	font-size: inherit !important;
	vertical-align: baseline !important;
}

/*
 * Colour and font of both lines (CX-SID-41, Hrvoje): the shop's ordinary text, never the price's. A theme colours its
 * prices (often in its sale colour) and may give them their own font; inside the price our lines took both, and the
 * bazna line read as the price to pay (spec §2.3). text-vars.js reads the colour and font of <body> into the custom
 * properties below; the colour is shown at 75 % (spec §2.1).
 * - The owner's own colour (Settings, --cx-sidrena-own, printed by the server) wins, exactly as chosen.
 * - Without JavaScript: a neutral grey (#666 on white, 5.7:1), not the price's colour; the font is then the price's.
 * - frontend.js: where 75 % is below 4.5:1 on the line's background, the full colour (cx-sidrena-solid); where even
 *   that is below, a colour pulled toward black or white, set on the line itself.
 * :not(#cx-sidrena-none) counts as an id, so these rules win over any theme rule built from classes, also an !important
 * one (a theme's price rules reach our spans: one gives "span.price span" its own font with !important).
 */
.sidrena-cijena:not(#cx-sidrena-none),
.bazna-najniza30:not(#cx-sidrena-none) {
	color: rgba(0, 0, 0, 0.6) !important;
	color: var(--cx-sidrena-own, var(--cx-sidrena-text-75, rgba(0, 0, 0, 0.6))) !important;
	font-family: var(--cx-sidrena-font) !important;
}

.sidrena-cijena.cx-sidrena-solid:not(#cx-sidrena-none),
.bazna-najniza30.cx-sidrena-solid:not(#cx-sidrena-none) {
	color: var(--cx-sidrena-own, var(--cx-sidrena-text, rgba(0, 0, 0, 0.6))) !important;
}

.sidrena-cijena:not(#cx-sidrena-none) .sidrena-cijena__text,
.sidrena-cijena:not(#cx-sidrena-none) .sidrena-cijena__text * {
	color: inherit !important;
	font-family: inherit !important;
}

/* The "Cjenik" link at the bottom of every page (spec §2.6): small, in the page's colours, a tap target of 44 px. */
.cx-sidrena-cjenik-link {
	clear: both;
	margin: 0;
	padding: 0 1em;
	font-size: 0.875em;
	line-height: 20px;
	text-align: center;
}

.cx-sidrena-cjenik-link a {
	display: inline-block;
	min-height: 44px;
	padding: 12px 8px;
	box-sizing: border-box;
	color: inherit;
}

.sidrena-cijena--has-tooltip {
	cursor: help;
}

.sidrena-cijena__icon,
.sidrena-cijena__info > .sidrena-cijena__icon {
	display: none !important;
}

.sidrena-cijena__tooltip {
	position: absolute;
	left: 0;
	bottom: calc(100% + 8px);
	z-index: 20;
	width: min(280px, 70vw);
	padding: 0.65em 0.8em;
	border-radius: 6px;
	background: #1d2327;
	color: #fff;
	font-size: 0.82rem;
	font-weight: 400;
	line-height: 1.45;
	text-align: left;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
	transform: translateY(4px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.sidrena-cijena__tooltip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 1.2em;
	border: 6px solid transparent;
	border-top-color: #1d2327;
}

.sidrena-cijena:hover .sidrena-cijena__tooltip,
.sidrena-cijena:focus .sidrena-cijena__tooltip,
.sidrena-cijena:focus-within .sidrena-cijena__tooltip {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.sidrena-cijena:focus {
	outline: none;
}

.sidrena-cijena:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* A standalone catalog row ([sidrena-cijena id="dN"]): price, then the bazna line under it. Inline, so a shortcode placed
 * after text ("Cijena knjige: [sidrena-cijena id="d6"]") puts text and price on one line and the bazna line under both,
 * from the left, as on a WooCommerce shop (CX-SID-96). As an inline-block the row's baseline was its last line, the bazna
 * line: the text stood next to it and the price hung above. The bazna line is a block, so it starts its own row. */
.sidrena-cijena-item {
	display: inline;
}

.sidrena-cijena-item__price {
	display: inline;
	font-size: 1em;
	line-height: 1.4;
}

/* Inline (CX-SID-96), the row may break wherever there is a space, and the catalog joins an amount and its sign with an
 * ordinary one ("19,90 €"): on a phone the sign stood alone on the next row (CX-SID-106). The price part and the bazna
 * amount of a row never break inside; when the price does not fit after the text it goes to the next row whole. Only
 * inside a catalog row: WooCommerce's own lines are not touched. */
.sidrena-cijena-item__price,
.sidrena-cijena-item .sidrena-cijena__amount {
	white-space: nowrap;
}

.sidrena-cijena-item__price del {
	opacity: 0.7;
	margin-right: 0.35em;
}

.sidrena-cijena-item__price ins {
	text-decoration: none;
}
