/**
 * Diamond Inventory frontend styles.
 *
 * Namespaced entirely under .diamond-store (spec §73) — no bare element
 * selectors are touched. Design tokens below are pulled directly from the
 * active "Pure Fashion" theme (wp-content/themes/pure-fashion/assets/sass/
 * _variables.scss, _settings.scss, shortcodes/_buttons.scss, _structure.scss)
 * so the pages read as part of the existing site rather than a bolted-on
 * plugin UI (spec §2.3, §73-§74).
 */

.diamond-store {
	--dia-accent: #424935;
	--dia-accent2: #9e524f;
	--dia-accent3: #f4ead5;
	--dia-black: #272525;
	--dia-body: #404b3b;
	--dia-border: rgba(66, 73, 53, 0.15);
	--dia-bg-soft: #faf9f6;
	--dia-font: 'system-ui', 'San Francisco', 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', Arial, sans-serif;
	font-family: var(--dia-font);
	color: var(--dia-body);
}

.diamond-store__header {
	padding: 30px 0 10px;
}
.diamond-store__title {
	text-align: center;
	color: var(--dia-accent);
	font-size: 28px;
	margin: 0 0 10px;
}

/* ---------------- Filters ---------------- */

.diamond-store__filters {
	background: var(--dia-bg-soft);
	border-radius: 6px;
	padding: 18px 0;
	margin-bottom: 16px;
}
.diamond-store__filter-form {
	padding: 0 20px;
}
.diamond-store__filter-group {
	margin-bottom: 14px;
}
.diamond-store__filter-label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 600;
	color: var(--dia-accent);
	margin-bottom: 8px;
}
.diamond-store__filter-label-zh {
	font-weight: 400;
	letter-spacing: 0.02em;
	text-transform: none;
	opacity: 0.75;
}
.diamond-store__filter-row {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
}
.diamond-store__filter-row .diamond-store__filter-group {
	flex: 1 1 160px;
}

.diamond-store__shape-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.diamond-store__shape {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	width: 68px;
	padding: 8px 4px;
	background: #fff;
	border: 1px solid var(--dia-border);
	border-radius: 4px;
	cursor: pointer;
	font-size: 10px;
	color: var(--dia-body);
	transition: border-color 0.2s, background 0.2s;
}
.diamond-store__shape:hover {
	border-color: var(--dia-accent);
}
.diamond-store__shape.is-active {
	background: var(--dia-accent);
	color: var(--dia-accent3);
	border-color: var(--dia-accent);
}
.diamond-store__shape-icon {
	width: 30px;
	height: 30px;
	color: var(--dia-body);
}
.diamond-store__shape.is-active .diamond-store__shape-icon {
	color: var(--dia-accent3);
}

/* ---------------- Filter value buttons (Carat, Colour, Clarity, Cut, -----
   Polish, Symmetry, Fluorescence) — every filter on this page, including
   Carat, is a plain clickable button group; none of them is a slider or
   any other draggable/steppable control, per explicit request. Carat's
   buttons are a single-select preset range (it sits in its own row via
   .diamond-store__filter-row--sliders-primary, using the plain flex-wrap
   layout below since it's the only filter in that row); the grade fields
   below it are multi-select, exactly like the Shape buttons above. -------- */

/* Grade fields (Colour/Clarity/Cut/Polish/Symmetry/Fluorescence): two-per-
   row on desktop, one-per-row on mobile, instead of the flex-wrap layout
   the base .diamond-store__filter-row uses. */
.diamond-store__filter-row--grades {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 18px 32px;
}
.diamond-store__filter-row--grades .diamond-store__filter-group {
	min-width: 0;
}
.diamond-store__filter-group--carat {
	grid-column: 1 / -1;
}
@media (max-width: 768px) {
	.diamond-store__filter-row--grades {
		grid-template-columns: 1fr;
	}
}

/* Carat manual range inputs — sit above the preset bucket buttons */
.diamond-store__carat-range {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin-bottom: 10px;
}
.diamond-store__carat-input-wrap {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.diamond-store__carat-range-label {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--dia-muted, #888);
}
.diamond-store__carat-field {
	display: flex;
	align-items: center;
	height: 44px;
	border: 1px solid rgba(66, 73, 53, 0.3);
	border-radius: 3px;
	background: #fff;
	overflow: hidden;
	transition: border-color 0.15s;
}
.diamond-store__carat-field:focus-within {
	border-color: var(--dia-black);
}
/* Use .diamond-store ancestor to raise specificity above the theme's
   input[type="number"] rule (0,1,1) which leaks border, height and
   margin-bottom into the compound field wrapper. */
.diamond-store .diamond-store__carat-input {
	width: 64px;
	padding: 8px 10px;
	border: none;
	outline: none;
	font-size: 12px;
	font-weight: 400;
	color: var(--dia-black);
	background: transparent;
	height: auto;
	margin-bottom: 0;
	-moz-appearance: textfield;
	-webkit-appearance: none;
	appearance: none;
}
.diamond-store .diamond-store__carat-input::-webkit-outer-spin-button,
.diamond-store .diamond-store__carat-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.diamond-store__carat-unit {
	padding: 0 8px 0 0;
	font-size: 11px;
	color: var(--dia-muted, #888);
	white-space: nowrap;
	pointer-events: none;
}
.diamond-store__carat-sep {
	font-size: 14px;
	color: var(--dia-muted, #888);
	padding-bottom: 7px;
}

.diamond-store__value-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.diamond-store__value-list.is-disabled {
	opacity: 0.55;
	pointer-events: none;
}
.diamond-store__value-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 7px 14px;
	border: 1px solid var(--dia-border);
	border-radius: 4px;
	background: #fff;
	color: var(--dia-body);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.diamond-store__value-chip:hover:not(:disabled) {
	border-color: var(--dia-accent);
}
.diamond-store__value-chip.is-active {
	background: var(--dia-accent);
	border-color: var(--dia-accent);
	color: var(--dia-accent3);
}
.diamond-store__value-chip:disabled {
	opacity: 0.35;
	cursor: default;
}

.diamond-store__filter-row--toggles {
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}
.diamond-store__filter-row--toggles .diamond-store__reset-filters {
	margin-left: auto;
}
.diamond-store__toggle-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.02em;
	padding: 8px 16px;
	border: 1px solid var(--dia-border);
	border-radius: 999px;
	background: #fff;
	color: var(--dia-body);
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.diamond-store__toggle-btn:hover {
	border-color: var(--dia-accent);
}
.diamond-store__toggle-btn.is-active {
	background: var(--dia-accent);
	border-color: var(--dia-accent);
	color: var(--dia-accent3);
}

.diamond-store__reset-filters {
	background: none;
	border: 1px solid var(--dia-accent);
	color: var(--dia-accent);
	border-radius: 4px;
	padding: 10px 26px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
}
.diamond-store__reset-filters:hover {
	background: var(--dia-accent);
	color: var(--dia-accent3);
}

/* ---------------- Toolbar ---------------- */

.diamond-store__toolbar {
	margin-bottom: 20px;
}
.diamond-store__toolbar-inner {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 20px;
	padding: 10px 0;
	border-bottom: 1px solid var(--dia-border);
}
.diamond-store__result-count {
	font-size: 14px;
	color: var(--dia-body);
}
.diamond-store__compare {
	font-size: 13px;
	color: var(--dia-accent);
	background: none;
	border: 1px solid var(--dia-border);
	border-radius: 4px;
	padding: 6px 12px;
	cursor: pointer;
}
.diamond-store__compare:hover:not(:disabled) {
	border-color: var(--dia-accent);
}
.diamond-store__compare:disabled {
	color: #aaa;
	cursor: default;
}
.diamond-store__sort {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
}
.diamond-store__sort select {
	height: 36px;
	border: 1px solid var(--dia-border);
	border-radius: 4px;
	padding: 0 8px;
}
.diamond-store__view-toggle {
	display: inline-flex;
	border: 1px solid var(--dia-border);
	border-radius: 4px;
	overflow: hidden;
	flex-shrink: 0;
}
.diamond-store__view-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 32px;
	background: #fff;
	border: 0;
	border-right: 1px solid var(--dia-border);
	color: var(--dia-body);
	cursor: pointer;
}
.diamond-store__view-btn:last-child {
	border-right: 0;
}
.diamond-store__view-btn svg {
	width: 16px;
	height: 16px;
}
.diamond-store__view-btn.is-active {
	background: var(--dia-accent);
	color: var(--dia-accent3);
}

/* ---------------- Result grid ---------------- */

.diamond-store__results {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 24px;
	margin-bottom: 20px;
}

/* List view — a real data table matching diamania.com.hk's own list layout
   (比較 形狀 克拉 顏色 淨度 切工 拋光 對稱 螢光 影像 GIA 證書 地點 港幣 願望清單),
   not the grid cards restyled; toggled via #diamond-store-view-grid/-list
   (frontend.js swaps the markup itself — renderTable()/renderRow()). */
.diamond-store__results--list {
	display: block;
}
.diamond-store__table-wrap {
	overflow-x: auto;
	border: 1px solid var(--dia-border);
	border-radius: 6px;
	margin-bottom: 20px;
}
.diamond-store__table {
	width: 100%;
	min-width: 920px;
	border-collapse: collapse;
	background: #fff;
	font-size: 12px;
}
.diamond-store__table th,
.diamond-store__table td {
	padding: 10px 12px;
	text-align: left;
	white-space: nowrap;
}
.diamond-store__table thead th {
	position: sticky;
	top: 0;
	background: var(--dia-accent);
	color: var(--dia-accent3);
	font-weight: 600;
	font-size: 11px;
}
.diamond-store__table tbody tr {
	border-top: 1px solid var(--dia-border);
}
.diamond-store__table tbody tr:hover {
	background: var(--dia-bg-soft);
}
.diamond-store__table-link {
	color: var(--dia-accent);
	font-weight: 600;
	text-decoration: none;
}
.diamond-store__table-link:hover {
	text-decoration: underline;
}
.diamond-store__table-media {
	font-size: 14px;
}
.diamond-store__table-media + .diamond-store__table-media {
	margin-left: 4px;
}
.diamond-store__table .diamond-store__compare-toggle {
	white-space: nowrap;
}
.diamond-store__card {
	border: 1px solid var(--dia-border);
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.2s, transform 0.2s;
	display: flex;
	flex-direction: column;
}
.diamond-store__card:hover {
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}
.diamond-store__card-link {
	color: inherit;
	text-decoration: none;
	display: block;
}
.diamond-store__card-link:hover {
	color: inherit;
}
.diamond-store__card-image {
	position: relative;
	aspect-ratio: 1 / 1;
	background: var(--dia-bg-soft);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.diamond-store__card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.diamond-store__card-noimage {
	font-size: 11px;
	color: #999;
	text-transform: uppercase;
}
.diamond-store__badge {
	position: absolute;
	top: 8px;
	left: 8px;
	background: var(--dia-accent);
	color: var(--dia-accent3);
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding: 3px 8px;
	border-radius: 3px;
}
.diamond-store__card-meta .diamond-store__badge {
	position: static;
	display: inline-block;
}
.diamond-store__card-body {
	padding: 14px;
	flex: 1;
}
.diamond-store__card-title {
	font-weight: 600;
	color: var(--dia-accent);
	margin-bottom: 6px;
}
.diamond-store__card-attrs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	font-size: 12px;
	color: #777;
	margin-bottom: 6px;
}
.diamond-store__card-attrs span:not(:last-child)::after {
	content: '\2022';
	margin-left: 6px;
	color: #ccc;
}
.diamond-store__card-cert {
	font-size: 11px;
	color: #999;
	margin-bottom: 6px;
}
.diamond-store__card-price {
	font-weight: 700;
	font-size: 16px;
	color: var(--dia-black);
}
.diamond-store__card-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 14px 14px;
}
.diamond-store__compare-toggle {
	background: none;
	border: 1px solid var(--dia-border);
	border-radius: 3px;
	font-size: 11px;
	padding: 4px 10px;
	cursor: pointer;
	color: var(--dia-body);
}
.diamond-store__compare-toggle.is-active {
	background: var(--dia-accent);
	color: var(--dia-accent3);
	border-color: var(--dia-accent);
}
.diamond-store__empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 0;
	color: #999;
}

.diamond-store__results.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.diamond-store__infinite-scroll {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 32px 0 48px;
	min-height: 1px;
}
.diamond-store__load-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid var(--dia-border);
	border-top-color: var(--dia-accent);
	border-radius: 50%;
	animation: diamond-store-spin 0.8s linear infinite;
}
@keyframes diamond-store-spin {
	to { transform: rotate(360deg); }
}
.diamond-store__load-end {
	margin: 0;
	color: #999;
	font-size: 13px;
}

/* ---------------- Compare modal ---------------- */

.diamond-store__compare-modal {
	position: fixed;
	inset: 0;
	z-index: 1100;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.diamond-store__compare-modal[hidden] {
	display: none;
}
.diamond-store__compare-modal-inner {
	position: relative;
	background: #fff;
	border-radius: 6px;
	max-width: 960px;
	width: 100%;
	max-height: 85vh;
	overflow: auto;
	padding: 40px 20px 20px;
}
.diamond-store__compare-modal-close {
	position: absolute;
	top: 10px;
	right: 14px;
	background: none;
	border: 0;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: var(--dia-body);
}
.diamond-store__compare-loading {
	text-align: center;
	padding: 40px 0;
	color: #999;
}
.diamond-store__compare-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}
.diamond-store__compare-table th,
.diamond-store__compare-table td {
	padding: 10px 14px;
	text-align: left;
	border-bottom: 1px solid var(--dia-border);
	white-space: nowrap;
}
.diamond-store__compare-table tbody th {
	color: #999;
	font-weight: 500;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
.diamond-store__compare-col {
	position: relative;
	min-width: 140px;
}
.diamond-store__compare-col img {
	width: 100px;
	height: 100px;
	object-fit: cover;
	border-radius: 4px;
	display: block;
}
.diamond-store__compare-noimage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100px;
	height: 100px;
	background: var(--dia-bg-soft);
	font-size: 10px;
	color: #999;
	text-transform: uppercase;
	border-radius: 4px;
}
.diamond-store__compare-remove {
	position: absolute;
	top: -6px;
	right: 6px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 1px solid var(--dia-border);
	background: #fff;
	cursor: pointer;
	font-size: 13px;
	line-height: 1;
}
.diamond-store__compare-link {
	color: var(--dia-accent);
	font-weight: 600;
	text-decoration: none;
}
.diamond-store__compare-link:hover {
	text-decoration: underline;
}

/* ---------------- Detail page ---------------- */

.diamond-store--detail .diamond-store__breadcrumb {
	padding: 16px 0;
	font-size: 13px;
}
.diamond-store__detail-main {
	padding-bottom: 30px;
}
.diamond-store__gallery-main {
	background: var(--dia-bg-soft);
	border-radius: 6px;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
}
.diamond-store__gallery-main img,
.diamond-store__gallery-main video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.diamond-store__gallery-main iframe {
	width: 100%;
	height: 100%;
	border: 0;
}
.diamond-store__gallery-thumbs {
	display: flex;
	gap: 8px;
	margin-top: 10px;
}
.diamond-store__gallery-thumb {
	width: 64px;
	height: 64px;
	border: 1px solid var(--dia-border);
	border-radius: 4px;
	overflow: hidden;
	padding: 0;
	cursor: pointer;
	background: var(--dia-bg-soft);
}
.diamond-store__gallery-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.diamond-store__detail-title {
	color: var(--dia-accent);
	font-size: 24px;
	margin-bottom: 6px;
}
.diamond-store__id {
	font-size: 12px;
	color: #999;
	margin-bottom: 16px;
}
.diamond-store__attr-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 20px;
}
.diamond-store__attr-table th,
.diamond-store__attr-table td {
	text-align: left;
	padding: 8px 4px;
	border-bottom: 1px solid var(--dia-border);
	font-size: 13px;
}
.diamond-store__attr-table th {
	color: #777;
	font-weight: 500;
	width: 45%;
}
.diamond-store__attr-table td {
	color: var(--dia-black);
	font-weight: 600;
}

.diamond-store__price {
	font-size: 28px;
	font-weight: 700;
	color: var(--dia-black);
	margin: 10px 0;
}
.diamond-store__availability {
	display: flex;
	gap: 10px;
	align-items: center;
	margin-bottom: 20px;
}
.diamond-store__status {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding: 4px 10px;
	border-radius: 3px;
}
.diamond-store__status--available {
	background: rgba(66, 73, 53, 0.12);
	color: var(--dia-accent);
}
.diamond-store__status--unavailable {
	background: rgba(158, 82, 79, 0.12);
	color: var(--dia-accent2);
}

.diamond-store__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	margin-bottom: 10px;
}
.diamond-store__detail-sections {
	padding: 20px 0;
	border-top: 1px solid var(--dia-border);
}
.diamond-store__detail-sections h2 {
	font-size: 16px;
	color: var(--dia-accent);
	margin-bottom: 12px;
}

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

@media (max-width: 1068px) {
	.diamond-store__results {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {
	.diamond-store__results {
		grid-template-columns: repeat(2, 1fr);
		gap: 14px;
	}
	.diamond-store__filters {
		border-top: 1px solid #e0e0e0;
		border-bottom: 1px solid #e0e0e0;
		margin-bottom: 12px;
	}
	.diamond-store__sort {
		margin-left: 0;
	}
	.diamond-store__detail-main .columns {
		margin-bottom: 20px;
	}
}
