/* ===== ویجت قیمت طلا و سکه ===== */
#gpw-cards, #gpw-calc, #gpw-chartcard {
	direction: rtl;
	font-family: "iransans", sans-serif;
	--gpw-gold: #d4af37;
	--gpw-gold-dark: #b8912c;
	--gpw-green: #16a34a;
	--gpw-red: #c0392b;
	--gpw-border: #e7e5e4;
	--gpw-muted: #78716c;
	--gpw-ink: #1c1917;
	--gpw-teal: #016B6B;
	--gpw-teal-dark: #0f5750;
	--gpw-teal-light: #dcece7;
	--gpw-cream: #EFEBE2;
	--gpw-cream-2: #EFEBE2;
	box-sizing: border-box;
}
#gpw-cards *, #gpw-calc *, #gpw-chartcard * { box-sizing: border-box; }

/* ---------- نوار قیمت‌های لحظه‌ای ---------- */
.gpw-band {
	background: var(--gpw-cream);
	border-radius: 22px;
	padding: 28px 24px;
	margin: 24px 0;
}
.gpw-band__title {
	text-align: center;
	font-size: 20px;
	font-weight: 800;
	color: #4a463d;
	margin: 0 0 22px;
}
.gpw-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 16px;
}
.gpw-card {
	background: #fff;
	border-radius: 16px;
	padding: 26px 16px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(0,0,0,0.05);
	transition: box-shadow .2s ease, transform .2s ease;
	/* بدون این، اعداد قیمت طولانی (بدون فاصله) عرض ستون گرید را از محتوا بزرگ‌تر می‌کنند
	   و باعث سرریز افقی و بریده‌شدن کارت‌ها در موبایل می‌شوند */
	min-width: 0;
}
.gpw-card:hover {
	box-shadow: 0 8px 22px rgba(0,0,0,0.08);
	transform: translateY(-2px);
}
.gpw-card__icon {
	width: 62px;
	height: 62px;
	margin: 0 auto 16px;
	display: flex;
	align-items: center;
	justify-content: center;
}
/* دلار آزاد: دایره سبزآبی با علامت دلار */
.gpw-icon-usd {
	border-radius: 50%;
	background: linear-gradient(180deg, #3a8f80, #1f6f63);
	color: #eafff9;
	font-size: 26px;
	font-weight: 700;
	box-shadow: inset 0 -3px 6px rgba(0,0,0,0.15);
}
/* انس جهانی طلا: شمش طلا با آیکون کره */
.gpw-icon-globebar {
	width: 46px;
	height: 60px;
	border-radius: 6px;
	background: linear-gradient(135deg, #f4d675, var(--gpw-gold-dark));
	border: 1px solid #a67c1e;
}
.gpw-globe {
	display: block;
	width: 22px;
	height: 22px;
	margin: 19px auto 0;
	border-radius: 50%;
	border: 2px solid rgba(255,255,255,0.85);
	position: relative;
	background:
		linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)) center / 100% 2px no-repeat,
		linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)) center / 2px 100% no-repeat;
}
/* سکه امامی: سکه طلایی */
.gpw-icon-coin {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: radial-gradient(circle at 32% 30%, #f6dd8c, var(--gpw-gold-dark) 78%);
	border: 1px solid #a67c1e;
	box-shadow: inset 0 -4px 8px rgba(0,0,0,0.15);
}
/* طلا ۱۸ عیار: شمش با نوشته GOLD 18k */
.gpw-icon-goldbar {
	width: 50px;
	height: 62px;
	border-radius: 6px;
	background: linear-gradient(135deg, #f4d675, var(--gpw-gold-dark));
	border: 1px solid #a67c1e;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
}
.gpw-icon-goldbar span {
	font-size: 8px;
	font-weight: 700;
	color: #6b4f10;
	letter-spacing: 0.5px;
}

.gpw-card__title {
	font-size: 14px;
	font-weight: 700;
	margin-bottom: 8px;
	color: #727272;
}

.gpw-card__price {
	font-size: 17px;
	font-weight: 700;
	color: var(--gpw-ink);
	/* اجازه شکستن خط برای اعداد بلند در عرض‌های خیلی باریک */
	overflow-wrap: anywhere;
}
.gpw-card__change {
	font-size: 13px;
	color: var(--gpw-green);
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 6px;
}
.gpw-card__change.is-down { color: var(--gpw-red); }
.gpw-card__change.is-down .gpw-arrow { transform: rotate(180deg); }
.gpw-arrow { font-size: 10px; }

/* موبایل: به‌جای شکستن به چند ردیف، کارت‌ها به‌صورت افقی اسکرول می‌شوند */
@media (max-width: 640px) {
	.gpw-band { padding: 18px 0 18px 14px; border-radius: 16px; }
	.gpw-band__title { padding: 0 14px; }
	.gpw-cards {
		display: flex;
		grid-template-columns: unset;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scroll-snap-type: x mandatory;
		gap: 12px;
		padding: 2px 14px 8px;
		margin: 0 -14px;
		scrollbar-width: thin;
	}
	.gpw-cards::-webkit-scrollbar { height: 5px; }
	.gpw-cards::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 10px; }
	.gpw-card {
		flex: 0 0 auto;
		width: 46vw;
		max-width: 190px;
		scroll-snap-align: start;
		padding: 20px 10px;
	}
}
@media (max-width: 360px) {
	.gpw-card { width: 60vw; }
}

/* ---------- کارت نمودار قیمت (سوییچ آیتم + بازه زمانی) ---------- */
.gpw-chartcard {
	background: var(--gpw-cream-2);
	border-radius: 22px;
	padding: 24px;
	margin: 24px 0;
	max-width: 1180px;
}

/* دو ستون در دسکتاپ: نمودار سمت چپ، تب‌ها/قیمت سمت راست (مطابق ماک‌آپ) */
.gpw-chartcard__grid {
	display: grid;
	grid-template-columns: 1fr 1.35fr;
	grid-template-areas: "side chart";
	gap: 32px;
	align-items: stretch;
}
.gpw-chart-col {
	grid-area: chart;
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.gpw-side-col {
	grid-area: side;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.gpw-item-tabs {
	display: flex;
	background: #fff;
	border-radius: 999px;
	padding: 5px;
	gap: 4px;
	margin-bottom: 14px;
}
.gpw-item-tab {
	flex: 1;
	border: none;
	background: transparent;
	padding: 10px 0;
	border-radius: 999px !important;
	cursor: pointer;
	font-size: 14px;
	color: var(--gpw-muted);
	font-weight: 600;
	transition: background .15s ease, color .15s ease;
	white-space: nowrap;
}
.gpw-item-tab.is-active {
	background: var(--gpw-teal);
	color: #fff;
}

/* بلوک قیمت سمت راست: روی دسکتاپ وسط‌چین عمودی، زیر تب‌ها */

.gpw-price-block {
	text-align: center;
}
.gpw-price-row__label {
	display: block;
	font-size: 14px;
	color: #016B6B;
	margin-bottom: 14px;
}
.gpw-price-row {
	display: flex;
	align-items: baseline;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
}
.gpw-price-row__value {
	font-size: 34px;
	font-weight: 800;
	color: var(--gpw-teal-dark);
	line-height: 1;
	overflow-wrap: anywhere;
}
.gpw-price-badge {
	background: var(--gpw-teal-light);
	color: var(--gpw-teal-dark);
	font-size: 13px;
	font-weight: 700;
	border-radius: 999px;
	padding: 6px 12px;
	display: inline-flex;
	align-items: center;
	gap: 3px;
	direction: ltr;
}
.gpw-price-badge.is-down { background: #f7dedb; color: var(--gpw-red); }
.gpw-price-badge.is-down .gpw-price-badge__arrow { transform: rotate(90deg); }

.gpw-chart-wrap { position: relative; background: transparent; flex: 1; min-height: 260px; min-width: 0; }
.gpw-chart-tooltip {
	position: absolute;
	background: #fff;
	border-radius: 10px;
	padding: 8px 14px;
	box-shadow: 0 4px 14px rgba(0,0,0,0.1);
	font-size: 12px;
	pointer-events: none;
	transform: translate(-50%, -115%);
	white-space: nowrap;
	text-align: center;
}
.gpw-chart-tooltip__price { font-weight: 700; color: var(--gpw-ink); }
.gpw-chart-tooltip__time { color: var(--gpw-muted); margin-top: 2px; }

.gpw-minmax-row {
	display: flex;
	justify-content: center;
	gap: 10px;
	font-size: 13px;
	color: var(--gpw-red);
	font-weight: 600;
	margin: 14px 0 18px;
	flex-wrap: wrap;
}
.gpw-minmax-row .gpw-minmax:not(:last-child)::after {
	content: "|";
	margin-right: 10px;
	color: var(--gpw-border);
	font-weight: 400;
}

.gpw-period-tabs {
	display: flex;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
}
.gpw-period-tab {
	border: 1.5px solid transparent;
	background: transparent;
	color: var(--gpw-muted);
	font-size: 13px;
	padding: 8px 18px;
	border-radius: 999px !important;
	cursor: pointer;
}
.gpw-period-tab.is-active {
	background: #fff;
	outline-color: var(--gpw-teal);
	color: var(--gpw-teal-dark);
	font-weight: 700;
	outline:1px solid;
}
.gpw-price-label{
	color: #016B6B;
}
/* زیر ۹۰۰ پیکسل: به حالت تک‌ستونه (تب‌ها بالا، نمودار پایین) برمی‌گردد */
@media (max-width: 900px) {
	.gpw-chartcard__grid {
		grid-template-columns: 1fr;
		grid-template-areas: "side" "chart";
		gap: 18px;
	}
	.gpw-price-row__value { font-size: 26px; }
}

@media (max-width: 480px) {
	.gpw-chartcard { padding: 14px; border-radius: 16px; }
	.gpw-item-tab { font-size: 12px; padding: 9px 0; }
	.gpw-period-tab { padding: 7px 12px; font-size: 12px; }
	.gpw-price-row__value { font-size: 22px; }
}
@media (min-width: 900px) {
	.gpw-side-col{
		gap:86px;
	}
}

/* ---------- ماشین‌حساب (شورت‌کد اختیاری قدیمی) ---------- */
.gpw-calc {
	display: grid;
	grid-template-columns: 1.4fr 1fr;
	gap: 16px;
	background: #fff;
	border: 1px solid var(--gpw-border);
	border-radius: 14px;
	padding: 20px;
	margin: 24px 0;
}
@media (max-width: 820px) {
	.gpw-calc { grid-template-columns: 1fr; }
}
.gpw-calc__chart-box { border-left: 1px solid var(--gpw-border); padding-left: 20px; }
@media (max-width: 820px) {
	.gpw-calc__chart-box { border-left: none; padding-left: 0; border-bottom: 1px solid var(--gpw-border); padding-bottom: 16px; }
}
.gpw-tabs {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-bottom: 14px;
}
.gpw-tab {
	border: 1px solid var(--gpw-border);
	background: #fafaf9;
	color: var(--gpw-muted);
	font-size: 13px;
	padding: 6px 16px;
	border-radius: 20px;
	cursor: pointer;
}
.gpw-tab.is-active {
	background: #ecfdf5;
	border-color: var(--gpw-green);
	color: var(--gpw-green);
}
.gpw-calc .gpw-chart-wrap { position: relative; }
.gpw-calc .gpw-chart-tooltip {
	border: 1px solid var(--gpw-border);
}
.gpw-calc .gpw-chart-tooltip__time { direction: ltr; text-align: right; }

.gpw-calc__title { margin: 0 0 14px; font-size: 16px; }
.gpw-direction-tabs {
	display: flex;
	background: #fafaf9;
	border-radius: 10px;
	padding: 4px;
	margin-bottom: 18px;
}
.gpw-dir {
	flex: 1;
	border: none;
	background: transparent;
	padding: 8px 0;
	border-radius: 8px;
	cursor: pointer;
	color: var(--gpw-muted);
	font-size: 14px;
}
.gpw-dir.is-active {
	background: #fff;
	color: var(--gpw-ink);
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
	font-weight: 600;
}
.gpw-label { display: block; font-size: 13px; color: var(--gpw-muted); margin-bottom: 6px; }
.gpw-input-row { margin-bottom: 14px; }
.gpw-input-row input {
	width: 100%;
	border: 1px solid var(--gpw-border);
	border-radius: 10px;
	padding: 12px 14px;
	font-size: 14px;
	direction: rtl;
}
.gpw-input-row input:focus { outline: none; border-color: var(--gpw-gold); }
.gpw-live-price {
	font-size: 13px;
	color: var(--gpw-muted);
	margin-bottom: 16px;
}
.gpw-live-price__value { color: var(--gpw-gold-dark); font-weight: 700; }
.gpw-submit {
	width: 100%;
	border: none;
	border-radius: 10px;
	padding: 14px 0;
	font-size: 15px;
	font-weight: 700;
	color: #3a2c05;
	cursor: pointer;
	background: linear-gradient(180deg, #e6c256, var(--gpw-gold-dark));
	transition: filter .2s ease;
}
.gpw-submit:hover { filter: brightness(1.05); }
.gpw-submit:disabled { opacity: .6; cursor: not-allowed; }
