.ttsn-sg-wrapper {
	display: flex;
	align-items: flex-start;
	gap: 30px;
}

.ttsn-sg-sidebar {
	flex: 0 0 22%;
	max-width: 22%;
}

.ttsn-sg-content {
	flex: 1 1 0%;
	min-width: 0;
}

/* ---------------- Category tree (nested, expand/collapse) ---------------- */

.ttsn-sg-tree.ttsn-sg-tree-root .ttsn-sg-tree-toggle:hover,.ttsn-sg-tree.ttsn-sg-tree-root .ttsn-sg-tree-toggle:focus{
    background: transparent !important;
}

.ttsn-sg-tree-root {
	--ttsn-sg-tree-indent: 16px;
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid #eee;
	box-sizing: border-box;
}

.ttsn-sg-tree {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ttsn-sg-tree-item + .ttsn-sg-tree-item {
	border-top: 1px solid #eee;
}

.ttsn-sg-tree-row {
	position: relative;
	display: flex;
	align-items: stretch;
	transition: background-color .15s ease;
}

.ttsn-sg-tree-link {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-width: 0;
	padding: 12px 16px;
	padding-left: calc(var(--ttsn-sg-tree-base-left, 16px) + (var(--ttsn-sg-tree-level, 0) * var(--ttsn-sg-tree-indent, 16px)));
	text-decoration: none;
	color: #333;
	font-size: 14px;
	transition: color .15s ease;
	cursor: pointer;
}

.ttsn-sg-tree-item.is-active > .ttsn-sg-tree-row {
	background-color: #2c6ecb;
}

.ttsn-sg-tree-item.is-active > .ttsn-sg-tree-row .ttsn-sg-tree-link {
	color: #fff;
}

.ttsn-sg-tree-name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ttsn-sg-tree-count {
	opacity: .7;
	font-size: 12px;
	flex: 0 0 auto;
}

.ttsn-sg-tree-toggle {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	background: transparent;
	border: none;
	padding: 12px 14px 12px 0;
	color: #777;
	cursor: pointer;
}

.ttsn-sg-tree-toggle svg {
	display: block;
	width: 12px;
	height: 12px;
	transition: transform .2s ease;
}

.ttsn-sg-tree-item.is-open > .ttsn-sg-tree-row .ttsn-sg-tree-toggle svg {
	transform: rotate(90deg);
}

.ttsn-sg-tree-children {
	list-style: none;
	margin: 0;
	padding: 0;
	display: none;
	background: rgba(0, 0, 0, .015);
}

.ttsn-sg-tree-item.is-open > .ttsn-sg-tree-children {
	display: block;
}

.ttsn-sg-tree-children .ttsn-sg-tree-item + .ttsn-sg-tree-item {
	border-top: 1px solid #eee;
}

/* ---------------- Product grid ---------------- */

.ttsn-sg-product-grid {
	--ttsn-sg-prod-cols: 4;
	display: grid;
	grid-template-columns: repeat(var(--ttsn-sg-prod-cols), 1fr);
	gap: 20px;
}

.ttsn-sg-no-products {
	margin: 0;
	opacity: .7;
}

.ttsn-sg-products-container {
	margin-top: 24px;
	padding: 20px;
	border: 1px solid #eee;
}

.ttsn-sg-product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #ececec;
	border-radius: 8px;
	overflow: hidden;
	transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}

.ttsn-sg-product-card:hover {
	box-shadow: 0 12px 28px rgba(20, 20, 20, .09);
	transform: translateY(-3px);
	border-color: #e2e2e2;
}

.ttsn-sg-product-thumb {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: #fafafa;
	overflow: hidden;
}

.ttsn-sg-product-thumb a {
	display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.ttsn-sg-product-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* Gallery image swap on hover — both images are stacked (absolute, same
   box) and cross-fade via opacity; without the main image also being
   absolutely positioned and fading out, the two rendered on top of each
   other at once instead of one replacing the other. The main image only
   fades out on cards that actually HAVE a second (gallery) image to fade
   into — .ttsn-sg-has-hover-img is only added by PHP when one exists —
   otherwise products with no gallery image would fade to nothing (a bare
   tinted box) on hover instead of just staying on their one photo. */
.ttsn-sg-thumb-main,
.ttsn-sg-thumb-hover {
	position: absolute;
	inset: 0;
	transition: opacity .3s ease;
}

.ttsn-sg-thumb-hover {
	opacity: 0;
}

.ttsn-sg-product-card:hover .ttsn-sg-product-thumb.ttsn-sg-has-hover-img .ttsn-sg-thumb-main {
	opacity: 0;
}

.ttsn-sg-product-card:hover .ttsn-sg-thumb-hover {
	opacity: 1;
}

/* Overlay tint on hover — transparent unless a color is set via widget Style controls */
.ttsn-sg-thumb-overlay {
	position: absolute;
	inset: 0;
	background-color: transparent;
	transition: background-color .25s ease;
	z-index: 1;
	pointer-events: none;
}

.ttsn-sg-product-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	background: #e0622f;
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 3px;
	z-index: 2;
}

.ttsn-sg-product-actions {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	opacity: 0;
	visibility: hidden;
	transform: translateX(8px);
	transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
	z-index: 3;
}

.ttsn-sg-product-card:hover .ttsn-sg-product-actions {
	opacity: 1;
	visibility: visible;
	transform: translateX(0);
}

.ttsn-sg-action {
	position: relative;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 36px !important;
	height: 36px;
	flex: 0 0 36px;
	border-radius: 50% !important;
	background: #fff;
	color: #333;
	border: none !important;
	box-shadow: 0 2px 10px rgba(0,0,0,.16);
	cursor: pointer;
	text-decoration: none;
	overflow: hidden;
	transition: background-color .15s ease, color .15s ease, transform .15s ease;
	padding: 0;
}

.ttsn-sg-action svg {
	display: block;
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
}

.ttsn-sg-action:hover {
	background: #2c6ecb;
	color: #fff;
	transform: scale(1.06);
}

.ttsn-sg-action.is-loading {
	pointer-events: none;
}

.ttsn-sg-action.is-loading svg {
	visibility: hidden;
}

.ttsn-sg-action.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 14px;
	height: 14px;
	margin: -7px 0 0 -7px;
	border-radius: 50%;
	border: 2px solid rgba(0,0,0,.2);
	border-top-color: currentColor;
	animation: ttsn-spin .7s linear infinite;
}

.ttsn-sg-action-cart.is-added {
	background: #2fac66;
	color: #fff;
}

.ttsn-sg-action.is-added svg {
	display: none;
}

.ttsn-sg-action.is-added::after {
	content: "\2713";
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
}

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

.ttsn-sg-product-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 14px 16px 16px;
}

.ttsn-sg-product-price {
	font-size: 14px;
	font-weight: 600;
	color: #e0622f;
}

.ttsn-sg-product-price del {
	opacity: .6;
	font-weight: 400;
	margin-right: 4px;
}

.ttsn-sg-product-title {
	font-size: 14px;
	color: #333;
	text-decoration: none;
	line-height: 1.4;
}

.ttsn-sg-product-title:hover {
	text-decoration: underline;
}

.ttsn-sg-product-desc {
	font-size: 13px;
	color: #666;
	line-height: 1.5;
}

.ttsn-sg-atc-wrap {
	margin-top: 6px;
}

.ttsn-sg-atc-wrap .button {
	display: inline-block;
	width: 100%;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	padding: 9px 14px;
	border-radius: 4px;
	background: #2c6ecb;
	color: #fff;
	border: 1px solid #2c6ecb;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
	box-sizing: border-box;
}

.ttsn-sg-atc-wrap .button:hover {
	background: #1e4f96;
	border-color: #1e4f96;
	color: #fff;
}

.ttsn-sg-atc-wrap .button.loading {
	opacity: .6;
	pointer-events: none;
}

.ttsn-sg-atc-wrap .added_to_cart {
	display: block;
	margin-top: 6px;
	font-size: 12px;
	text-align: center;
}

/* ---------------- Loading state while switching category ---------------- */

.ttsn-sg-content.is-loading {
	opacity: .5;
	pointer-events: none;
	transition: opacity .15s ease;
}

/* ---------------- Quick View ---------------- */

body.ttsn-sg-qv-locked {
	overflow: hidden;
}

.ttsn-sg-qv-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background-color: rgba(0,0,0,.65);
	z-index: 999999;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.ttsn-sg-qv-overlay.is-open {
	display: flex;
}

.ttsn-sg-qv-modal {
	position: relative;
	background: #fff;
	width: 100%;
	max-width: 900px;
	max-height: 90vh;
	overflow-y: auto;
	border-radius: 6px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 30px;
	padding: 36px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.ttsn-sg-qv-modal::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

.ttsn-sg-qv-modal:empty {
	min-height: 200px;
}

.ttsn-sg-qv-gallery {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* ---------------- Main image (fades between slides, same as Product Image Pro) ---------------- */

.ttsn-sg-qv-main {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #fafafa;
	border-radius: 4px;
}

.ttsn-sg-qv-main-track {
	position: relative;
	width: 100%;
}

.ttsn-sg-qv-main-slide {
	display: none;
	width: 100%;
}

.ttsn-sg-qv-main-slide.is-active {
	display: block;
	animation: ttsn-sg-qv-fade .25s ease;
}

@keyframes ttsn-sg-qv-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.ttsn-sg-qv-main-slide img {
	width: 100%;
	height: auto;
	display: block;
}

.ttsn-sg-qv-main-arrow {
	position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 23;
    width: 34px !important;
    height: 34px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border: none !important;
    border-radius: 50% !important;
    background: #fff;
    color: #333 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .14);
    cursor: pointer;
    padding: 0 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease, background-color .15s ease, color .15s ease;
}

.ttsn-sg-qv-main-arrow:hover{
    background: #1A458A !important;
    color:#fff !important;
}

.ttsn-sg-qv-main:hover .ttsn-sg-qv-main-arrow {
	opacity: 1;
	visibility: visible;
}

.ttsn-sg-qv-main-arrow:hover {
	background: #2c6ecb;
	color: #fff;
}

.ttsn-sg-qv-main-arrow-prev {
	left: 14px;
}

.ttsn-sg-qv-main-arrow-next {
	right: 14px;
}

.ttsn-sg-qv-main-arrow svg {
	display: block;
	width: 45%;
	height: 45%;
}

/* ---------------- Thumbnail slider (pages + snaps, same as Product Image Pro) ---------------- */

.ttsn-sg-qv-thumbs-row {
	display: flex;
	align-items: center;
	gap: 6px;
}

.ttsn-sg-qv-thumbs-viewport {
	overflow: hidden;
	flex: 1 1 auto;
	min-width: 0;
}

.ttsn-sg-qv-thumbs-track {
	--ttsn-sg-qv-thumbs-visible: 5;
	--ttsn-sg-qv-thumb-gap: 8px;
	display: flex;
	gap: var(--ttsn-sg-qv-thumb-gap);
	transition: transform .3s ease;
	will-change: transform;
}

.ttsn-sg-qv-thumb-arrow {
	flex: 0 0 26px;
    width: 26px !important;
    height: 26px;
    border-radius: 50% !important;
    border: 1px solid #e2e2e2 !important;
    background: #fff;
    color: #333 !important;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0 !important;
}

/* Arrows only earn their place once the thumbnail row actually overflows —
   toggled by JS based on real scrollWidth vs clientWidth, not a fixed
   image count, so it stays correct at any modal width. */
.ttsn-sg-qv-thumbs-row.has-overflow .ttsn-sg-qv-thumb-arrow {
	display: flex;
}

.ttsn-sg-qv-thumb-arrow:disabled {
	opacity: .35;
	cursor: default;
	pointer-events: none;
}

.ttsn-sg-qv-thumb-arrow svg {
	width: 10px;
	height: 10px;
	display: block;
}

.ttsn-sg-qv-thumb-arrow-prev svg {
	transform: rotate(180deg);
}

.ttsn-sg-qv-thumb-arrow:hover:not(:disabled) {
	background: #2c6ecb;
	border-color: #2c6ecb;
	color: #fff !important;
}

.ttsn-sg-qv-thumb {
	position: relative;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 4px;
	overflow: hidden;
	cursor: pointer;
	background: #fff;
	opacity: .7;
	transition: opacity .15s ease, border-color .15s ease;
	flex: 0 0 calc((100% - (var(--ttsn-sg-qv-thumb-gap) * (var(--ttsn-sg-qv-thumbs-visible) - 1))) / var(--ttsn-sg-qv-thumbs-visible));
	width: calc((100% - (var(--ttsn-sg-qv-thumb-gap) * (var(--ttsn-sg-qv-thumbs-visible) - 1))) / var(--ttsn-sg-qv-thumbs-visible));
	aspect-ratio: 1 / 1;
}

.ttsn-sg-qv-thumb:hover {
	opacity: 1;
}

.ttsn-sg-qv-thumb.is-active {
	opacity: 1;
	border-color: #2c6ecb;
}

.ttsn-sg-qv-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.ttsn-sg-qv-details {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ttsn-sg-qv-title {
	margin: 0;
	font-size: 22px;
	line-height: 1.3;
}

.ttsn-sg-qv-price {
	font-size: 20px;
	font-weight: 600;
	color: #e0622f;
}

.ttsn-sg-qv-short-desc {
	font-size: 14px;
	line-height: 1.6;
	color: #444;
}

.ttsn-sg-qv-short-desc p:first-child {
	margin-top: 0;
}

.ttsn-sg-qv-cart-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 4px;
}

.ttsn-sg-qv-cart-row input{
    width: 122px !important;
    border-radius: 100px !important;
    border-color: #1A458A !important;
}

.ttsn-sg-qv-qty {
	width: 64px;
	padding: 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
}

.ttsn-sg-qv-add-cart {
	position: relative;
	background: #f2c94c;
	color: #1a1a1a;
	border: none !important;
	border-radius: 4px;
	padding: 12px 26px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: opacity .15s ease, background-color .15s ease;
}

.ttsn-sg-qv-add-cart:hover {
	opacity: .9;
}

.ttsn-sg-qv-add-cart.is-loading,
.ttsn-sg-qv-add-cart.is-disabled {
	opacity: .6;
	pointer-events: none;
}

.ttsn-sg-qv-add-cart.is-loading {
	color: transparent;
}

.ttsn-sg-qv-add-cart.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 16px;
	margin: -8px 0 0 -8px;
	border-radius: 50%;
	border: 2px solid rgba(0,0,0,.25);
	border-top-color: #1a1a1a;
	animation: ttsn-spin .7s linear infinite;
}

.ttsn-sg-qv-add-cart.is-added {
	background: #2fac66;
	color: #fff;
}

.ttsn-sg-qv-add-cart-check {
	font-size: 14px;
	line-height: 1;
}

.ttsn-sg-qv-meta {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 1px solid #eee;
	font-size: 13px;
	color: #7a7a7a;
}

.ttsn-sg-qv-meta a{
    color:#7a7a7a;
}

.ttsn-sg-qv-meta p {
	margin: 0 0 6px;
}

.ttsn-sg-qv-close {
	position: absolute;
    top: 14px;
    right: 14px;
    width: 32px !important;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50% !important;
    border: none !important;
    background: #f5f5f5 !important;
    color: #333 !important;
    line-height: 1;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    padding: 0;
}

.ttsn-sg-qv-close svg {
	display: block;
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
	stroke: currentColor;
}

.ttsn-sg-qv-close:hover {
	background: #1A458A !important;
	color: #fff !important;
}

/* ---------------- Grid Loading Style (Pagination / Load More / Infinite Scroll) ---------------- */

.ttsn-pg-grid-wrap {
	position: relative;
}

.ttsn-pg-grid-wrap.is-loading .ttsn-showcase,
.ttsn-pg-grid-wrap.is-loading .ttsn-sg-product-grid {
	opacity: .55;
	pointer-events: none;
	transition: opacity .15s ease;
}

.ttsn-pg-loader {
	display: none;
	justify-content: center;
	padding: 18px 0;
}

.ttsn-pg-grid-wrap.is-loading .ttsn-pg-loader {
	display: flex;
}

.ttsn-pg-spinner {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: 3px solid rgba(0,0,0,.12);
	border-top-color: #2c6ecb;
	animation: ttsn-spin .8s linear infinite;
}

.ttsn-pg-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 24px;
}

.ttsn-pg-page-btn {
	min-width: 38px;
	height: 38px;
	padding: 0 6px !important;
	border: 1px solid #e2e2e2!important;
	border-radius: 6px !important;
	background: #fff;
	color: #333;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.ttsn-pg-page-btn:hover {
	border-color: #2c6ecb;
}

.ttsn-pg-page-btn.is-active {
	background: #2c6ecb;
	border-color: #2c6ecb;
	color: #fff;
	cursor: default;
}

.ttsn-pg-ellipsis {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	color: #999;
	font-size: 14px;
	user-select: none;
}

.ttsn-pg-page-arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 34px;
	height: 34px;
	padding: 0 6px;
	border: 1px solid #e2e2e2;
	border-radius: 6px;
	background: #fff;
	color: #333;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.ttsn-pg-page-arrow:hover:not(:disabled) {
	border-color: #2c6ecb;
	color: #2c6ecb;
}

.ttsn-pg-page-arrow:disabled {
	opacity: .35;
	cursor: default;
	pointer-events: none;
}

.ttsn-pg-page-prev svg {
	transform: rotate(180deg);
}

.ttsn-pg-load-more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 24px;
}

.ttsn-pg-load-more {
	padding: 12px 32px;
	border: none;
	border-radius: 4px;
	background: #f2c94c;
	color: #1a1a1a;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity .15s ease;
}

.ttsn-pg-load-more:hover {
	opacity: .9;
}

.ttsn-pg-grid-wrap.is-loading .ttsn-pg-load-more {
	opacity: .6;
	pointer-events: none;
}

.ttsn-pg-infinite-sentinel {
	height: 1px;
}

@media (max-width: 767px) {
	.ttsn-sg-wrapper {
		flex-direction: column;
	}

	.ttsn-sg-sidebar {
		flex: 0 0 100%;
		max-width: 100%;
	}

	.ttsn-sg-qv-modal {
		grid-template-columns: 1fr;
		padding: 24px;
	}
}
