/**
 * Bubook Central Campaign, Discount & Conversion Styles
 *
 * @package Bubook_Customizer
 */

/* ==========================================================================
   1. Countdown Timer Box
   ========================================================================== */
.bb-countdown-box {
	background: #ffffff;
	border: 1.5px solid #fee2e2;
	border-radius: 12px;
	padding: 16px 20px;
	margin: 16px 0 24px 0;
	box-shadow: 0 4px 14px rgba(229, 57, 53, 0.08);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	box-sizing: border-box;
}

.bb-countdown-box--cart,
.bb-countdown-box--checkout {
	margin-bottom: 24px;
}

.bb-countdown-box__header {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 1 1 240px;
}

.bb-countdown-box__icon {
	font-size: 1.8rem;
	line-height: 1;
}

.bb-countdown-box__titles {
	display: flex;
	flex-direction: column;
}

.bb-countdown-box__title {
	font-size: 1rem;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.3;
}

.bb-countdown-box__desc {
	font-size: 0.85rem;
	color: #64748b;
	line-height: 1.3;
}

.bb-countdown-box__timer {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.bb-countdown-segment {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: #fff1f2;
	border: 1px solid #fecdd3;
	border-radius: 8px;
	min-width: 46px;
	padding: 6px 4px;
}

.bb-countdown-val {
	font-size: 1.15rem;
	font-weight: 800;
	color: #e11d48;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.bb-countdown-lbl {
	font-size: 0.65rem;
	font-weight: 700;
	color: #9f1239;
	letter-spacing: 0.05em;
	margin-top: 3px;
	line-height: 1;
}

.bb-countdown-sep {
	font-size: 1.1rem;
	font-weight: 800;
	color: #e11d48;
	line-height: 1;
	user-select: none;
}

@media (max-width: 480px) {
	.bb-countdown-box {
		padding: 12px 14px;
		justify-content: center;
	}
	.bb-countdown-box__header {
		text-align: center;
		justify-content: center;
	}
	.bb-countdown-segment {
		min-width: 40px;
		padding: 4px 2px;
	}
	.bb-countdown-val {
		font-size: 1rem;
	}
}

/* ==========================================================================
   2. Gift Coupon Popup Modal
   ========================================================================== */
.bb-popup-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bb-popup-backdrop.is-visible {
	opacity: 1;
	visibility: visible;
}

.bb-popup-card {
	background: #ffffff;
	border-radius: 20px;
	max-width: 420px;
	width: 100%;
	position: relative;
	padding: 32px 24px 28px 24px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
	text-align: center;
	box-sizing: border-box;
	transform: translateY(20px) scale(0.95);
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bb-popup-backdrop.is-visible .bb-popup-card {
	transform: translateY(0) scale(1);
}

.bb-popup-close {
	position: absolute;
	top: 14px;
	right: 14px;
	background: #f1f5f9;
	border: none;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: #64748b;
	transition: background 0.2s, color 0.2s;
	padding: 0;
}

.bb-popup-close:hover,
.bb-popup-close:focus {
	background: #e2e8f0;
	color: #0f172a;
	outline: none;
}

.bb-popup-artwork {
	position: relative;
	display: inline-block;
	margin-bottom: 12px;
}

.bb-popup-gift-icon {
	animation: bb-float 3s ease-in-out infinite;
}

@keyframes bb-float {
	0%, 100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-8px);
	}
}

.bb-popup-badge {
	display: inline-block;
	background: #fee2e2;
	color: #dc2626;
	font-size: 0.75rem;
	font-weight: 800;
	letter-spacing: 0.05em;
	padding: 4px 12px;
	border-radius: 20px;
	margin-top: 8px;
	text-transform: uppercase;
}

.bb-popup-title {
	font-size: 1.35rem;
	font-weight: 800;
	color: #0f172a;
	margin: 0 0 8px 0;
	line-height: 1.3;
}

.bb-popup-desc {
	font-size: 0.92rem;
	color: #475569;
	line-height: 1.5;
	margin: 0 0 20px 0;
}

.bb-popup-code-box {
	display: flex;
	align-items: stretch;
	justify-content: space-between;
	background: #f8fafc;
	border: 2px dashed #cbd5e1;
	border-radius: 12px;
	padding: 6px 6px 6px 14px;
	gap: 10px;
}

.bb-popup-code {
	font-family: monospace, ui-monospace, sans-serif;
	font-size: 1.25rem;
	font-weight: 800;
	color: #0f172a;
	letter-spacing: 0.08em;
	display: flex;
	align-items: center;
	user-select: all;
}

.bb-popup-copy-btn {
	background: #e53935;
	color: #ffffff;
	border: none;
	border-radius: 8px;
	padding: 10px 18px;
	font-weight: 700;
	font-size: 0.9rem;
	cursor: pointer;
	transition: background 0.2s, transform 0.1s;
	white-space: nowrap;
}

.bb-popup-copy-btn:hover,
.bb-popup-copy-btn:focus {
	background: #c62828;
	outline: none;
}

.bb-popup-copy-btn:active {
	transform: scale(0.98);
}

.bb-popup-status {
	margin-top: 10px;
	font-size: 0.85rem;
	font-weight: 600;
	color: #16a34a;
	min-height: 20px;
}

@media (max-width: 480px) {
	.bb-popup-card {
		padding: 24px 16px 20px 16px;
		max-width: min(390px, calc(100vw - 24px));
	}
	.bb-popup-title {
		font-size: 1.2rem;
	}
	.bb-popup-desc {
		font-size: 0.85rem;
		margin-bottom: 14px;
	}
	.bb-popup-code-box {
		padding: 6px 8px;
		gap: 8px;
	}
	.bb-popup-code {
		font-size: 1.1rem;
	}
	.bb-popup-copy-btn {
		padding: 8px 12px;
		font-size: 0.82rem;
	}
}

/* ==========================================================================
   3. Campaign Badges & Savings Breakdown Rows (Cart / Checkout)
   ========================================================================== */
.bb-campaign-badge {
	display: inline-block;
	background: #fee2e2;
	color: #dc2626;
	border: 1px solid #fca5a5;
	font-size: 0.75rem;
	font-weight: 800;
	padding: 2px 7px;
	border-radius: 4px;
	margin-left: 6px;
	letter-spacing: 0.02em;
	vertical-align: middle;
	line-height: 1.3;
}

.bb-savings-row th,
.bb-savings-row td,
.bb-breakdown-row th,
.bb-breakdown-row td {
	padding: 8px 0;
}
.cart_totals .bb-savings-row th,
.cart_totals .bb-savings-row td,
.cart_totals .bb-breakdown-row th,
.cart_totals .bb-breakdown-row td,
#order_review .bb-savings-row th,
#order_review .bb-savings-row td,
#order_review .bb-breakdown-row th,
#order_review .bb-breakdown-row td {
	padding: 0 !important;
}

.bb-savings-label {
	display: inline-flex;
	align-items: center;
	color: #16a34a;
	font-weight: 700;
}

.bb-savings-amount {
	color: #16a34a;
	font-weight: 800;
	font-size: 1.05em;
}

.bb-breakdown-row--green th,
.bb-breakdown-row--green td,
.bb-breakdown-row--green strong,
.bb-breakdown-row--green span {
	color: #16a34a !important;
	font-weight: 700;
}

/* ==========================================================================
   4. Two-line Product Price Block (Revision 3)
   ========================================================================== */
.bb-price-block {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	vertical-align: middle;
	gap: 2px;
	line-height: 1.15;
}

.bb-price-block__top {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	line-height: 1;
}

.bb-price-block del,
.bb-price-block__regular {
	color: #64748b !important;
	text-decoration: line-through !important;
	font-weight: 500;
	font-size: 0.85em;
}

.bb-price-block__badge {
	display: inline-block;
	background: #fee2e2;
	color: #dc2626;
	font-size: 0.72em;
	font-weight: 600;
	padding: 1px 6px;
	border-radius: 4px;
	text-transform: lowercase;
	letter-spacing: -0.01em;
	white-space: nowrap;
	line-height: 1.3;
}

.bb-price-block__bottom {
	display: block;
	line-height: 1.1;
	margin-top: 2px;
}

.bb-price-block ins,
.bb-price-block__sale {
	display: inline-block;
	color: #e53935 !important;
	font-size: 1.35em;
	font-weight: 800;
	text-decoration: none !important;
	line-height: 1.1;
	white-space: nowrap !important;
}

.bb-price-block .woocommerce-Price-amount {
	white-space: nowrap !important;
	display: inline !important;
}

.bb-price-block .woocommerce-Price-currencySymbol {
	display: inline !important;
	margin-right: 2px;
}

/* Context: Inside builder choices and modal dialog */
.bbb-choice .bb-price-block,
.bbb-binding-choices button .bb-price-block,
.bbb-recap .bb-price-block {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
}

.bbb-choice .bb-price-block__sale,
.bbb-binding-choices button .bb-price-block__sale {
	font-size: 1.15em;
	color: #e53935 !important;
	text-decoration: none !important;
}

.bbb-recap [data-summary="price"] .bb-price-block__sale {
	font-size: 1.3em;
	color: #e53935 !important;
	text-decoration: none !important;
}

/* ==========================================================================
   5. Cart & Checkout Totals Single-Line Layout (Revision 3)
   ========================================================================== */
body.woocommerce-cart .cart_totals table.shop_table tr,
.woocommerce-checkout-review-order-table tfoot tr {
	display: flex !important;
	justify-content: space-between !important;
	align-items: center !important;
	width: 100% !important;
	box-sizing: border-box !important;
	padding: 10px 0 !important;
}

body.woocommerce-cart .cart_totals table.shop_table th,
.woocommerce-checkout-review-order-table tfoot th {
	flex: 1 1 auto !important;
	text-align: left !important;
	white-space: nowrap !important;
	padding: 0 !important;
	font-size: 0.95rem;
}

body.woocommerce-cart .cart_totals table.shop_table td,
.woocommerce-checkout-review-order-table tfoot td {
	flex: 0 0 auto !important;
	text-align: right !important;
	white-space: nowrap !important;
	padding: 0 !important;
	font-size: 0.95rem;
}

body.woocommerce-cart .cart_totals table.shop_table tr.order-total th,
body.woocommerce-cart .cart_totals table.shop_table tr.order-total td,
.woocommerce-checkout-review-order-table tfoot tr.order-total th,
.woocommerce-checkout-review-order-table tfoot tr.order-total td {
	font-size: 1.15rem !important;
	font-weight: 900 !important;
}

@media (max-width: 480px) {
	.bb-price-block__sale {
		font-size: 1.2em;
	}
	.bb-price-block__regular {
		font-size: 0.8em;
	}
	.bb-price-block__badge {
		font-size: 0.68em;
		padding: 1px 5px;
	}
	.bb-popup-card {
		max-height: 90vh;
		overflow-y: auto;
	}
	body.woocommerce-cart .cart_totals table.shop_table th,
	.woocommerce-checkout-review-order-table tfoot th,
	body.woocommerce-cart .cart_totals table.shop_table td,
	.woocommerce-checkout-review-order-table tfoot td {
		font-size: 0.88rem;
	}
}
