/**
 * BigBite Products Widget
 * Clean design with WooCommerce Food integration
 */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700;800&display=swap');

/* ===== WIDGET CONTAINER ===== */
.bb-products-widget {
	direction: rtl;
	font-family: 'Open Sans', 'Open Sans Hebrew', sans-serif;
	background: #0a0a0a;
	margin-bottom: 0;
}

/* ===== BANNER ===== */
.bb-products-banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 25px 30px;
	background: #111;
	background-size: cover;
	background-position: center;
	position: relative;
	min-height: 120px;
}

.bb-products-banner.has-bg::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 100%);
	z-index: 1;
}

.bb-banner-content {
	position: relative;
	z-index: 2;
}

.bb-banner-title {
	margin: 0 0 5px 0;
	font-size: 32px;
	font-weight: 800;
	color: #fff;
	text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.bb-banner-subtitle {
	margin: 0;
	font-size: 16px;
	color: rgba(255,255,255,0.85);
	font-weight: 400;
}

/* ===== EXPAND BUTTON ===== */
.bb-expand-btn {
	position: relative;
	z-index: 2;
	background: transparent;
	border: 2px solid rgba(255,255,255,0.5);
	color: #fff;
	padding: 10px 25px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: all 0.2s ease;
}

.bb-expand-btn:hover {
	background: #c00000;
	border-color: #c00000;
}

/* ===== PRODUCTS GRID ===== */
.bb-products-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 3px;
	padding: 0;
	background: #0a0a0a;
}

/* Collapsed: single row */
.bb-products-widget[data-collapsed="1"] .bb-products-grid {
	flex-wrap: nowrap;
	overflow: hidden;
}

/* Expanded */
.bb-products-widget.is-expanded .bb-products-grid {
	flex-wrap: wrap;
}

/* Column sizing */
.bb-products-grid.columns-4 .bb-product-card { width: calc(25% - 1px); }
.bb-products-grid.columns-5 .bb-product-card { width: calc(20% - 1px); }
.bb-products-grid.columns-6 .bb-product-card { width: calc(16.666% - 1px); }
.bb-products-grid.columns-7 .bb-product-card { width: calc(14.285% - 1px); }
.bb-products-grid.columns-8 .bb-product-card { width: calc(12.5% - 1px); }

/* ===== PRODUCT CARD ===== */
.bb-product-card {
	flex-shrink: 0;
	background: #111;
}

.bb-product-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

/* ===== PRODUCT IMAGE ===== */
.bb-product-image {
	position: relative;
	overflow: hidden;
	background: #1a1a1a;
}

.bb-product-image img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.bb-product-card:hover .bb-product-image img {
	transform: scale(1.05);
}

/* Sale badge */
.bb-sale-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	background: #c00000;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 4px 8px;
	z-index: 5;
}

/* Bundle deal badge - highlighted */
.bb-bundle-badge {
	animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.05); }
}

/* Bundle deal price in product card */
.bb-bundle-deal {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.bb-bundle-deal del {
	color: #888;
	font-size: 12px;
	font-weight: 400;
	text-decoration: line-through;
}

.bb-deal-price {
	color: #c00000;
	font-size: 14px;
	font-weight: 700;
}

.bb-deal-qty {
	display: block;
	color: #888;
	font-size: 10px;
	font-weight: 400;
	margin-top: 2px;
}

/* Highlight product card with bundle - no border, just badge */
.bb-product-card.has-bundle {
	/* No red border */
}

/* Cart icon */
.bb-cart-icon {
	position: absolute;
	bottom: 10px;
	left: 10px;
	width: 34px;
	height: 34px;
	background: rgba(255,255,255,0.95);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #333;
	opacity: 0;
	transform: translateY(10px);
	transition: all 0.2s ease;
	z-index: 5;
}

.bb-product-card:hover .bb-cart-icon {
	opacity: 1;
	transform: translateY(0);
}

/* ===== PRODUCT INFO ===== */
.bb-product-info {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 10px;
	background: transparent;
}

.bb-product-title {
	margin: 0;
	font-size: 13px;
	font-weight: 400;
	color: #fff;
	line-height: 1.4;
	flex: 1;
	text-align: right;
}

.bb-product-price {
	font-size: 13px;
	font-weight: 700;
	color: #e00000;
	white-space: nowrap;
	direction: ltr;
}

.bb-product-price del {
	color: #666;
	font-weight: 400;
	margin-left: 5px;
}

.bb-product-price ins {
	text-decoration: none;
	background: none;
}

/* No products message */
.bb-no-products {
	width: 100%;
	text-align: center;
	color: #888;
	padding: 40px;
	font-size: 16px;
}

/* ===== MOBILE ===== */
@media (max-width: 1024px) {
	.bb-products-grid.columns-6 .bb-product-card,
	.bb-products-grid.columns-7 .bb-product-card,
	.bb-products-grid.columns-8 .bb-product-card {
		width: calc(20% - 1px);
	}
}

@media (max-width: 768px) {
	.bb-products-banner {
		flex-direction: column;
		align-items: flex-start;
		gap: 15px;
		padding: 20px;
	}

	.bb-banner-title {
		font-size: 24px;
	}

	.bb-products-grid .bb-product-card {
		width: calc(33.333% - 1px) !important;
	}

	/* Collapsed: horizontal scroll */
	.bb-products-widget[data-collapsed="1"] .bb-products-grid {
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
	}

	.bb-products-widget[data-collapsed="1"] .bb-product-card {
		scroll-snap-align: start;
		min-width: calc(33.333% - 1px);
	}

	.bb-product-title {
		font-size: 11px;
	}

	.bb-product-price {
		font-size: 11px;
	}

	.bb-cart-icon {
		opacity: 1;
		transform: translateY(0);
		width: 28px;
		height: 28px;
	}
}

@media (max-width: 480px) {
	/* Keep 3 products per row on mobile */
	.bb-products-grid .bb-product-card {
		width: calc(33.333% - 2px) !important;
	}

	.bb-products-widget[data-collapsed="1"] .bb-product-card {
		min-width: calc(33.333% - 2px);
	}
	
	.bb-product-info {
		padding: 8px 6px;
		flex-direction: column;
		gap: 3px;
	}
	
	.bb-product-title {
		font-size: 10px;
	}
	
	.bb-product-price {
		font-size: 10px;
	}
}

/* ===== MODAL ===== */
.bb-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
}

.bb-modal.is-open {
	display: flex;
	align-items: center;
	justify-content: center;
}

.bb-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.9);
}

.bb-modal-content {
	position: relative;
	background: #1a1a1a;
	max-width: 800px;
	width: 95%;
	max-height: 90vh;
	overflow-y: auto;
	border-radius: 12px;
	z-index: 2;
}

@media (max-width: 600px) {
	.bb-modal-content {
		max-width: 100%;
		width: 100%;
		max-height: 100vh;
		border-radius: 0;
	}
}

.bb-modal-close {
	position: absolute;
	top: 10px;
	left: 10px;
	width: 36px;
	height: 36px;
	background: rgba(0,0,0,0.5);
	border: none;
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	border-radius: 50%;
	z-index: 10;
	line-height: 1;
}

.bb-modal-close:hover {
	background: #c00000;
}

.bb-modal-body {
	padding: 0;
}

body.bb-modal-open {
	overflow: hidden;
}

/* Loading spinner */
.bb-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 60px;
}

.bb-loading::after {
	content: "";
	width: 40px;
	height: 40px;
	border: 3px solid #333;
	border-top-color: #c00000;
	border-radius: 50%;
	animation: bb-spin 0.8s linear infinite;
}

@keyframes bb-spin {
	to { transform: rotate(360deg); }
}

.bb-error {
	color: #fff;
	text-align: center;
	padding: 40px;
	font-size: 16px;
}

/* ===== POPUP PRODUCT ===== */
.bb-popup-product {
	color: #fff;
	display: flex;
	flex-direction: row;
	direction: rtl;
	min-height: 400px;
}

.bb-popup-image {
	background: #000;
	width: 45%;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bb-popup-image img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 500px;
	object-fit: contain;
}

.bb-popup-details {
	width: 55%;
	padding: 20px;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	max-height: 80vh;
}

/* Compact styles for popup */
.bb-popup-details .bb-bundle-selector,
.bb-popup-details .bb-weight-selector,
.bb-popup-details .bb-cut-selector {
	margin: 10px 0;
}

.bb-popup-details .bb-selector-label {
	font-size: 13px;
	margin-bottom: 8px;
}

.bb-popup-details .bb-bundle-option {
	padding: 10px 15px;
	gap: 10px;
}

.bb-popup-details .bb-bundle-weight {
	font-size: 14px;
}

.bb-popup-details .bb-bundle-price {
	font-size: 15px;
}

.bb-popup-details .bb-weight-preset {
	min-width: 65px;
	padding: 8px 10px;
}

.bb-popup-details .bb-weight-amount {
	font-size: 12px;
}

.bb-popup-details .bb-weight-price {
	font-size: 11px;
}

.bb-popup-details .bb-notes-input {
	min-height: 50px;
}

/* Mobile popup */
@media (max-width: 600px) {
	.bb-popup-product {
		flex-direction: column;
		min-height: auto;
	}
	
	.bb-popup-image {
		width: 100%;
		max-height: 200px;
	}
	
	.bb-popup-image img {
		max-height: 200px;
	}
	
	.bb-popup-details {
		width: 100%;
		padding: 15px;
		max-height: none;
	}
}

.bb-popup-title {
	margin: 0 0 10px;
	font-size: 22px;
	font-weight: 700;
	color: #fff;
}

.bb-popup-price {
	font-size: 20px;
	font-weight: 700;
	color: #c00000;
	margin-bottom: 15px;
}

.bb-popup-price del {
	color: #666;
	font-weight: 400;
	margin-left: 8px;
}

.bb-price-per-kg {
	font-size: 14px;
	font-weight: 400;
	color: #aaa;
	margin-right: 5px;
}

.bb-popup-price ins {
	text-decoration: none;
	background: none;
}

.bb-popup-desc {
	font-size: 14px;
	color: #aaa;
	margin-bottom: 20px;
	line-height: 1.5;
}

/* Quantity */
.bb-quantity-wrap {
	display: flex;
	align-items: center;
	gap: 15px;
	margin-bottom: 20px;
}

.bb-quantity-wrap label {
	font-size: 14px;
	color: #fff;
}

.bb-quantity-input {
	display: flex;
	align-items: center;
	background: #333;
	border-radius: 4px;
	overflow: hidden;
}

.bb-quantity-input button {
	width: 40px;
	height: 40px;
	background: #444;
	border: none;
	color: #fff;
	font-size: 18px;
	cursor: pointer;
}

.bb-quantity-input button:hover {
	background: #555;
}

.bb-quantity-input input.qty {
	width: 50px;
	height: 40px;
	background: #333;
	border: none;
	color: #fff;
	text-align: center;
	font-size: 16px;
	font-weight: 600;
	-moz-appearance: textfield;
}

.bb-quantity-input input.qty::-webkit-outer-spin-button,
.bb-quantity-input input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Add to cart button */
.bb-add-to-cart {
	display: block;
	width: 100%;
	padding: 15px 20px;
	background: #c00000;
	border: none;
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	border-radius: 4px;
	transition: background 0.2s;
}

.bb-add-to-cart:hover {
	background: #a00000;
}

.bb-add-to-cart:disabled {
	background: #666;
	cursor: not-allowed;
}

.bb-out-of-stock {
	color: #c00000;
	font-size: 14px;
	text-align: center;
	padding: 20px;
}

/* Variations form styling */
.bb-popup-product .variations {
	margin-bottom: 20px;
}

.bb-popup-product .variations tr {
	display: flex;
	flex-direction: column;
	margin-bottom: 15px;
}

.bb-popup-product .variations th,
.bb-popup-product .variations td {
	padding: 0;
}

.bb-popup-product .variations th label {
	display: block;
	font-size: 14px;
	color: #fff;
	margin-bottom: 8px;
	font-weight: 600;
}

.bb-popup-product .variations select {
	width: 100%;
	padding: 12px;
	background: #333;
	border: 1px solid #444;
	color: #fff;
	font-size: 14px;
	border-radius: 4px;
}

.bb-popup-product .single_variation_wrap {
	margin-top: 20px;
}

.bb-popup-product .woocommerce-variation-price {
	font-size: 20px;
	font-weight: 700;
	color: #c00000;
	margin-bottom: 15px;
}

.bb-popup-product .single_add_to_cart_button {
	display: block;
	width: 100%;
	padding: 15px 20px;
	background: #c00000;
	border: none;
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	border-radius: 4px;
}

.bb-popup-product .single_add_to_cart_button:hover {
	background: #a00000;
}

.bb-popup-product .single_add_to_cart_button.disabled {
	background: #666;
	cursor: not-allowed;
}
