/**
 * Storzen v1.2 — New Single-Product Widget Styles
 *
 * Covers:
 *  • .sz-product-reviews-widget   (Product Reviews widget)
 *  • .sz-product-stock-widget     (Product Stock widget)
 *  • .sz-product-upsells-widget   (Upsell Products widget)
 *
 * INSTALLATION:
 *   1. Copy to:  storzen/assets/css/sz-product-single-new-widgets.css
 *   2. Register + conditionally enqueue via the patch to class-storzen-init.php.
 *      The stylesheet is loaded only on single product pages (is_product()).
 *
 * Design rules:
 *  • Uses CSS custom properties so Elementor color controls cascade naturally.
 *  • No Bootstrap, no external font, no hard-coded px colours in layout rules.
 *  • RTL-friendly (logical properties used where possible).
 *
 * @package storzen
 * @since   1.2.0
 */

/* ─────────────────────────────────────────────────────────────────────────────
   SHARED
   ───────────────────────────────────────────────────────────────────────── */

.sz-product-reviews-widget,
.sz-product-stock-widget,
.sz-product-upsells-widget {
	box-sizing: border-box;
}

.sz-product-reviews-widget *,
.sz-product-stock-widget *,
.sz-product-upsells-widget * {
	box-sizing: inherit;
}


/* ─────────────────────────────────────────────────────────────────────────────
   1. PRODUCT REVIEWS WIDGET
   ───────────────────────────────────────────────────────────────────────── */

/* Section title */
.sz-reviews-section-title {
	margin: 0 0 20px;
	font-size: 1.5em;
	font-weight: 700;
	line-height: 1.3;
}

/* ── Rating summary ── */
.sz-rating-summary {
	display: flex;
	align-items: flex-start;
	gap: 28px;
	flex-wrap: wrap;
	margin-bottom: 28px;
	padding: 20px 24px;
	background: #fafafa;
	border: 1px solid #ebebeb;
	border-radius: 8px;
}

/* Left: big score */
.sz-rating-summary__score {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	min-width: 80px;
}

.sz-avg-score {
	font-size: 3em;
	font-weight: 800;
	line-height: 1;
	color: #1a1a1a;
}

.sz-avg-stars .star-rating {
	font-size: 1em;
	margin: 0;
	float: none;
}

.sz-review-count {
	font-size: 0.8em;
	color: #888;
	white-space: nowrap;
}

/* Right: per-star bars */
.sz-rating-bars {
	flex: 1;
	min-width: 180px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.sz-rating-bar-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.sz-bar-star {
	font-size: 0.8em;
	color: #555;
	white-space: nowrap;
	min-width: 32px;
	text-align: right;
}

.sz-bar-track {
	flex: 1;
	height: 8px;
	background: #e8e8e8;
	border-radius: 8px;
	overflow: hidden;
}

.sz-bar-fill {
	height: 100%;
	background: #f0c040; /* overridden by Elementor color control */
	border-radius: 8px;
	transition: width 0.4s ease;
}

.sz-bar-count {
	font-size: 0.8em;
	color: #888;
	min-width: 20px;
	text-align: left;
}

/* RTL */
[dir="rtl"] .sz-rating-bars {
	direction: rtl;
}

[dir="rtl"] .sz-bar-star {
	text-align: left;
}


/* ─────────────────────────────────────────────────────────────────────────────
   2. PRODUCT STOCK WIDGET
   ───────────────────────────────────────────────────────────────────────── */

.sz-product-stock-widget {
	display: inline-block;
	width: 100%;
}

/* Status text variants */
.sz-stock-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.4;
}

.sz-stock-in {
	color: #27ae60; /* overridden by Elementor color control */
}

.sz-stock-low {
	color: #e74c3c; /* overridden by Elementor color control */
}

.sz-stock-out {
	color: #95a5a6; /* overridden by Elementor color control */
}

/* Progress bar */
.sz-stock-bar-track {
	display: block;
	width: 100%;
	height: 6px;
	background: #f0f0f0; /* overridden by Elementor color control */
	border-radius: 6px;
	overflow: hidden;
	margin-top: 8px;
}

.sz-stock-bar-fill {
	display: block;
	height: 100%;
	background: #e74c3c; /* overridden by Elementor color control */
	border-radius: 6px;
	transition: width 0.5s ease;
}


/* ─────────────────────────────────────────────────────────────────────────────
   3. UPSELL PRODUCTS WIDGET
   ───────────────────────────────────────────────────────────────────────── */

/* Section title */
.sz-upsells-section-title {
	margin: 0 0 24px;
	font-size: 1.4em;
	font-weight: 700;
	line-height: 1.3;
}

/* ── Grid layout ── */
.sz-upsells-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr); /* overridden by Elementor responsive columns control */
	gap: 20px;
}

@media (max-width: 1023px) {
	.sz-upsells-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 767px) {
	.sz-upsells-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 479px) {
	.sz-upsells-grid {
		grid-template-columns: 1fr;
	}
}

/* ── Carousel layout ── */
.sz-upsells-carousel {
	position: relative;
	overflow: hidden;
}

.sz-upsells-carousel .swiper-wrapper {
	display: flex;
	align-items: stretch;
}

.sz-upsells-carousel .swiper-slide {
	height: auto;
	display: flex;
}

.sz-upsells-carousel .swiper-button-prev,
.sz-upsells-carousel .swiper-button-next {
	color: #1a1a1a;
	width: 36px;
	height: 36px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.sz-upsells-carousel .swiper-button-prev::after,
.sz-upsells-carousel .swiper-button-next::after {
	font-size: 14px;
	font-weight: 700;
}

.sz-upsells-carousel .swiper-pagination {
	position: relative;
	margin-top: 16px;
}

/* ── Product card ── */
.sz-upsell-card {
	display: flex;
	flex-direction: column;
	width: 100%;
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid #ebebeb;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.sz-upsell-card:hover {
	box-shadow: 0 4px 20px rgba(0,0,0,.08);
	transform: translateY(-2px);
}

/* Thumbnail */
.sz-upsell-card__thumb {
	display: block;
	overflow: hidden;
	line-height: 0;
}

.sz-upsell-card__thumb img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform 0.3s ease;
	object-fit: cover;
}

.sz-upsell-card:hover .sz-upsell-card__thumb img {
	transform: scale(1.04);
}

/* Card body */
.sz-upsell-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 12px;
}

/* Product name */
.sz-upsell-card__name {
	margin: 0 0 6px;
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.4;
}

.sz-upsell-card__name a {
	color: inherit;
	text-decoration: none;
}

.sz-upsell-card__name a:hover {
	color: #FF3636;
}

/* Price */
.sz-upsell-card__price {
	margin-bottom: 6px;
	font-size: 0.95em;
	font-weight: 700;
}

.sz-upsell-card__price .woocommerce-Price-amount {
	color: inherit;
}

.sz-upsell-card__price del {
	opacity: 0.5;
	font-weight: 400;
	font-size: 0.9em;
}

.sz-upsell-card__price ins {
	text-decoration: none;
}

/* Star rating */
.sz-upsell-card__rating {
	margin-bottom: 8px;
}

.sz-upsell-card__rating .star-rating {
	font-size: 0.85em;
	float: none;
	display: inline-block;
}

/* Add to cart button */
.sz-upsell-atc {
	display: block;
	width: 100%;
	margin-top: auto;
	padding: 8px 12px;
	text-align: center;
	background: #FF3636; /* overridden by Elementor color control */
	color: #ffffff;
	border: 2px solid #FF3636;
	border-radius: 4px;
	font-size: 0.875em;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sz-upsell-atc:hover {
	background: #cc2929;
	border-color: #cc2929;
	color: #ffffff;
}

.sz-upsell-atc.added::after {
	display: none; /* hide WooCommerce's default checkmark; keep button clean */
}

/* ── RTL support ── */
[dir="rtl"] .sz-upsells-grid {
	direction: rtl;
}
