/**
 * Discount Rules Box – public (frontend) styles.
 *
 * Selektori su izolovani pod .drbu-buy (novi namespace) uz legacy fallback
 * .pg-buy (pg-*) kako postojeće teme koje su stilizovale staru verziju
 * ne bi izgubile izgled. Funkcionalna pravila (radio toggle) koriste
 * data-v atribut i moraju zadržati !important.
 *
 * Boje dolaze iz admin podešavanja (sekcija "Izgled") kroz CSS varijable
 * koje u :root ubacuje DRBU_Core::dynamic_css(). Svaka varijabla ima
 * fallback vrednost, pa buy box radi i bez inline stila.
 */

/* Globalni reset box-sizing-a i sirine za buy box kontejner.
 * Garancija da dugmad i kartice ne izlaze iz ekrana na mob/desktopu. */
.drbu-buy,
.drbu-buy *,
.drbu-buy *:before,
.drbu-buy *:after,
.pg-buy,
.pg-buy *,
.pg-buy *:before,
.pg-buy *:after {
	box-sizing: border-box !important;
}

.drbu-buy,
.pg-buy {
	width: 100% !important;
	max-width: 100% !important;
}

/* Skrivanje radio dugmadi — funkcionalno, mora ostati !important. */
.drbu-buy .drbu-radio,
.pg-buy .pg-radio { position:absolute !important; opacity:0 !important; width:0 !important; height:0 !important; pointer-events:none !important; }

.drbu-buy .drbu-head,
.pg-buy .pg-head { display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:2px; }
.drbu-buy .drbu-price-v,
.pg-buy .pg-price-v { display:none !important; align-items:baseline; flex-wrap:wrap; gap:0; }
.drbu-buy .drbu-price-v .drbu-num,
.pg-buy .pg-price-v .pg-num { font-family:'Lora',Georgia,serif; font-size:30px; font-weight:600; color:#29371a; }
.drbu-buy .drbu-price-v .drbu-per,
.pg-buy .pg-price-v .pg-per { font-family:'Mulish',sans-serif; font-size:13px; font-weight:700; color:#5d6350; margin-left:7px; }
.drbu-buy .drbu-price-v .drbu-was,
.pg-buy .pg-price-v .pg-was { font-family:'Mulish',sans-serif; font-size:15px; font-weight:600; color:#8a8f7c; margin-left:9px; }

.drbu-buy .drbu-sum-v,
.pg-buy .pg-sum-v { display:none !important; font-size:13px; color:#5d6350; margin:2px 0 6px; line-height:1.5; }
.drbu-buy .drbu-sum-v b,
.pg-buy .pg-sum-v b { color:#29371a; font-weight:800; }
.drbu-buy .drbu-sum-v s,
.pg-buy .pg-sum-v s { color:#8a8f7c; margin-left:2px; }
.drbu-buy .drbu-sum-v .drbu-save,
.pg-buy .pg-sum-v .pg-save { display:inline-block; background:var(--drbu-primary-soft, #eff6ff); color:var(--drbu-primary-hover, #1d4ed8); font-size:11.5px; font-weight:800; padding:2px 8px; border-radius:100px; margin-left:4px; }

.drbu-buy .drbu-ship-v,
.pg-buy .pg-ship-v { display:none !important; font-size:12px; color:#8a8f7c; margin-bottom:15px; }
.drbu-buy .drbu-ship-v.drbu-free,
.pg-buy .pg-ship-v.pg-free { color:var(--drbu-primary-hover, #1d4ed8); font-weight:700; }

.drbu-buy .drbu-packs,
.pg-buy .pg-packs { display:grid; gap:10px; margin-bottom:14px; }
.drbu-buy .drbu-pack,
.pg-buy .pg-pack { display:block; cursor:pointer; margin:0; }
.drbu-buy .drbu-pack.drbu-is-best,
.pg-buy .pg-pack.pg-is-best { margin-top:4px; }
.drbu-buy .drbu-pack:last-child,
.pg-buy .pg-pack:last-child { margin-bottom:6px; }
.drbu-buy .drbu-tile,
.pg-buy .pg-tile {
  position:relative; display:flex; align-items:center; gap:12px;
  background:var(--drbu-card-bg, #f8fafc); border:1.5px solid rgba(37,99,235,.2); border-radius:var(--drbu-card-radius, 16px);
  padding:14px 16px; min-height:66px;
  transition:border-color .16s ease, background .16s ease, box-shadow .16s ease, border-radius .16s ease;
}
.drbu-buy .drbu-pack:hover .drbu-tile,
.pg-buy .pg-pack:hover .pg-tile { border-color:var(--drbu-primary-hover, #1d4ed8); }
.drbu-buy .drbu-dot,
.pg-buy .pg-dot { flex:none; width:20px; height:20px; border-radius:50%; border:2px solid rgba(37,99,235,.25); background:#ffffff; display:grid; place-items:center; }
.drbu-buy .drbu-pbody,
.pg-buy .pg-pbody { display:flex; flex-direction:column; gap:2px; min-width:0; margin-right:auto; }
.drbu-buy .drbu-pbody > b,
.pg-buy .pg-pbody > b { font-size:15px; font-weight:800; color:#0f172a; }
.drbu-buy .drbu-pnote,
.pg-buy .pg-pnote { font-size:12px; color:#5d6350; line-height:1.35; }
.drbu-buy .drbu-pnote b,
.pg-buy .pg-pnote b { font-size:12px; color:var(--drbu-best-value, #1d4ed8); font-weight:800; }
.drbu-buy .drbu-punit,
.pg-buy .pg-punit { font-size:11.5px; color:#8a8f7c; font-weight:600; margin-top:1px; }
.drbu-buy .drbu-pprice,
.pg-buy .pg-pprice { flex:none; text-align:right; font-family:'Lora',serif; font-size:18px; font-weight:600; color:#0f172a; display:flex; flex-direction:column; align-items:flex-end; line-height:1.15; }
.drbu-buy .drbu-pprice s,
.pg-buy .pg-pprice s { font-family:'Mulish',sans-serif; font-size:11.5px; font-weight:600; color:#8a8f7c; }
.drbu-buy .drbu-badges-wrap,
.pg-buy .pg-badges-wrap { position:absolute !important; top:-10px !important; right:16px !important; left:auto !important; bottom:auto !important; display:inline-flex !important; align-items:center !important; gap:6px !important; z-index:2 !important; }
.drbu-buy .drbu-flag,
.pg-buy .pg-flag { position:relative !important; top:0 !important; left:auto !important; right:auto !important; bottom:auto !important; display:inline-flex !important; align-items:center !important; background:var(--drbu-best-value, #1d4ed8) !important; color:#ffffff !important; font-size:10.5px !important; font-weight:800 !important; letter-spacing:.04em !important; padding:3.5px 11px !important; border-radius:100px !important; box-shadow:0 2px 6px rgba(0,0,0,0.12) !important; white-space:nowrap !important; }
.drbu-buy .drbu-shipflag,
.pg-buy .pg-shipflag { position:relative !important; top:0 !important; right:auto !important; left:auto !important; bottom:auto !important; display:inline-flex !important; align-items:center !important; gap:4px !important; background:#059669 !important; color:#ffffff !important; font-size:10.5px !important; font-weight:800 !important; padding:3.5px 11px !important; border-radius:100px !important; border:none !important; box-shadow:0 2px 6px rgba(5,150,105,0.25) !important; white-space:nowrap !important; }

.drbu-buy .drbu-cta-wrap,
.pg-buy .pg-cta-wrap {
	width: 100% !important;
	max-width: 100% !important;
	margin: 0 0 12px 0 !important;
	padding: 0 !important;
}

.drbu-buy .drbu-cta-wrap .drbu-cta-v,
.pg-buy .pg-cta-wrap .pg-cta-v {
	display: none !important;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: var(--drbu-primary, #2563eb);
	color: var(--drbu-cta-text, #ffffff);
	font-weight: 800;
	font-size: 16px;
	padding: 14px 20px;
	border-radius: var(--drbu-btn-radius, 100px);
	min-height: 52px;
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	box-shadow: 0 8px 22px rgba(var(--drbu-primary-rgb, 37, 99, 235), .28);
	text-decoration: none;
	text-align: center;
	word-break: break-word;
	transition: background .16s ease, border-radius .16s ease, box-shadow .16s ease;
}
.drbu-buy .drbu-cta-wrap .drbu-cta-v:hover,
.pg-buy .pg-cta-wrap .pg-cta-v:hover { background:var(--drbu-primary-hover, #1d4ed8); color:var(--drbu-cta-text, #ffffff); text-decoration:none; }

/* Boja teksta CTA dugmeta — forsira CSS varijablu i na WooCommerce
 * markup cene (wc_price() → .woocommerce-Price-amount i prijatelji),
 * koji inače mogu da override-uju nasleđenu boju. */
.drbu-buy .drbu-cta-wrap .drbu-cta-v,
.drbu-buy .drbu-cta-wrap .drbu-cta-v .woocommerce-Price-amount,
.drbu-buy .drbu-cta-wrap .drbu-cta-v .woocommerce-Price-currencySymbol,
.drbu-buy .drbu-cta-wrap .drbu-cta-v .woocommerce-Price-amount bdi,
.pg-buy .pg-cta-wrap .pg-cta-v,
.pg-buy .pg-cta-wrap .pg-cta-v .woocommerce-Price-amount,
.pg-buy .pg-cta-wrap .pg-cta-v .woocommerce-Price-currencySymbol,
.pg-buy .pg-cta-wrap .pg-cta-v .woocommerce-Price-amount bdi {
	color:var(--drbu-cta-text, #29371a) !important;
}
.drbu-buy .drbu-cta-wrap .drbu-cta-v:hover,
.drbu-buy .drbu-cta-wrap .drbu-cta-v:hover .woocommerce-Price-amount,
.drbu-buy .drbu-cta-wrap .drbu-cta-v:hover .woocommerce-Price-currencySymbol,
.drbu-buy .drbu-cta-wrap .drbu-cta-v:hover .woocommerce-Price-amount bdi,
.pg-buy .pg-cta-wrap .pg-cta-v:hover,
.pg-buy .pg-cta-wrap .pg-cta-v:hover .woocommerce-Price-amount,
.pg-buy .pg-cta-wrap .pg-cta-v:hover .woocommerce-Price-currencySymbol,
.pg-buy .pg-cta-wrap .pg-cta-v:hover .woocommerce-Price-amount bdi {
	color:var(--drbu-cta-text, #29371a) !important;
}

.drbu-buy .drbu-pay,
.pg-buy .pg-pay { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:6px 14px; }

.drbu-buy .drbu-radio:focus-visible ~ .drbu-packs label .drbu-tile,
.pg-buy .pg-radio:focus-visible ~ .pg-packs label .pg-tile { outline:2px solid var(--drbu-best-value, #674dc9) !important; outline-offset:2px !important; }

/* Uključivanje varijanti na osnovu checked radio dugmeta (data-v).
 * Ranije inline <style> u template-u — prebačeno ovde radi kesiranja. */
.drbu-buy .drbu-radio[data-v="1"]:checked ~ .drbu-head .drbu-price-v[data-v="1"],
.pg-buy .pg-radio[data-v="1"]:checked ~ .pg-head .pg-v1 { display:flex !important; }
.drbu-buy .drbu-radio[data-v="1"]:checked ~ .drbu-sum-v[data-v="1"],
.pg-buy .pg-radio[data-v="1"]:checked ~ .pg-sum-1 { display:block !important; }
.drbu-buy .drbu-radio[data-v="1"]:checked ~ .drbu-ship-v[data-v="1"],
.pg-buy .pg-radio[data-v="1"]:checked ~ .pg-ship-1 { display:block !important; }
.drbu-buy .drbu-radio[data-v="1"]:checked ~ .drbu-cta-wrap .drbu-cta-v[data-v="1"],
.pg-buy .pg-radio[data-v="1"]:checked ~ .pg-cta-wrap .pg-cta-1 { display:flex !important; }
.drbu-buy .drbu-radio[data-v="1"]:checked ~ .drbu-cta-wrap .drbu-cta-v:not([data-v="1"]),
.pg-buy .pg-radio[data-v="1"]:checked ~ .pg-cta-wrap .pg-cta-v:not([data-v="1"]) { display:none !important; }
.drbu-buy .drbu-radio[data-v="1"]:checked ~ .drbu-packs label[data-v="1"] .drbu-tile,
.pg-buy .pg-radio[data-v="1"]:checked ~ .pg-packs label[data-v="1"] .pg-tile { border-color:var(--drbu-primary-hover, #86b038) !important; background:var(--drbu-primary-soft, #e8efd6) !important; box-shadow:0 3px 12px rgba(var(--drbu-primary-rgb, 158, 200, 77), .16) !important; }
.drbu-buy .drbu-radio[data-v="1"]:checked ~ .drbu-packs label[data-v="1"] .drbu-dot,
.pg-buy .pg-radio[data-v="1"]:checked ~ .pg-packs label[data-v="1"] .pg-dot { border-color:var(--drbu-primary-hover, #86b038) !important; }
.drbu-buy .drbu-radio[data-v="1"]:checked ~ .drbu-packs label[data-v="1"] .drbu-dot::after,
.pg-buy .pg-radio[data-v="1"]:checked ~ .pg-packs label[data-v="1"] .pg-dot::after { content:"" !important; width:10px !important; height:10px !important; border-radius:50% !important; background:var(--drbu-primary-hover, #86b038) !important; }

.drbu-buy .drbu-radio[data-v="2"]:checked ~ .drbu-head .drbu-price-v[data-v="2"],
.pg-buy .pg-radio[data-v="2"]:checked ~ .pg-head .pg-v2 { display:flex !important; }
.drbu-buy .drbu-radio[data-v="2"]:checked ~ .drbu-sum-v[data-v="2"],
.pg-buy .pg-radio[data-v="2"]:checked ~ .pg-sum-2 { display:block !important; }
.drbu-buy .drbu-radio[data-v="2"]:checked ~ .drbu-ship-v[data-v="2"],
.pg-buy .pg-radio[data-v="2"]:checked ~ .pg-ship-2 { display:block !important; }
.drbu-buy .drbu-radio[data-v="2"]:checked ~ .drbu-cta-wrap .drbu-cta-v[data-v="2"],
.pg-buy .pg-radio[data-v="2"]:checked ~ .pg-cta-wrap .pg-cta-2 { display:flex !important; }
.drbu-buy .drbu-radio[data-v="2"]:checked ~ .drbu-cta-wrap .drbu-cta-v:not([data-v="2"]),
.pg-buy .pg-radio[data-v="2"]:checked ~ .pg-cta-wrap .pg-cta-v:not([data-v="2"]) { display:none !important; }
.drbu-buy .drbu-radio[data-v="2"]:checked ~ .drbu-packs label[data-v="2"] .drbu-tile,
.pg-buy .pg-radio[data-v="2"]:checked ~ .pg-packs label[data-v="2"] .pg-tile { border-color:var(--drbu-primary-hover, #86b038) !important; background:var(--drbu-primary-soft, #e8efd6) !important; box-shadow:0 3px 12px rgba(var(--drbu-primary-rgb, 158, 200, 77), .16) !important; }
.drbu-buy .drbu-radio[data-v="2"]:checked ~ .drbu-packs label[data-v="2"] .drbu-dot,
.pg-buy .pg-radio[data-v="2"]:checked ~ .pg-packs label[data-v="2"] .pg-dot { border-color:var(--drbu-primary-hover, #86b038) !important; }
.drbu-buy .drbu-radio[data-v="2"]:checked ~ .drbu-packs label[data-v="2"] .drbu-dot::after,
.pg-buy .pg-radio[data-v="2"]:checked ~ .pg-packs label[data-v="2"] .pg-dot::after { content:"" !important; width:10px !important; height:10px !important; border-radius:50% !important; background:var(--drbu-primary-hover, #86b038) !important; }

.drbu-buy .drbu-radio[data-v="3"]:checked ~ .drbu-head .drbu-price-v[data-v="3"],
.pg-buy .pg-radio[data-v="3"]:checked ~ .pg-head .pg-v3 { display:flex !important; }
.drbu-buy .drbu-radio[data-v="3"]:checked ~ .drbu-sum-v[data-v="3"],
.pg-buy .pg-radio[data-v="3"]:checked ~ .pg-sum-3 { display:block !important; }
.drbu-buy .drbu-radio[data-v="3"]:checked ~ .drbu-ship-v[data-v="3"],
.pg-buy .pg-radio[data-v="3"]:checked ~ .pg-ship-3 { display:block !important; }
.drbu-buy .drbu-radio[data-v="3"]:checked ~ .drbu-cta-wrap .drbu-cta-v[data-v="3"],
.pg-buy .pg-radio[data-v="3"]:checked ~ .pg-cta-wrap .pg-cta-3 { display:flex !important; }
.drbu-buy .drbu-radio[data-v="3"]:checked ~ .drbu-cta-wrap .drbu-cta-v:not([data-v="3"]),
.pg-buy .pg-radio[data-v="3"]:checked ~ .pg-cta-wrap .pg-cta-v:not([data-v="3"]) { display:none !important; }
.drbu-buy .drbu-radio[data-v="3"]:checked ~ .drbu-packs label[data-v="3"] .drbu-tile,
.pg-buy .pg-radio[data-v="3"]:checked ~ .pg-packs label[data-v="3"] .pg-tile { border-color:var(--drbu-primary-hover, #86b038) !important; background:var(--drbu-primary-soft, #e8efd6) !important; box-shadow:0 3px 12px rgba(var(--drbu-primary-rgb, 158, 200, 77), .16) !important; }
.drbu-buy .drbu-radio[data-v="3"]:checked ~ .drbu-packs label[data-v="3"] .drbu-dot,
.pg-buy .pg-radio[data-v="3"]:checked ~ .pg-packs label[data-v="3"] .pg-dot { border-color:var(--drbu-primary-hover, #86b038) !important; }
.drbu-buy .drbu-radio[data-v="3"]:checked ~ .drbu-packs label[data-v="3"] .drbu-dot::after,
.pg-buy .pg-radio[data-v="3"]:checked ~ .pg-packs label[data-v="3"] .pg-dot::after { content:"" !important; width:10px !important; height:10px !important; border-radius:50% !important; background:var(--drbu-primary-hover, #86b038) !important; }
.drbu-buy .drbu-radio[data-v="3"]:checked ~ .drbu-packs label[data-v="3"] .drbu-shipflag,
.pg-buy .pg-radio[data-v="3"]:checked ~ .pg-packs label[data-v="3"] .pg-shipflag { border-color:var(--drbu-primary-soft, #e8efd6) !important; }

/* Display options — sakrivanje elemenata kada je neki toggle isključen
 * (wrapper klase `drbu-no-*` dodaje template na osnovu podešavanja). */
.drbu-buy.drbu-no-free-shipping .drbu-ship-v,
.drbu-buy.drbu-no-free-shipping .drbu-shipflag,
.pg-buy.drbu-no-free-shipping .pg-ship-v,
.pg-buy.drbu-no-free-shipping .pg-shipflag { display:none !important; }

.drbu-buy.drbu-no-footer-badges .drbu-pay,
.pg-buy.drbu-no-footer-badges .pg-pay { display:none !important; }

.drbu-buy.drbu-no-savings .drbu-save,
.pg-buy.drbu-no-savings .pg-save { display:none !important; }

.drbu-buy.drbu-no-best-value .drbu-flag,
.drbu-buy.drbu-no-best-value .drbu-badge,
.pg-buy.drbu-no-best-value .pg-flag,
.pg-buy.drbu-no-best-value .pg-badge { display:none !important; }

.drbu-buy.drbu-no-per-unit .drbu-per,
.drbu-buy.drbu-no-per-unit .drbu-punit,
.pg-buy.drbu-no-per-unit .pg-per,
.pg-buy.drbu-no-per-unit .pg-punit { display:none !important; }

.drbu-buy.drbu-no-was-price .drbu-was,
.drbu-buy.drbu-no-was-price .drbu-pprice s,
.drbu-buy.drbu-no-was-price .drbu-sum-v s,
.pg-buy.drbu-no-was-price .pg-was,
.pg-buy.drbu-no-was-price .pg-pprice s,
.pg-buy.drbu-no-was-price .pg-sum-v s { display:none !important; }

/* Skrivanje default WooCommerce cene kada je buy box aktivan
 * (body class `drbu-hide-default-price` dodaje DRBU_Product_Display). */
.single-product.drbu-hide-default-price div[data-block-name="woocommerce/product-price"],
.single-product.drbu-hide-default-price .wp-block-woocommerce-product-price,
.single-product.drbu-hide-default-price div.product .summary .price { display:none !important; }

/* Skrivanje standardne WooCommerce "Add to cart" forme i dugmeta (Elementor, Divi, Astra, WooCommerce Blocks)
 * kada je ukljuceno "Replace default Add to cart" (body class `drbu-replace-add-to-cart`). */
.single-product.drbu-replace-add-to-cart form.cart:not(.drbu-form),
.single-product.drbu-replace-add-to-cart form.cart:not(.drbu-form) button.single_add_to_cart_button,
.single-product.drbu-replace-add-to-cart form.cart:not(.drbu-form) .quantity,
.single-product.drbu-replace-add-to-cart .elementor-add-to-cart,
.single-product.drbu-replace-add-to-cart .wc-block-components-product-add-to-cart-button { display:none !important; }

/* Mobilna optimizacija. */
@media (max-width: 600px) {
	.drbu-buy .drbu-tile,
	.pg-buy .pg-tile { padding:12px; gap:10px; }
	.drbu-buy .drbu-pprice,
	.pg-buy .pg-pprice { font-size:16px; align-items:flex-start; }
	.drbu-buy .drbu-price-v .drbu-num,
	.pg-buy .pg-price-v .pg-num { font-size:24px; }
	.drbu-buy .drbu-cta-wrap .drbu-cta-v,
	.pg-buy .pg-cta-wrap .pg-cta-v { padding:12px 14px !important; font-size:14.5px !important; width:100% !important; max-width:100% !important; box-sizing:border-box !important; }
	.drbu-buy .drbu-flag,
	.pg-buy .pg-flag { font-size:9px; padding:2px 8px; }
	.drbu-buy .drbu-shipflag,
	.pg-buy .pg-shipflag { font-size:10px; padding:2px 8px 2px 6px; }
}

@media (max-width: 480px) {
	.drbu-buy .drbu-tile,
	.pg-buy .pg-tile { flex-wrap:wrap; }
	.drbu-buy .drbu-pbody,
	.pg-buy .pg-pbody { width:100%; }
	.drbu-buy .drbu-pprice,
	.pg-buy .pg-pprice { width:100%; flex-direction:row; align-items:baseline; gap:8px; text-align:left; }
	.drbu-buy .drbu-head,
	.pg-buy .pg-head { flex-wrap:wrap; row-gap:4px; }
	.drbu-buy .drbu-pay,
	.pg-buy .pg-pay { row-gap:6px; }
}

/* WooCommerce Cart Item Meta Styling */
.drbu-cart-item-meta {
	display: block !important;
	margin-top: 6px !important;
	margin-bottom: 4px !important;
	font-size: 12.5px !important;
	line-height: 1.4 !important;
	color: #64748b !important;
}

.drbu-cart-pack {
	display: inline-block !important;
	color: #1e293b !important;
}

.drbu-cart-savings {
	display: inline-block !important;
	color: #059669 !important;
	font-weight: 600 !important;
}
