/**
 * Gold & Silver Rate Manager — Frontend CSS.
 * Scoped under .gsrm-wrap to avoid theme conflicts.
 *
 * @package GoldSilverRateManager
 */

/* ── Wrapper ────────────────────────────────────────────────── */
.gsrm-wrap {
	--gsrm-accent: #B8860B;
	--gsrm-up: #16A34A;
	--gsrm-down: #DC2626;
	--gsrm-bg: #fff;
	--gsrm-text: #1f2937;
	--gsrm-border: #e5e7eb;
	--gsrm-radius: 10px;

	max-width: 100%;
	font-family: inherit;
	color: var(--gsrm-text);
	line-height: 1.5;
	box-sizing: border-box;
}

.gsrm-wrap *,
.gsrm-wrap *::before,
.gsrm-wrap *::after {
	box-sizing: inherit;
}

/* ── Title ──────────────────────────────────────────────────── */
.gsrm-wrap .gsrm-title {
	font-size: 1.25em;
	font-weight: 700;
	margin: 0 0 12px;
	color: var(--gsrm-text);
}

/* ── Scroll wrapper (mobile overflow) ───────────────────────── */
.gsrm-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ── Table ──────────────────────────────────────────────────── */
.gsrm-wrap .gsrm-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	border-radius: var(--gsrm-radius);
	overflow: hidden;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
	background: var(--gsrm-bg);
	margin-bottom: 16px;
	font-variant-numeric: tabular-nums;
}

.gsrm-wrap .gsrm-table caption {
	caption-side: top;
}

/* ── Header ─────────────────────────────────────────────────── */
.gsrm-wrap .gsrm-table thead th {
	background: var(--gsrm-accent);
	color: #fff;
	font-weight: 700;
	font-size: 0.875em;
	padding: 12px 14px;
	text-align: center;
	border: none;
	white-space: nowrap;
}

.gsrm-wrap .gsrm-table thead th:first-child {
	text-align: left;
}

/* ── Body cells ─────────────────────────────────────────────── */
.gsrm-wrap .gsrm-table tbody th,
.gsrm-wrap .gsrm-table tbody td {
	padding: 10px 14px;
	border-bottom: 1px solid var(--gsrm-border);
	font-size: 0.9em;
	text-align: center;
	vertical-align: middle;
	color: var(--gsrm-text);
	background: var(--gsrm-bg);
	border-left: none;
	border-right: none;
	border-top: none;
}

.gsrm-wrap .gsrm-table tbody th {
	text-align: left;
	font-weight: 600;
	white-space: nowrap;
}

/* Zebra striping */
.gsrm-wrap .gsrm-table tbody tr:nth-child(even) td,
.gsrm-wrap .gsrm-table tbody tr:nth-child(even) th {
	background: #fafafa;
}

/* Hover */
.gsrm-wrap .gsrm-table tbody tr:hover td,
.gsrm-wrap .gsrm-table tbody tr:hover th {
	background: #fef9ee;
}

/* Last row — no border */
.gsrm-wrap .gsrm-table tbody tr:last-child td,
.gsrm-wrap .gsrm-table tbody tr:last-child th {
	border-bottom: none;
}

/* ── Change indicators ──────────────────────────────────────── */
.gsrm-wrap .gsrm-change {
	display: inline-block;
	font-size: 0.8em;
	font-weight: 600;
	padding: 1px 5px;
	border-radius: 3px;
	white-space: nowrap;
}

.gsrm-wrap .gsrm-up {
	color: var(--gsrm-up);
}

.gsrm-wrap .gsrm-down {
	color: var(--gsrm-down);
}

.gsrm-wrap .gsrm-flat {
	color: #6b7280;
}

/* ── Summary cards ──────────────────────────────────────────── */
.gsrm-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 12px;
	margin-bottom: 20px;
}

.gsrm-card-summary {
	background: var(--gsrm-bg);
	border: 1px solid var(--gsrm-border);
	border-radius: var(--gsrm-radius);
	padding: 14px 16px;
	text-align: center;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.gsrm-card-summary .gsrm-card-label {
	display: block;
	font-size: 0.8em;
	font-weight: 600;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
}

.gsrm-card-summary .gsrm-card-price {
	display: block;
	font-size: 1.4em;
	font-weight: 700;
	color: var(--gsrm-text);
	font-variant-numeric: tabular-nums;
}

.gsrm-card-summary .gsrm-card-change {
	display: block;
	margin-top: 4px;
}

/* ── Footer ─────────────────────────────────────────────────── */
.gsrm-footer {
	margin-top: 8px;
}

.gsrm-wrap .gsrm-updated {
	font-size: 0.8em;
	color: #6b7280;
	margin: 0 0 4px;
}

.gsrm-wrap .gsrm-disclaimer {
	font-size: 0.75em;
	color: #9ca3af;
	margin: 0;
	font-style: italic;
}

/* ── No data ────────────────────────────────────────────────── */
.gsrm-wrap .gsrm-no-data {
	padding: 20px;
	text-align: center;
	color: #6b7280;
	font-style: italic;
}

/* ── Style: minimal ─────────────────────────────────────────── */
.gsrm-style-minimal .gsrm-table {
	box-shadow: none;
	border: 1px solid var(--gsrm-border);
}

.gsrm-style-minimal .gsrm-table thead th {
	background: #f9fafb;
	color: var(--gsrm-text);
}

.gsrm-style-minimal .gsrm-card-summary {
	box-shadow: none;
}

/* ── Style: dark ────────────────────────────────────────────── */
.gsrm-style-dark {
	--gsrm-bg: #1e293b;
	--gsrm-text: #f1f5f9;
	--gsrm-border: #334155;
}

.gsrm-style-dark .gsrm-table thead th {
	background: #0f172a;
	color: #fbbf24;
}

.gsrm-style-dark .gsrm-table tbody tr:nth-child(even) td,
.gsrm-style-dark .gsrm-table tbody tr:nth-child(even) th {
	background: #263249;
}

.gsrm-style-dark .gsrm-table tbody tr:hover td,
.gsrm-style-dark .gsrm-table tbody tr:hover th {
	background: #334155;
}

.gsrm-style-dark .gsrm-card-summary {
	background: #1e293b;
	border-color: #334155;
}

/* ── Mobile: sticky first column ────────────────────────────── */
@media screen and (max-width: 600px) {
	.gsrm-wrap .gsrm-table thead th:first-child,
	.gsrm-wrap .gsrm-table tbody th:first-child {
		position: sticky;
		left: 0;
		z-index: 1;
		background: inherit;
	}

	.gsrm-wrap .gsrm-table thead th:first-child {
		background: var(--gsrm-accent);
	}

	.gsrm-style-dark .gsrm-table thead th:first-child {
		background: #0f172a;
	}

	.gsrm-wrap .gsrm-table thead th,
	.gsrm-wrap .gsrm-table tbody td,
	.gsrm-wrap .gsrm-table tbody th {
		font-size: 0.8em;
		padding: 8px 10px;
	}

	.gsrm-card-summary .gsrm-card-price {
		font-size: 1.15em;
	}
}

/* ── Print ──────────────────────────────────────────────────── */
@media print {
	.gsrm-wrap .gsrm-table {
		box-shadow: none;
	}

	.gsrm-card-summary {
		box-shadow: none;
	}

	.gsrm-ticker--scroll .gsrm-ticker__track {
		animation: none;
	}

	.gsrm-ticker--scroll .gsrm-ticker__list[aria-hidden="true"] {
		display: none;
	}
}

/* ── Ticker Strip ([gsrm_ticker]) ───────────────────────────── */
.gsrm-ticker {
	display: flex;
	align-items: center;
	white-space: nowrap;
	font-family: inherit;
	font-size: inherit;
	color: var(--gsrm-text);
	box-sizing: border-box;
	line-height: 1.5;
	padding: 4px 0;
	width: 100%;
}

/* Alignments */
.gsrm-ticker--align-left {
	justify-content: flex-start;
}

.gsrm-ticker--align-center {
	justify-content: center;
}

.gsrm-ticker--align-right {
	justify-content: flex-end;
}

/* Label & Date */
.gsrm-ticker__label {
	font-weight: 700;
	margin-right: 12px;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.gsrm-ticker__date {
	font-weight: 400;
	font-size: 0.9em;
	opacity: 0.8;
}

.gsrm-ticker__nodata {
	color: #6b7280;
	font-size: 0.9em;
	font-style: italic;
}

/* Track */
.gsrm-ticker__track {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
}

/* List & Items */
.gsrm-ticker__list {
	display: inline-flex;
	align-items: center;
	list-style: none;
	margin: 0;
	padding: 0;
	white-space: nowrap;
}

.gsrm-ticker__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.gsrm-ticker__name {
	font-weight: 600;
}

.gsrm-ticker__price {
	font-weight: 700;
}

/* Change Badges inside Ticker */
.gsrm-ticker .gsrm-change,
.gsrm-ticker .gsrm-badge {
	display: inline-flex;
	align-items: center;
	font-size: 0.8em;
	font-weight: 600;
	padding: 1px 4px;
	border-radius: 3px;
	white-space: nowrap;
}

.gsrm-ticker .gsrm-up,
.gsrm-ticker .gsrm-badge--up {
	color: var(--gsrm-up);
}

.gsrm-ticker .gsrm-down,
.gsrm-ticker .gsrm-badge--down {
	color: var(--gsrm-down);
}

.gsrm-ticker .gsrm-flat,
.gsrm-ticker .gsrm-badge--flat {
	color: #6b7280;
}

/* ── Separators (CSS ::before) ──────────────────────────────── */
.gsrm-ticker--sep-dot .gsrm-ticker__item:not(:first-child)::before,
.gsrm-ticker--sep-dot .gsrm-ticker__list[aria-hidden="true"] .gsrm-ticker__item:first-child::before {
	content: "•";
	margin: 0 var(--gsrm-ticker-gap, 12px);
	color: var(--gsrm-ticker-sep-color, var(--gsrm-border));
	opacity: 0.85;
}

.gsrm-ticker--sep-pipe .gsrm-ticker__item:not(:first-child)::before,
.gsrm-ticker--sep-pipe .gsrm-ticker__list[aria-hidden="true"] .gsrm-ticker__item:first-child::before {
	content: "|";
	margin: 0 var(--gsrm-ticker-gap, 12px);
	color: var(--gsrm-ticker-sep-color, var(--gsrm-border));
	opacity: 0.85;
}

.gsrm-ticker--sep-none .gsrm-ticker__item::before {
	content: none;
}

.gsrm-ticker--sep-none .gsrm-ticker__item {
	margin-right: calc(var(--gsrm-ticker-gap, 12px) * 1.33);
}

/* ── Static Mode ────────────────────────────────────────────── */
.gsrm-ticker--static {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.gsrm-ticker--static::-webkit-scrollbar {
	display: none;
}

/* ── Scroll (Marquee) Mode ──────────────────────────────────── */
.gsrm-ticker--scroll {
	overflow: hidden;
}

.gsrm-ticker--scroll .gsrm-ticker__track {
	width: max-content;
	animation: gsrm-marquee var(--gsrm-ticker-duration, 25s) linear infinite;
	will-change: transform;
}

.gsrm-ticker--scroll:hover .gsrm-ticker__track,
.gsrm-ticker--scroll:focus-within .gsrm-ticker__track {
	animation-play-state: paused;
}

@keyframes gsrm-marquee {
	0% {
		transform: translateX(0);
	}
	100% {
		transform: translateX(-50%);
	}
}

/* Prefers-reduced-motion: disable scroll, fall back to static scrollable */
@media (prefers-reduced-motion: reduce) {
	.gsrm-ticker--scroll {
		overflow-x: auto;
		scrollbar-width: none;
	}
	.gsrm-ticker--scroll::-webkit-scrollbar {
		display: none;
	}
	.gsrm-ticker--scroll .gsrm-ticker__track {
		animation: none;
		width: auto;
	}
	.gsrm-ticker--scroll .gsrm-ticker__list[aria-hidden="true"] {
		display: none;
	}
}

/* Dark style adjustments for ticker */
.gsrm-style-dark .gsrm-ticker__nodata {
	color: #94a3b8;
}

.gsrm-style-dark .gsrm-ticker .gsrm-flat,
.gsrm-style-dark .gsrm-ticker .gsrm-badge--flat {
	color: #94a3b8;
}

/* ── Chart ([gsrm_chart]) ───────────────────────────────────── */
.gsrm-chart {
	background: var(--gsrm-bg);
	border: 1px solid var(--gsrm-border);
	border-radius: var(--gsrm-radius);
	padding: 18px 20px 14px;
	margin: 0 0 16px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	box-sizing: border-box;
	max-width: 100%;
}

.gsrm-chart__title {
	font-size: 1.1em;
	font-weight: 700;
	margin: 0 0 12px;
	color: var(--gsrm-text);
	text-align: left;
}

.gsrm-chart__svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.gsrm-chart__grid {
	stroke: var(--gsrm-border);
	stroke-width: 1;
	stroke-dasharray: 3 3;
	opacity: 0.7;
}

.gsrm-chart__line {
	fill: none;
	stroke: var(--gsrm-accent);
	stroke-width: var(--gsrm-chart-line-width, 2.5);
	stroke-linecap: round;
	stroke-linejoin: round;
}

.gsrm-chart__point {
	fill: #fff;
	stroke: var(--gsrm-accent);
	stroke-width: 2;
	cursor: pointer;
	r: var(--gsrm-chart-point-radius, 4px);
	transition: r 0.15s ease, fill 0.15s ease;
}

.gsrm-chart__point:hover {
	r: 5.5;
	fill: var(--gsrm-accent);
}

.gsrm-chart__point--up {
	stroke: var(--gsrm-up);
}

.gsrm-chart__point--up:hover {
	fill: var(--gsrm-up);
}

.gsrm-chart__point--down {
	stroke: var(--gsrm-down);
}

.gsrm-chart__point--down:hover {
	fill: var(--gsrm-down);
}

.gsrm-chart__point--flat {
	stroke: #6b7280;
}

.gsrm-chart__point--flat:hover {
	fill: #6b7280;
}

.gsrm-chart__text {
	fill: var(--gsrm-text);
	font-family: inherit;
	font-size: 11px;
	user-select: none;
}

.gsrm-chart__text--muted {
	fill: #6b7280;
	font-size: 10px;
}

.gsrm-chart__nodata {
	color: #6b7280;
	font-size: 0.9em;
	font-style: italic;
	margin: 16px 0;
	text-align: center;
}

/* Style variants */
.gsrm-style-minimal.gsrm-chart {
	box-shadow: none;
}

.gsrm-style-dark.gsrm-chart {
	background: #1e293b;
	border-color: #334155;
}

.gsrm-style-dark .gsrm-chart__point {
	fill: #1e293b;
}

.gsrm-style-dark .gsrm-chart__text {
	fill: #f1f5f9;
}

.gsrm-style-dark .gsrm-chart__text--muted {
	fill: #94a3b8;
}

.gsrm-style-dark .gsrm-chart__nodata {
	color: #94a3b8;
}

.gsrm-style-dark .gsrm-chart__point--flat {
	stroke: #94a3b8;
}

.gsrm-style-dark .gsrm-chart__point--flat:hover {
	fill: #94a3b8;
}

@media print {
	.gsrm-chart {
		box-shadow: none;
		border-color: #ccc;
	}
}

/* ─────────────────────────────────────────────────────────────
   6. Customer Price Calculator [gsrm_calculator]
   ───────────────────────────────────────────────────────────── */

.gsrm-calc {
	background: var(--gsrm-bg, #fff);
	border: 1px solid var(--gsrm-border, #e5e7eb);
	border-radius: var(--gsrm-radius, 10px);
	padding: 24px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	box-sizing: border-box;
}

.gsrm-calc .gsrm-title {
	margin-top: 0;
	margin-bottom: 4px;
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--gsrm-text, #1f2937);
}

.gsrm-calc__asof {
	font-size: 0.85rem;
	color: #6b7280;
	margin: 0 0 18px 0;
}

.gsrm-calc__layout {
	display: flex;
	gap: var(--gsrm-calc-gap, 24px);
	flex-wrap: wrap;
	align-items: flex-start;
}

.gsrm-calc__inputs {
	flex: 1 1 260px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.gsrm-calc__output {
	flex: 1 1 280px;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.gsrm-calc__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.gsrm-calc__field label {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--gsrm-text, #1f2937);
}

.gsrm-calc__field input,
.gsrm-calc__field select {
	width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	border: 1px solid var(--gsrm-border, #d1d5db);
	border-radius: 6px;
	font-size: 1rem;
	background: var(--gsrm-bg, #fff);
	color: var(--gsrm-text, #1f2937);
	box-sizing: border-box;
	font-family: inherit;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gsrm-calc__field input:focus,
.gsrm-calc__field select:focus {
	outline: none;
	border-color: var(--gsrm-accent, #B8860B);
	box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.15);
}

.gsrm-calc__placeholder {
	background: #f9fafb;
	border: 1px dashed var(--gsrm-border, #d1d5db);
	border-radius: 8px;
	padding: 32px 16px;
	text-align: center;
	color: #6b7280;
	font-size: 0.95rem;
}

.gsrm-calc__placeholder p {
	margin: 0;
}

.gsrm-calc__breakdown {
	margin: 0;
	padding: 16px 20px;
	background: #f9fafb;
	border: 1px solid var(--gsrm-border, #e5e7eb);
	border-radius: 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	box-sizing: border-box;
}

.gsrm-calc__row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-size: 0.925rem;
	margin: 0;
}

.gsrm-calc__row dt {
	color: #4b5563;
	font-weight: 500;
	margin: 0;
}

.gsrm-calc__row dd {
	margin: 0;
	font-weight: 600;
	color: var(--gsrm-text, #1f2937);
}

.gsrm-calc__lbl-making,
.gsrm-calc__lbl-gst {
	font-size: 0.8em;
	color: #6b7280;
	font-weight: normal;
}

.gsrm-calc__row--subtotal {
	padding-top: 10px;
	border-top: 1px solid var(--gsrm-border, #e5e7eb);
}

.gsrm-calc__row--total {
	padding-top: 12px;
	margin-top: 4px;
	border-top: 2px solid var(--gsrm-border, #e5e7eb);
	font-size: 1.15rem;
	font-weight: 700;
}

.gsrm-calc__row--total dt {
	color: var(--gsrm-accent, #B8860B);
	font-weight: 700;
}

.gsrm-calc__row--total dd {
	color: var(--gsrm-accent, #B8860B);
	font-size: 1.35rem;
	font-weight: 700;
}

.gsrm-calc__noscript {
	background: #fffbeb;
	border: 1px solid #fde68a;
	color: #92400e;
	padding: 12px 16px;
	border-radius: 6px;
	margin-bottom: 16px;
	font-size: 0.9rem;
}

.gsrm-calc__noscript p {
	margin: 4px 0;
}

/* ── Minimal Variant ── */
.gsrm-style-minimal.gsrm-calc {
	box-shadow: none;
	border-color: var(--gsrm-border, #e5e7eb);
}

.gsrm-style-minimal .gsrm-calc__breakdown {
	background: #fff;
	border-color: var(--gsrm-border, #e5e7eb);
}

/* ── Dark Variant ── */
.gsrm-style-dark.gsrm-calc {
	background: #1e293b;
	border-color: #334155;
	color: #f1f5f9;
}

.gsrm-style-dark .gsrm-calc .gsrm-title {
	color: #f8fafc;
}

.gsrm-style-dark .gsrm-calc__asof {
	color: #94a3b8;
}

.gsrm-style-dark .gsrm-calc__field label {
	color: #f1f5f9;
}

.gsrm-style-dark .gsrm-calc__field input,
.gsrm-style-dark .gsrm-calc__field select {
	background: #0f172a;
	border-color: #334155;
	color: #f8fafc;
}

.gsrm-style-dark .gsrm-calc__placeholder {
	background: #0f172a;
	border-color: #334155;
	color: #94a3b8;
}

.gsrm-style-dark .gsrm-calc__breakdown {
	background: #0f172a;
	border-color: #334155;
}

.gsrm-style-dark .gsrm-calc__row dt {
	color: #94a3b8;
}

.gsrm-style-dark .gsrm-calc__row dd {
	color: #f8fafc;
}

.gsrm-style-dark .gsrm-calc__lbl-making,
.gsrm-style-dark .gsrm-calc__lbl-gst {
	color: #64748b;
}

.gsrm-style-dark .gsrm-calc__row--subtotal {
	border-top-color: #334155;
}

.gsrm-style-dark .gsrm-calc__row--total {
	border-top-color: #475569;
}

/* ── Responsive ── */
@media screen and (max-width: 520px) {
	.gsrm-calc {
		padding: 16px;
	}
	.gsrm-calc__layout {
		flex-direction: column;
		gap: 20px;
	}
	.gsrm-calc__inputs,
	.gsrm-calc__output {
		flex: 1 1 100%;
		width: 100%;
	}
}

/* ── Print ── */
@media print {
	.gsrm-calc {
		box-shadow: none;
		border: 1px solid #999;
	}
	.gsrm-calc__inputs,
	.gsrm-calc__placeholder {
		display: none !important;
	}
	.gsrm-calc__output,
	.gsrm-calc__results {
		display: block !important;
		width: 100%;
	}
}



