/*
 * hr-cjenik — front end.
 *
 * The badge is a legal obligation, not a design element: it must be readable
 * next to every price and must not push the theme's layout around. So it
 * inherits colour and font from whatever wraps it, sits on its own line under
 * the price at 0.85em, and carries no background, border or spacing of its own
 * beyond a hair of top margin.
 */

.hrc-ref {
	display: block;
	margin-top: 0.15em;
	font-size: 0.85em;
	font-weight: 400;
	line-height: 1.35;
}

.hrc-ref--inline,
.hrc-ref--table,
.hrc-ref--variation {
	display: inline;
	margin-top: 0;
}

.hrc-ref__label,
.hrc-ref__amount {
	white-space: nowrap;
}

/*
 * Themes that float the price to the right of the title (Konan Games: .price
 * floated right at ~30% width) shrink-wrap it to the price alone; the badge,
 * being wider, then spills left over the title. Letting a price container that
 * holds a badge grow to its content keeps both readable — the title wraps
 * instead. :has() is supported by every browser this plugin targets.
 */
.price:has(> .hrc-ref),
.price:has(> .hrc-ref-wrap) {
	min-width: max-content;
}

.hrc-ref {
	max-width: 100%;
	overflow-wrap: anywhere;
}

/* Inside a price element the badge is always its own line under the amount,
   whatever inline/rtl tricks the theme plays with the price's children. */
.price > .hrc-ref,
.price .hrc-ref--inline {
	display: block;
	float: none;   /* Konan Games: theme floats every span inside .price right */
	clear: both;
	width: 100%;
	margin-top: 0.15em;
	text-align: inherit;
	/* Relative to the price, but never louder than body text: a theme with a
	   44px product price would otherwise print a 35px reference price. */
	font-size: min(0.8em, 1rem);
}

/* wc_price() brings its own markup; keep it at the badge's size and colour. */
.hrc-ref .woocommerce-Price-amount,
.hrc-ref .amount,
.hrc-ref bdi {
	font-size: inherit;
	font-weight: inherit;
	color: inherit;
	text-decoration: none;
}

.hrc-ref--hidden {
	display: none;
}

/* Cart and checkout blocks render item data as their own rows; the badge there
   is already inside the theme's list styling, so it adds nothing. */
.wc-block-components-product-details .hrc-ref {
	display: inline;
	margin-top: 0;
	opacity: 1;
	font-size: inherit;
}

/* ---- "Objava cjenika" footer link (printed on wp_footer unless the theme
        places hrc_footer_link_html() itself) ---- */

.hrc-footer-link {
	margin: 0;
	padding: 0.75em 1em;
	text-align: center;
	font-size: 0.8em;
	opacity: 0.8;
}

.hrc-footer-link a {
	color: inherit;
	text-decoration: underline;
}

/* ---- services table (shortcode [hr_cjenik]) ---- */

.hrc-table {
	width: 100%;
	border-collapse: collapse;
}

.hrc-table th,
.hrc-table td {
	padding: 0.5em 0.75em;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid currentColor;
	border-bottom-color: rgba(127, 127, 127, 0.3);
}

.hrc-table th {
	font-weight: 600;
}

.hrc-table .hrc-table__cijena,
.hrc-table .hrc-table__ref {
	white-space: nowrap;
}

.hrc-table__ref {
	opacity: 0.75;
}

.hrc-table caption {
	caption-side: bottom;
	padding-top: 0.5em;
	font-size: 0.85em;
	opacity: 0.75;
	text-align: left;
}

/* ---- inline price (shortcode [hr_cijena]) ---- */

.hrc-inline__amount {
	white-space: nowrap;
}

.hrc-inline .hrc-ref {
	opacity: 0.75;
}
