/* =========================================================
 * SO - Halaman produk 2 kolom + kotak beli sticky (gaya bumijo.id)
 * VARIABEL: ubah ukuran/jarak di sini
 * ========================================================= */
body.single-product{
	--so-pd-jarak: 40px;            /* jarak kolom kiri & kanan */
	--so-pd-top: 24px;              /* jarak kotak beli dari atas layar saat sticky */
	--so-pd-thumb: 84px;            /* lebar thumbnail di samping kiri */
	--so-pd-utama-maks: 600px;      /* lebar maksimal foto utama */
	--so-pd-kanan-min: 360px;       /* lebar minimal kotak beli */
	--so-pd-garis: var(--border-weak, #e1e3e6);
	--so-pd-merah: var(--rwot-main-color, #e31e24);
}
body.single-product.admin-bar{ --so-pd-top: 56px; }

/* Sticky tidak jalan kalau pembungkus memakai overflow:hidden (bawaan Revo
   di #primary). "clip" tetap memotong konten melebar tanpa mematikan sticky. */
body.single-product #primary{ overflow-x: clip !important; }

/* ---------- HP & tablet: satu kolom ---------- */
.so-pd-grid{
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "galeri" "info" "tab";
}
.so-pd-galeri{ grid-area: galeri; min-width: 0; }
.so-pd-info  { grid-area: info;   min-width: 0; }
.so-pd-tab   { grid-area: tab;    min-width: 0; }

body.single-product div.product .so-pd-grid .woocommerce-product-gallery,
body.single-product div.product .so-pd-grid .summary{
	float: none !important;
	width: 100% !important;
	max-width: 100%;
}

/* Tombol panah thumbnail & tombol geser tab hanya untuk desktop.
   Di HP & tablet tidak ditampilkan sama sekali. */
.so-pd-thumb-nav,
.so-tab-nav{
	display: none !important;
}

/* =========================================================
 * DESKTOP (>= 992px) — berlaku di semua ukuran zoom browser
 * ========================================================= */
@media (min-width: 992px){

	/* ---------- Grid 2 kolom sama lebar ---------- */
	.so-pd-grid{
		grid-template-columns: minmax(0, 1fr) minmax(var(--so-pd-kanan-min), 1fr);
		grid-template-rows: auto 1fr;
		grid-template-areas:
			"galeri info"
			"tab    info";
		column-gap: var(--so-pd-jarak);
		align-items: start;
	}
	body.rwot-right-sidebar .so-pd-grid{
		grid-template-columns: minmax(var(--so-pd-kanan-min), 1fr) minmax(0, 1fr);
		grid-template-areas:
			"info galeri"
			"info tab";
	}
	.so-pd-info{ align-self: stretch; }

	/* ---------- Galeri: thumbnail vertikal di kiri foto utama ---------- */
	body.single-product div.product .so-pd-galeri .woocommerce-product-gallery{
		margin-bottom: 0;
	}
	.so-pd-galeri .woocommerce-product-gallery > .d-flex{
		flex-direction: row !important;
		align-items: stretch !important;
		justify-content: center !important; /* thumbnail + foto utama di tengah kolom kiri */
		gap: 16px !important;
	}

	/* Foto utama: persegi, tidak lebih tinggi dari layar */
	.so-pd-galeri #product-galleries-carousel{
		flex: 0 1 auto;
		width: max(300px, min(var(--so-pd-utama-maks), calc(100vh - 220px))) !important;
		max-width: calc(100% - var(--so-pd-thumb) - 16px) !important;
		height: auto !important;
		aspect-ratio: 1 / 1;
		min-width: 0;
		min-height: 0;
		border-radius: 12px;
		overflow: hidden;
		background: #fff;
	}
	/* Hanya 1 foto (tanpa thumbnail): foto utama di tengah kolom kiri */
	.so-pd-galeri #product-galleries-carousel:only-child{
		max-width: 100% !important;
		margin-left: auto !important;
		margin-right: auto !important;
	}
	.so-pd-galeri #product-galleries-carousel .splide__track,
	.so-pd-galeri #product-galleries-carousel .splide__list{
		width: 100% !important;
		max-width: none !important;
		height: 100% !important;
	}
	.so-pd-galeri #product-galleries-carousel .splide__slide,
	.so-pd-galeri #product-galleries-carousel .splide__slide img,
	.so-pd-galeri #product-galleries-carousel .splide__slide iframe{
		width: 100% !important;
		height: 100% !important;
	}
	.so-pd-galeri #product-galleries-carousel .splide__slide img{
		object-fit: contain;
	}
	.so-pd-galeri #product-galleries-carousel .splide__arrow{
		width: 36px;
		height: 36px;
		background: rgba(255,255,255,.9);
		box-shadow: 0 1px 4px rgba(0,0,0,.15);
	}

	/* Kolom thumbnail: setinggi foto utama, bisa di-scroll */
	.so-pd-galeri #product-thumbnails-carousel{
		order: -1;
		position: relative;
		flex: 0 0 var(--so-pd-thumb);
		width: var(--so-pd-thumb) !important;
		max-width: none !important;
		align-self: stretch;
		visibility: visible;
	}
	.so-pd-galeri #product-thumbnails-carousel .splide__arrows{ display: none !important; }
	.so-pd-galeri #product-thumbnails-carousel .splide__track{
		position: absolute;
		inset: 0;
		padding: 0 !important;
		overflow-x: hidden;
		overflow-y: auto;
		scroll-behavior: smooth;
		scrollbar-width: none;
	}
	.so-pd-galeri #product-thumbnails-carousel .splide__track::-webkit-scrollbar{ display: none; }
	.so-pd-galeri #product-thumbnails-carousel .splide__list{
		display: flex !important;
		flex-direction: column !important;
		gap: 12px;
		width: 100% !important;
		height: auto !important;
		transform: none !important;
	}
	body.single-product div.product .so-pd-galeri #product-thumbnails-carousel .splide__slide{
		flex: 0 0 auto;
		width: 100% !important;
		height: auto !important;
		aspect-ratio: 1 / 1;
		margin: 0 !important;
		border: 2px solid transparent !important;
		border-radius: 10px;
		overflow: hidden;
		opacity: .55;
		cursor: pointer;
		transition: opacity .2s, border-color .2s;
	}
	body.single-product div.product .so-pd-galeri #product-thumbnails-carousel .splide__slide:hover{ opacity: .85; }
	body.single-product div.product .so-pd-galeri #product-thumbnails-carousel .splide__slide.active{
		opacity: 1;
		border-color: var(--so-pd-merah) !important;
	}
	body.single-product div.product .so-pd-galeri #product-thumbnails-carousel .splide__slide img{
		width: 100%;
		height: 100%;
		object-fit: cover;
		border-radius: 8px;
	}

	/* Tombol naik/turun thumbnail (dibuat oleh JS bila thumbnail lebih panjang) */
	.so-pd-thumb-nav{
		position: absolute;
		left: 50%;
		z-index: 2;
		display: none;
		align-items: center;
		justify-content: center;
		width: 32px;
		height: 32px;
		margin-left: -16px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: #fff;
		color: #1f2122;
		box-shadow: 0 1px 6px rgba(0,0,0,.18);
		cursor: pointer;
	}
	.so-pd-thumb-nav.atas { top: 4px; }
	.so-pd-thumb-nav.bawah{ bottom: 4px; }
	.so-pd-thumb-nav.bawah svg{ transform: rotate(180deg); }
	#product-thumbnails-carousel.so-bisa-atas  .so-pd-thumb-nav.atas,
	#product-thumbnails-carousel.so-bisa-bawah .so-pd-thumb-nav.bawah{ display: flex !important; }

	/* ---------- Bar add-to-cart melayang di bawah: tidak dipakai di desktop
	   (sudah diwakili kotak beli kanan yang sticky) ---------- */
	body.single-product .floating-bottom-bar-product-detail,
	body.single-product .aws-sticky-bar{
		display: none !important;
	}

	/* ---------- Kotak beli (kanan) ---------- */
	body.single-product div.product .so-pd-grid .summary{
		position: sticky !important;
		top: var(--so-pd-top-hitung, var(--so-pd-top));
		padding: 24px 28px;
		border: 1px solid var(--so-pd-garis);
		border-radius: 12px;
		background: #fff;
		box-shadow: 0 2px 12px rgba(0,0,0,.05);
		font-size: 14px;
	}
	.so-pd-grid .summary .brand-container,
	.so-pd-grid .summary .brand-container > div{
		margin-bottom: 4px !important;
		font-size: 14px !important;
		line-height: 20px !important;
	}

	/* Judul: lebih kecil, tidak tertimpa tombol Bagikan */
	body.single-product div.product .so-pd-grid .summary .product_title{
		max-width: none;
		margin: 0 0 8px;
		padding-right: 92px;
		font-size: clamp(20px, 1.35vw, 24px);
		line-height: 1.35;
		font-weight: 700;
	}
	.so-pd-grid .summary .rwot-btn-open-share-modal span{
		font-size: 14px !important;
		line-height: 20px !important;
	}
	.so-pd-grid .summary .position-relative > .position-absolute.end-0{
		top: 2px !important;
	}
	.so-pd-grid .summary .rwot-btn-open-share-modal svg{
		width: 18px;
		height: 18px;
	}

	/* Rating & harga */
	body.single-product div.product .so-pd-grid .summary .woocommerce-product-rating{
		margin-bottom: 8px;
		font-size: 14px;
	}
	body.single-product div.product .so-pd-grid .summary .woocommerce-product-rating .fs-16{
		font-size: 14px !important;
	}
	body.single-product div.product .so-pd-grid .summary .price{
		font-size: clamp(20px, 1.3vw, 24px) !important;
		line-height: 1.3;
		color: var(--so-pd-merah) !important;
	}
	body.single-product div.product .so-pd-grid .summary .price del{
		font-size: 14px;
		font-weight: 400;
		color: var(--text-disabled, #66696d);
	}

	/* Garis pemisah seperti kartu bumijo */
	body.single-product div.product .so-pd-grid .summary form.cart{
		margin-top: 16px;
		padding-top: 20px;
		border-top: 1px solid var(--so-pd-garis);
		gap: 16px;
	}

	/* Pilihan varian */
	body.single-product div.product .so-pd-grid .variations_form .variations tr th.label,
	body.single-product div.product .so-pd-grid .variations_form .variations tr th.label label{
		font-size: 14px;
		font-weight: 600;
	}
	body.single-product div.product .so-pd-grid .variations_form .variations .attributes-container{
		gap: 8px;
	}
	body.single-product div.product .so-pd-grid .variations_form .variations .attributes-container .attribute-item{
		min-height: 34px;
		padding: 4px 14px;
		border-radius: 8px;
		font-size: 14px;
	}

	/* Jumlah + tombol: rapi & tidak berdesakan */
	.so-pd-grid .summary .woocommerce-variation-add-to-cart > .d-flex,
	.so-pd-grid .summary form.cart:not(.variations_form) > .d-flex{
		flex-wrap: wrap;
		gap: 10px !important;
	}
	body.single-product div.product .so-pd-grid .summary form.cart .single_add_to_cart_button,
	.so-pd-grid .summary form.cart .btn-whatsapp-order{
		flex: 1 1 150px;
		width: auto !important;
		min-height: 44px;
		padding: 8px 14px !important;
		font-size: 15px !important;
		line-height: 1.25;
		white-space: normal;
	}
	.so-pd-grid .summary form.cart .btn-whatsapp-order span{
		font-size: 15px !important;
	}
	body.single-product div.product .so-pd-grid .summary form.cart .btn-counter{
		min-height: 44px;
	}
	body.single-product div.product .so-pd-grid .summary form.cart .quantity .qty{
		height: 44px;
		font-size: 15px;
	}

	/* Wishlist & info SKU/kategori */
	.so-pd-grid .summary .aws-wishlist-button{
		margin-top: 12px;
		font-size: 14px;
	}
	.so-pd-grid .summary .aws-wishlist-button svg{
		width: 20px;
		height: 20px;
	}
	body.single-product div.product .so-pd-grid .summary .product_meta{
		margin-top: 16px;
		padding-top: 16px;
		border-top: 1px solid var(--so-pd-garis);
		font-size: 14px;
		font-weight: 600;
	}

	/* ---------- Tab Deskripsi / Ulasan: satu baris, geser bila tidak muat ---------- */
	.so-pd-tab{
		margin-top: 32px;
	}
	.so-tab-geser{
		position: relative;
		margin: 0 0 24px;
	}
	body.single-product div.product .so-pd-tab .woocommerce-tabs ul.tabs{
		flex-wrap: nowrap !important;
		justify-content: flex-start;
		gap: 0;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		box-shadow: inset 0 -1px 0 var(--so-pd-garis);
		overflow-x: auto !important;
		overflow-y: hidden !important;
		scroll-behavior: smooth;
		scrollbar-width: none;
	}
	body.single-product div.product .so-pd-tab .woocommerce-tabs ul.tabs::-webkit-scrollbar{ display: none; }
	body.single-product div.product .so-pd-tab .woocommerce-tabs ul.tabs::before,
	body.single-product div.product .so-pd-tab .woocommerce-tabs ul.tabs::after{
		display: none !important;
	}
	body.single-product div.product .so-pd-tab .woocommerce-tabs ul.tabs li{
		flex: 0 0 auto;
		top: 0;
		margin: 0 !important;
		padding: 12px 14px !important;
		border: 0 !important;
		border-bottom: 3px solid transparent !important;
		white-space: nowrap;
	}
	body.single-product div.product .so-pd-tab .woocommerce-tabs ul.tabs li:hover,
	body.single-product div.product .so-pd-tab .woocommerce-tabs ul.tabs li.active{
		border-top: 0 !important;
		border-bottom-color: var(--so-pd-merah) !important;
	}
	body.single-product div.product .so-pd-tab .woocommerce-tabs ul.tabs li > a{
		padding: 0;
		text-transform: none;
		font-size: 15px;
		font-weight: 600;
		white-space: nowrap;
		color: var(--text-weak, #414346);
	}
	body.single-product div.product .so-pd-tab .woocommerce-tabs ul.tabs li.active > a{
		color: var(--so-pd-merah);
	}

	/* Tombol geser tab (muncul hanya bila tab tidak muat satu baris) */
	.so-tab-nav{
		position: absolute;
		top: 0;
		bottom: 1px;
		z-index: 2;
		display: none;
		align-items: center;
		width: 44px;
		padding: 0;
		border: 0;
		color: #1f2122;
		cursor: pointer;
	}
	.so-tab-nav span{
		display: flex;
		align-items: center;
		justify-content: center;
		width: 28px;
		height: 28px;
		border-radius: 50%;
		background: #fff;
		box-shadow: 0 1px 5px rgba(0,0,0,.18);
	}
	.so-tab-nav.kiri{
		left: 0;
		justify-content: flex-start;
		background: linear-gradient(90deg, #fff 55%, rgba(255,255,255,0));
	}
	.so-tab-nav.kanan{
		right: 0;
		justify-content: flex-end;
		background: linear-gradient(270deg, #fff 55%, rgba(255,255,255,0));
	}
	.so-tab-nav.kiri svg{ transform: rotate(180deg); }
	.so-tab-geser.so-bisa-kiri  .so-tab-nav.kiri,
	.so-tab-geser.so-bisa-kanan .so-tab-nav.kanan{ display: flex !important; }

	body.single-product div.product .so-pd-tab .woocommerce-Tabs-panel{
		margin: 0;
		padding: 0;
		font-size: 15px;
		line-height: 1.7;
	}
	body.single-product div.product .so-pd-tab .woocommerce-Tabs-panel h2{
		font-size: 20px;
	}
	body.single-product div.product .so-pd-tab .woocommerce-Tabs-panel img{
		max-width: 100%;
		height: auto;
	}
}

@media (prefers-reduced-motion: reduce){
	.so-pd-galeri #product-thumbnails-carousel .splide__track{ scroll-behavior: auto; }
}
