/* =========================================================
   Araak Graphic Single Product Builder — Frontend Styles
   All rules are intentionally low-specificity utility classes
   so Elementor's own selector overrides (added via controls)
   always win. Nothing here touches core WooCommerce classes,
   so there is no conflict with WooCommerce's own styling/logic.
   ========================================================= */

.agsp-purchase-box, .agsp-product-info, .agsp-price-box, .agsp-meta-box, .agsp-gallery, .agsp-tabs, .agsp-reviews-wrap, .agsp-related-wrap {
	direction: rtl;
	box-sizing: border-box;
}
.agsp-purchase-box *, .agsp-product-info *, .agsp-price-box *, .agsp-meta-box *, .agsp-gallery *, .agsp-tabs *, .agsp-reviews-wrap *, .agsp-related-wrap * {
	box-sizing: border-box;
}

/* ---------- Gallery ---------- */
.agsp-gallery-inner {
	display: flex;
	gap: 16px;
}
.agsp-main-image-wrap { flex: 1 1 auto; min-width: 0; }
.agsp-main-image-frame {
	position: relative;
	width: 84%;
	max-width: 100%;
	aspect-ratio: 1/1;
	overflow: hidden;
	border-radius: 12px;
	background: #fafafa;
}
.agsp-main-image-frame img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	opacity: 0;
	transition: opacity .25s ease;
	pointer-events: none;
}
.agsp-main-image-frame img.is-active { opacity: 1; pointer-events: auto; }
.agsp-main-image-frame[data-agsp-zoom="yes"]:hover img.is-active {
	transform: scale(1.35);
	transition: transform .35s ease;
	cursor: zoom-in;
}
.agsp-badge {
	position: absolute;
	top: 14px;
	z-index: 2;
	background: #1b5e42;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 6px;
}
.agsp-badge--top-right { right: 14px; }
.agsp-badge--top-left { left: 14px; }

.agsp-nav-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: rgba(255,255,255,.9);
	color: #333;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.agsp-nav-prev { right: 10px; }
.agsp-nav-next { left: 10px; }

.agsp-thumbs {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.agsp-thumbs--scroll .agsp-thumbs { overflow: auto; scrollbar-width: thin; }
.agsp-thumb {
	width: 76px;
	height: 76px;
	flex: 0 0 auto;
	border: 2px solid #eee;
	border-radius: 10px;
	background: #fff;
	padding: 4px;
	cursor: pointer;
	overflow: hidden;
}
.agsp-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.agsp-thumb.is-active { border-color: #1b5e42; }

/* ---------- Product Info box (title/rating/desc/features/swatches/quantity) ---------- */
.agsp-product-info { display: flex; flex-direction: column; gap: 16px; }
.agsp-title { font-size: 22px; font-weight: 700; margin: 0; line-height: 1.5; }

.agsp-badges-row { display: flex; flex-wrap: wrap; gap: 8px; }
.agsp-badge-pill {
	background: #f4f5f6;
	color: #444;
	font-size: 13px;
	padding: 5px 12px;
	border-radius: 20px;
	display: inline-block;
}

.agsp-rating-row { display: flex; align-items: center; gap: 8px; }
.agsp-stars {
	position: relative;
	display: inline-block;
	font-size: 16px;
	line-height: 1;
	letter-spacing: 2px;
	color: #e2e2e2;
	unicode-bidi: bidi-override;
	direction: ltr;
}
.agsp-stars::before {
	content: "★★★★★";
	position: absolute;
	top: 0; right: 0;
	width: calc(var(--rating, 0) / 5 * 100%);
	overflow: hidden;
	white-space: nowrap;
	color: #f5a623;
}
.agsp-rating-count { color: #777; font-size: 13px; text-decoration: none; }

.agsp-short-desc { color: #555; line-height: 1.9; font-size: 14px; }
.agsp-short-desc p:last-child { margin-bottom: 0; }

.agsp-features-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.agsp-feature-item { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #333; }
.agsp-feature-item svg { flex: 0 0 auto; color: #1b5e42; }

/* ---------- Native Woo add-to-cart form: lives inside .agsp-product-info,
   its submit button is always visually hidden and triggered remotely by
   the Price & Buy Box widget (see agsp-frontend.js). ---------- */
.agsp-atc-form-wrap .cart { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.agsp-atc-form-wrap table.variations { width: 100%; border: none; margin-bottom: 4px; }
.agsp-atc-form-wrap table.variations tr { display: block; }
.agsp-atc-form-wrap table.variations th,
.agsp-atc-form-wrap table.variations td { display: block; padding: 0; border: none; text-align: right; }
.agsp-atc-form-wrap .reset_variations { font-size: 12px; margin-inline-start: 8px; }
.agsp-atc-form-wrap.agsp-hide-qty .quantity { display: none !important; }
.agsp-atc-form-wrap.agsp-hide-swatches table.variations { display: none !important; }
.agsp-atc-form-wrap button[type="submit"].single_add_to_cart_button {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
}

.agsp-swatch-label { font-size: 14px; font-weight: 600; color: #333; margin-bottom: 4px; }

/* Native <select> stays in DOM (for full WooCommerce compatibility / accessibility)
   but is visually replaced by our custom dropdown once JS enhances it. */
.agsp-atc-form-wrap select.agsp-enhanced {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	white-space: nowrap;
	border: 0;
}

.agsp-swatch-field { position: relative; margin-bottom: 14px; max-width: 320px; }
.agsp-swatch-trigger {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: #fff;
	border: 1px solid #e2e2e2;
	border-radius: 10px;
	padding: 10px 14px;
	cursor: pointer;
	font-size: 14px;
	color: #333;
}
.agsp-swatch-trigger-label { display: flex; align-items: center; gap: 8px; }
.agsp-swatch-circle {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid #e2e2e2;
	flex: 0 0 auto;
	display: inline-block;
}
.agsp-swatch-caret { transition: transform .2s ease; color: #999; }
.agsp-swatch-field.is-open .agsp-swatch-caret { transform: rotate(180deg); }

.agsp-swatch-panel {
	position: absolute;
	z-index: 30;
	top: calc(100% + 6px);
	right: 0;
	left: 0;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0,0,0,.12);
	padding: 8px;
	max-height: 260px;
	overflow: auto;
	display: none;
}
.agsp-swatch-field.is-open .agsp-swatch-panel { display: block; }

.agsp-swatch-option {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	background: none;
	border: none;
	text-align: right;
	padding: 8px 10px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
}
.agsp-swatch-option:hover { background: #f5f6f7; }
.agsp-swatch-option.is-selected { background: #eef6f0; font-weight: 700; }
.agsp-swatch-option .agsp-swatch-circle { width: 18px; height: 18px; }
.agsp-swatch-option[disabled] { opacity: .35; cursor: not-allowed; }

/* ---------- Price & Buy box (separate, independent widget) ---------- */
.agsp-price-box { display: flex; flex-direction: column; gap: 12px; }
.agsp-price-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.agsp-price { font-size: 24px; font-weight: 800; color: #1b1b1b; }
.agsp-price del { color: #aaa; font-weight: 400; font-size: .7em; }
.agsp-discount-percent {
	background: #e53935;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 6px;
}

/* ---------- Quantity + buttons ---------- */
.agsp-atc-form-wrap .quantity input.qty {
	width: 90px;
	height: 48px;
	border: 1px solid #e2e2e2;
	border-radius: 10px;
	text-align: center;
	font-size: 15px;
}
.agsp-atc-form-wrap button[type="submit"],
.agsp-btn-atc {
	background: #1b5e42;
	color: #fff;
	border: 1px solid #1b5e42;
	border-radius: 10px;
	height: 48px;
	padding: 0 22px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	flex: 1 1 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}
.agsp-btn-buynow {
	width: 100%;
	background: #fff;
	color: #1b5e42;
	border: 1.5px solid #1b5e42;
	border-radius: 10px;
	height: 48px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}

/* ---------- Stock + meta (independent widget) ---------- */
.agsp-meta-box { display: flex; flex-direction: column; gap: 12px; }
.agsp-stock-box { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #333; }
.agsp-stock-dot { width: 8px; height: 8px; border-radius: 50%; }
.agsp-stock-dot.is-in { background: #2e9e5b; }
.agsp-stock-dot.is-out { background: #d64545; }
.agsp-meta-table { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.agsp-meta-row { display: flex; gap: 6px; }
.agsp-meta-row span:first-child { color: #999; }
.agsp-meta-row span:last-child { color: #333; }

/* ---------- Info boxes (standalone widget) ---------- */
.agsp-info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.agsp-info-item { display: flex; align-items: flex-start; gap: 10px; padding: 14px; }
.agsp-info-item strong { display: block; font-size: 14px; }
.agsp-info-item p { margin: 4px 0 0; font-size: 12.5px; color: #888; }

/* ---------- Tabs ---------- */
.agsp-tabs-nav { display: flex; gap: 22px; border-bottom: 1px solid #eee; overflow-x: auto; }
.agsp-tab-btn {
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	padding: 12px 2px;
	font-size: 14px;
	color: #777;
	cursor: pointer;
	white-space: nowrap;
}
.agsp-tab-btn.is-active { color: #1b5e42; border-bottom-color: #1b5e42; font-weight: 700; }
.agsp-tab-panel { display: none; padding: 22px 0; line-height: 1.9; font-size: 14px; color: #444; }
.agsp-tab-panel.is-active { display: block; }
.agsp-specs-table { width: 100%; border-collapse: collapse; }
.agsp-specs-table th, .agsp-specs-table td { text-align: right; padding: 10px 12px; border-bottom: 1px solid #f1f1f1; font-size: 13.5px; }
.agsp-specs-table th { color: #888; font-weight: 500; width: 35%; }

/* ---------- Reviews ---------- */
.agsp-review-summary { display: flex; gap: 30px; flex-wrap: wrap; align-items: center; padding: 20px 0; }
.agsp-avg-block { text-align: center; }
.agsp-avg-number { font-size: 40px; font-weight: 800; }
.agsp-avg-count { font-size: 12px; color: #888; margin-top: 4px; }
.agsp-bars-block { flex: 1 1 260px; display: flex; flex-direction: column; gap: 6px; }
.agsp-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #777; }
.agsp-bar-label { width: 36px; }
.agsp-bar-track { flex: 1; height: 8px; border-radius: 6px; background: #eee; overflow: hidden; }
.agsp-bar-fill { display: block; height: 100%; background: #f5a623; }
.agsp-bar-count { width: 24px; text-align: left; }
.agsp-review-prompt { background: #f8faf9; border: 1px dashed #d8e3dd; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.agsp-review-prompt p { margin: 0; font-size: 13.5px; color: #4a6a58; }

/* ---------- Related products ---------- */
.agsp-related-heading { font-size: 20px; font-weight: 700; margin: 0 0 16px; }
.agsp-related-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; }
.agsp-related--scrollable { }
.agsp-related-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	text-decoration: none;
	color: inherit;
	border: 1px solid #f0f0f0;
	border-radius: 12px;
	padding: 14px;
	transition: box-shadow .2s ease;
}
.agsp-related-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.agsp-related-card img { width: 100%; height: auto; border-radius: 8px; }
.agsp-related-card-title { font-size: 13.5px; color: #333; }
.agsp-related-card-price { font-size: 13px; color: #555; font-weight: 700; }
.agsp-heart-icon { position: absolute; top: 10px; left: 10px; color: #ccc; font-size: 16px; }

/* ---------- Responsive base (mobile-first tweaks, refine freely from Elementor responsive controls) ---------- */
@media (max-width: 767px) {
	.agsp-related-grid { grid-template-columns: repeat(2, 1fr); }
	.agsp-trust-list { grid-template-columns: 1fr; }
	.agsp-info-grid { grid-template-columns: 1fr; }
}
