/* ==========================================================================
   AM Devices - Catalog: category / shop archive + single product
   WooCommerce core CSS is not loaded on these pages (see am_wc_core_styles).
   Product cards live in theme.css.
   ========================================================================== */

/* ---------- Breadcrumb ---------- */

.am-breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
	margin: 0 0 28px;
	padding-top: 28px;
	color: var(--am-text-soft);
	font-family: var(--am-font-heading);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.5;
}

.am-breadcrumb a {
	color: var(--am-text);
}

.am-breadcrumb a:hover {
	color: var(--am-primary);
}

.am-breadcrumb__sep {
	color: var(--am-muted);
}

/* ---------- Notices ---------- */

.am-shop .woocommerce-message,
.am-shop .woocommerce-info,
.am-shop .woocommerce-error,
.am-single .woocommerce-message,
.am-single .woocommerce-info,
.am-single .woocommerce-error {
	margin: 0 0 24px;
	padding: 14px 18px;
	border: 1px solid var(--am-border);
	border-left: 4px solid var(--am-primary);
	border-radius: var(--am-radius-sm);
	background: var(--am-primary-soft);
	list-style: none;
}

.am-shop .woocommerce-error,
.am-single .woocommerce-error {
	border-left-color: var(--am-danger);
	background: rgba(214, 59, 59, 0.06);
}

.woocommerce-notices-wrapper:empty {
	display: none;
}

/* ==========================================================================
   Archive (category / shop / product search)
   ========================================================================== */

.am-shop {
	padding-bottom: 72px;
}

.am-shop__head {
	margin-bottom: 24px;
}

.am-shop__title {
	margin: 0;
	font-size: clamp(26px, 3vw, 36px);
}

.am-shop__head .term-description,
.am-shop__head .page-description {
	max-width: 900px;
	margin-top: 10px;
	color: var(--am-text-soft);
}

.am-shop__head .term-description p:last-child {
	margin-bottom: 0;
}

.am-shop__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--am-border);
}

.am-shop__toolbar .woocommerce-notices-wrapper {
	flex: 1 1 100%;
	order: -1;
}

.am-shop__count {
	margin: 0;
	color: var(--am-text-soft);
	font-size: 15px;
}

.woocommerce-ordering {
	margin: 0;
}

.woocommerce-ordering select {
	width: auto;
	min-width: 220px;
	min-height: 44px;
	padding: 8px 40px 8px 14px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23272727' stroke-width='1.6' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

/* Load More */
.am-shop__more {
	display: flex;
	justify-content: center;
	margin-top: 44px;
}

.am-loadmore {
	min-width: 200px;
}

.am-loadmore__spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: am-spin 0.75s linear infinite;
}

.am-loadmore.is-loading {
	pointer-events: none;
	cursor: wait;
}

.am-loadmore.is-loading .am-loadmore__spinner {
	display: inline-block;
}

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

/* ==========================================================================
   Single product
   ========================================================================== */

.am-single {
	padding-bottom: 72px;
}

.am-single div.product {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) 260px;
	align-items: start;
	gap: 40px 32px;
}

.am-single div.product > * {
	grid-column: 1 / -1;
	min-width: 0;
}

.am-single div.product > .woocommerce-product-gallery {
	grid-column: 1;
	grid-row: 1;
}

.am-single div.product > .summary {
	grid-column: 2;
	grid-row: 1;
}

.am-single div.product > .am-features {
	grid-column: 3;
	grid-row: 1;
}

/* Sale badge */
.am-single span.onsale {
	position: absolute;
	top: 12px;
	right: auto;
	left: 64px;
	z-index: 6;
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--am-primary);
	color: #fff;
	font-family: var(--am-font-heading);
	font-size: 13px;
	font-weight: 600;
}

/* ---------- Gallery ---------- */

.woocommerce-product-gallery {
	position: relative;
	margin: 0;
}

.woocommerce-product-gallery__wrapper {
	margin: 0;
}

.woocommerce-product-gallery__image {
	overflow: hidden;
	border-radius: var(--am-radius-sm);
	background: #fff;
}

.woocommerce-product-gallery__image a {
	display: block;
}

.woocommerce-product-gallery__image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
}

.woocommerce-product-gallery__trigger {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 10px rgba(39, 39, 39, 0.12);
	font-size: 16px;
	line-height: 1;
	text-decoration: none;
}

.woocommerce-product-gallery__trigger img {
	display: none !important;
}

.woocommerce-product-gallery .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.woocommerce-product-gallery .flex-control-thumbs img {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	padding: 4px;
	border: 1px solid var(--am-border);
	border-radius: var(--am-radius-sm);
	object-fit: contain;
	opacity: 0.6;
	cursor: pointer;
	transition: opacity 0.2s, border-color 0.2s;
}

.woocommerce-product-gallery .flex-control-thumbs img:hover,
.woocommerce-product-gallery .flex-control-thumbs img.flex-active {
	border-color: var(--am-primary);
	opacity: 1;
}

/* ---------- Summary ---------- */

.am-single .product_title {
	margin: 0 0 14px;
	font-size: clamp(22px, 2.1vw, 26px);
	font-weight: 600;
	line-height: 1.3;
}

.am-single .woocommerce-product-details__short-description {
	margin-bottom: 18px;
	color: var(--am-text);
	font-size: 16px;
}

.am-single .woocommerce-product-details__short-description p:last-child {
	margin-bottom: 0;
}

.am-single__price {
	margin: 0 0 22px;
	color: var(--am-primary);
	font-family: var(--am-font-heading);
	font-size: clamp(28px, 2.6vw, 36px);
	font-weight: 700;
	line-height: 1.2;
}

.am-single__price del {
	margin-right: 8px;
	color: var(--am-muted);
	font-size: 0.6em;
	font-weight: 500;
}

.am-single__price ins {
	text-decoration: none;
}

/* Specs table */
.am-specs {
	width: 100%;
	margin: 0 0 32px;
	border-collapse: collapse;
	font-size: 15px;
}

.am-specs th,
.am-specs td {
	padding: 12px 14px;
	border: 1px solid var(--am-border-strong);
	text-align: left;
	vertical-align: top;
}

.am-specs th {
	width: 40%;
	color: var(--am-heading);
	font-family: var(--am-font-heading);
	font-weight: 600;
}

.am-specs tr:first-child th,
.am-specs tr:first-child td {
	background: var(--am-primary-soft);
}

.am-specs td {
	color: var(--am-text);
	overflow-wrap: anywhere;
}

/* Quote */
.am-quote__text {
	margin: 0 0 20px;
	font-size: 16px;
	line-height: 1.5;
}

.am-quote__text strong,
.am-quote__text a {
	color: var(--am-primary);
	font-family: var(--am-font-heading);
	font-weight: 600;
}

.am-quote .am-btn {
	min-width: 170px;
}

/* ---------- Feature boxes ---------- */

.am-features {
	padding: 18px 10px;
	border-radius: var(--am-radius-sm);
	background: var(--am-primary-soft);
}

.am-features__list {
	display: grid;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.am-features__item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 8px;
}

.am-features__icon {
	flex: 0 0 44px;
	color: var(--am-primary);
}

.am-features__title {
	display: block;
	color: var(--am-heading);
	font-family: var(--am-font-heading);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.3;
}

.am-features__text {
	display: block;
	color: var(--am-text-soft);
	font-size: 13px;
	line-height: 1.4;
}

/* ---------- Tabs ---------- */

.woocommerce-tabs {
	margin-top: 32px;
}

.woocommerce-tabs ul.tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	border-bottom: 2px solid var(--am-border);
	list-style: none;
}

.woocommerce-tabs ul.tabs li {
	margin: 0 0 -2px;
}

.woocommerce-tabs ul.tabs li a {
	display: block;
	padding: 14px 20px;
	border-bottom: 3px solid transparent;
	color: var(--am-text);
	font-family: var(--am-font-heading);
	font-size: 17px;
	font-weight: 500;
}

.woocommerce-tabs ul.tabs li.active a,
.woocommerce-tabs ul.tabs li a:hover {
	border-bottom-color: var(--am-primary);
	color: var(--am-primary);
}

.woocommerce-tabs .panel {
	padding-top: 28px;
	overflow-wrap: break-word;
}

.woocommerce-tabs .panel > *:last-child {
	margin-bottom: 0;
}

.woocommerce-tabs .panel table {
	width: 100%;
	border-collapse: collapse;
}

.woocommerce-tabs .panel th,
.woocommerce-tabs .panel td {
	padding: 10px 12px;
	border: 1px solid var(--am-border);
	text-align: left;
}

/* ---------- Related / upsells ---------- */

.am-single .related,
.am-single .upsells {
	margin-top: 56px;
}

.am-single .related > h2,
.am-single .upsells > h2 {
	margin: 0 0 22px;
	font-size: clamp(24px, 2.4vw, 32px);
	font-weight: 500;
}

/* ---------- Responsive ---------- */

@media (max-width: 1200px) {
	.am-single div.product {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}

	.am-single div.product > .am-features {
		grid-column: 1 / -1;
		grid-row: auto;
	}

	.am-features__list {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (max-width: 991px) {
	.am-features__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.am-breadcrumb {
		margin-bottom: 20px;
		padding-top: 18px;
		font-size: 13px;
	}

	.am-single div.product {
		grid-template-columns: minmax(0, 1fr);
		gap: 28px;
	}

	.am-single div.product > .woocommerce-product-gallery,
	.am-single div.product > .summary {
		grid-column: 1;
		grid-row: auto;
	}

	.am-shop__toolbar {
		align-items: stretch;
	}

	.woocommerce-ordering,
	.woocommerce-ordering select {
		width: 100%;
	}

	.woocommerce-tabs ul.tabs li a {
		padding: 12px 14px;
		font-size: 16px;
	}

	.am-quote .am-btn {
		width: 100%;
	}
}

@media (max-width: 420px) {
	.am-features__list {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (prefers-reduced-motion: reduce) {
	.am-loadmore__spinner {
		animation-duration: 2s;
	}
}
