/* ==========================================================================
   TG Loyalty System — public + admin styles
   v1.0.0 | https://traderzglobal.com
   ========================================================================== */

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.tg-loyalty-wrap {
	max-width: 680px;
	margin: 0 auto;
	padding: 0 0 2rem;
	font-family: inherit;
	box-sizing: border-box;
}

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

/* ── Card scene / flip ───────────────────────────────────────────────────── */
.tg-lc-card-scene {
	perspective: 1200px;
	margin: 0 auto 8px;
	max-width: 380px;
	height: 220px;
}

.tg-lc-card {
	position: relative;
	width: 100%;
	height: 100%;
	cursor: pointer;
	transform-style: preserve-3d;
	transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
	border-radius: 14px;
	outline: none;
}

.tg-lc-card:focus-visible {
	box-shadow: 0 0 0 3px #4c4af4;
}

.tg-lc-card.is-flipped {
	transform: rotateY(180deg);
}

.tg-lc-face {
	position: absolute;
	inset: 0;
	border-radius: 14px;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
	overflow: hidden;
	border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Card front */
.tg-lc-front {
	display: flex;
	flex-direction: column;
}

.tg-lc-front-top {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: 16px 20px 14px;
	flex: 0 0 58%;
}

.tg-lc-front-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 10px;
}

.tg-lc-points-label {
	display: block;
	font-size: 11px;
	opacity: 0.85;
	margin-bottom: 3px;
	letter-spacing: 0.3px;
}

.tg-lc-points-value {
	display: block;
	font-size: 30px;
	font-weight: 700;
	line-height: 1;
}

.tg-lc-brand-name {
	display: block;
	font-size: 13px;
	font-weight: 600;
}

.tg-lc-brand-sub {
	display: block;
	font-size: 10px;
	opacity: 0.8;
	text-align: right;
}

.tg-lc-tier-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 12px;
	border: 1px solid currentColor;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.5px;
	align-self: flex-start;
}

/* Card front — white bottom */
.tg-lc-front-bottom {
	flex: 1;
	background: #ffffff;
	padding: 12px 20px 14px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}

.tg-lc-card-number {
	font-family: 'Courier New', Courier, monospace;
	font-size: 14px;
	letter-spacing: 3px;
	color: #888;
}

.tg-lc-front-meta {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
}

.tg-lc-meta-label {
	display: block;
	font-size: 9px;
	letter-spacing: 1px;
	color: #aaa;
	margin-bottom: 2px;
}

.tg-lc-meta-value {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #222;
}

/* Card back */
.tg-lc-back {
	background: #ffffff;
	transform: rotateY(180deg);
}

.tg-lc-back-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
	gap: 10px;
	padding: 16px;
}

/* Copyable code on card back */
.tg-lc-code-label {
	font-size: 9px;
	color: #bbb;
	letter-spacing: 1.5px;
	text-align: center;
}

.tg-lc-code-value {
	font-family: 'Courier New', Courier, monospace;
	font-size: 14px;
	font-weight: 700;
	color: #111;
	background: #f5f5f5;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	padding: 7px 14px;
	letter-spacing: 1.5px;
	text-align: center;
	user-select: all;
}

.tg-lc-copy-btn {
	padding: 7px 16px;
	background: #111;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
	white-space: nowrap;
}

.tg-lc-copy-btn:hover {
	background: #333;
}

.tg-lc-copy-btn.copied {
	background: #1e6e34;
}

.tg-lc-copy-msg {
	font-size: 12px;
	font-weight: 600;
	color: #1e6e34;
	min-height: 16px;
	display: block;
	text-align: center;
}

.tg-lc-back-pts {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding-top: 10px;
	border-top: 1px solid #f0f0f0;
	width: 100%;
}

.tg-lc-back-pts-num {
	font-size: 20px;
	font-weight: 700;
	color: #111;
	line-height: 1;
}

.tg-lc-back-pts-label {
	font-size: 10px;
	color: #bbb;
	letter-spacing: 0.8px;
	text-transform: uppercase;
}

/* Flip hint */
.tg-lc-flip-hint {
	text-align: center;
	font-size: 13px;
	color: #aaa;
	margin: 0 0 22px;
}

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.tg-lc-stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	margin-bottom: 14px;
}

.tg-lc-stat {
	background: #f7f7f7;
	border-radius: 8px;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.tg-lc-stat-label {
	font-size: 11px;
	color: #999;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.tg-lc-stat-value {
	font-size: 17px;
	font-weight: 700;
	color: #111;
	line-height: 1.2;
}

/* ── Progress ────────────────────────────────────────────────────────────── */
.tg-lc-progress-box {
	background: #fff;
	border: 1px solid #e8e8e8;
	border-radius: 10px;
	padding: 14px 18px;
	margin-bottom: 14px;
}

.tg-lc-max-tier {
	display: flex;
	align-items: center;
	gap: 14px;
}

.tg-lc-max-icon {
	font-size: 28px;
	line-height: 1;
	flex-shrink: 0;
}

.tg-lc-max-tier strong {
	display: block;
	font-size: 14px;
	color: #111;
	margin-bottom: 3px;
}

.tg-lc-max-tier p {
	font-size: 13px;
	color: #888;
	margin: 0;
}

.tg-lc-progress-header {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	font-weight: 600;
	color: #333;
	margin-bottom: 8px;
}

.tg-lc-progress-bar {
	height: 7px;
	background: #f0f0f0;
	border-radius: 99px;
	overflow: hidden;
	margin-bottom: 8px;
}

.tg-lc-progress-fill {
	height: 100%;
	border-radius: 99px;
	transition: width 0.6s ease;
	min-width: 4px;
}

.tg-lc-progress-hint {
	font-size: 12px;
	color: #aaa;
	margin: 0;
}

/* ── Two-col ─────────────────────────────────────────────────────────────── */
.tg-lc-two-col {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 12px;
	margin-bottom: 12px;
}

/* ── Box ─────────────────────────────────────────────────────────────────── */
.tg-lc-box {
	background: #fff;
	border: 1px solid #e8e8e8;
	border-radius: 10px;
	padding: 16px 18px;
}

.tg-lc-box-title {
	font-size: 14px;
	font-weight: 700;
	color: #111;
	margin: 0 0 12px;
	padding: 0;
	border: none;
	background: none;
}

.tg-lc-empty {
	font-size: 13px;
	color: #bbb;
	margin: 0;
}

/* ── Transaction list ────────────────────────────────────────────────────── */
.tg-lc-tx-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tg-lc-tx-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 0;
	border-bottom: 1px solid #f2f2f2;
}

.tg-lc-tx-row:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.tg-lc-tx-icon {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 700;
	flex-shrink: 0;
}

.tg-lc-tx-earn  { color: #1e6e34; background: #e6f4eb; }
.tg-lc-tx-redeem { color: #a93226; background: #fdecea; }

.tg-lc-tx-details {
	flex: 1;
	min-width: 0;
}

.tg-lc-tx-note {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #111;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tg-lc-tx-date {
	display: block;
	font-size: 11px;
	color: #bbb;
	margin-top: 1px;
}

.tg-lc-tx-pts {
	font-size: 13px;
	font-weight: 700;
	flex-shrink: 0;
}

/* ── Benefits ────────────────────────────────────────────────────────────── */
.tg-lc-benefits {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tg-lc-benefit-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #444;
	padding: 5px 0;
}

.tg-lc-benefit-check {
	font-size: 15px;
	font-weight: 700;
	flex-shrink: 0;
}

/* ── Tier overview grid ──────────────────────────────────────────────────── */
.tg-lc-tiers-box {
	margin-bottom: 14px;
}

.tg-lc-tiers-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
	gap: 10px;
}

.tg-lc-tier-card {
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	overflow: hidden;
	transition: border-color 0.2s;
}

.tg-lc-tier-current {
	border: 2px solid #222;
}

.tg-lc-tier-header {
	padding: 8px 12px;
	font-size: 12px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: space-between;
	letter-spacing: 0.3px;
}

.tg-lc-tier-you {
	font-size: 10px;
	font-weight: 700;
	opacity: 0.9;
}

.tg-lc-tier-body {
	padding: 8px 12px;
	background: #fff;
}

.tg-lc-tier-pts {
	display: block;
	font-size: 12px;
	color: #444;
	font-weight: 600;
}

.tg-lc-tier-mult {
	display: block;
	font-size: 11px;
	color: #aaa;
	margin-top: 2px;
}

/* ── Checkout redemption form ────────────────────────────────────────────── */
.tg-loyalty-checkout {
	background: #fffbf0;
	border: 1px solid #f0d890;
	border-radius: 8px;
	padding: 14px 16px;
	margin-bottom: 20px;
}

/* Header */
.tg-loyalty-header {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 10px;
}

.tg-loyalty-icon {
	font-size: 16px;
	line-height: 1;
}

.tg-loyalty-title {
	font-size: 14px;
	font-weight: 700;
	color: #111;
}

/* Balance row */
.tg-loyalty-balance-row {
	font-size: 13px;
	color: #555;
	margin-bottom: 10px;
}

.tg-loyalty-balance-row strong {
	color: #111;
}

/* One-click apply button */
#tg-loyalty-apply-all {
	display: block;
	width: 100%;
	padding: 11px 16px;
	background: #111;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	text-align: center;
	transition: background 0.15s;
	margin-bottom: 6px;
}

#tg-loyalty-apply-all:hover:not(:disabled) {
	background: #2a2a2a;
}

#tg-loyalty-apply-all:disabled {
	opacity: 0.6;
	cursor: default;
}

#tg-loyalty-msg {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: #a93226;
	min-height: 16px;
	margin-bottom: 4px;
}

/* Applied state */
.tg-loyalty-applied {
	background: #e8f8ed;
	border: 1px solid #a8ddb8;
	border-radius: 6px;
	padding: 10px 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.tg-loyalty-applied-info {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tg-loyalty-applied-check {
	width: 24px;
	height: 24px;
	background: #1e6e34;
	color: #fff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 700;
	flex-shrink: 0;
}

.tg-loyalty-applied-info strong {
	display: block;
	font-size: 13px;
	color: #1e6e34;
	font-weight: 700;
}

.tg-loyalty-applied-sub {
	display: block;
	font-size: 11px;
	color: #5a9e6e;
	margin-top: 1px;
}

.tg-loyalty-remove-link {
	font-size: 12px;
	color: #a93226;
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
}

.tg-loyalty-remove-link:hover {
	text-decoration: underline;
}

/* Custom amount (collapsed) */
.tg-loyalty-custom-wrap {
	margin-top: 4px;
}

.tg-loyalty-custom-toggle {
	background: none;
	border: none;
	padding: 0;
	font-size: 12px;
	color: #999;
	cursor: pointer;
	text-decoration: none;
}

.tg-loyalty-custom-toggle:hover {
	color: #555;
}

.tg-loyalty-redeem-form {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	padding-top: 8px;
}

.tg-loyalty-redeem-form label {
	font-size: 13px;
	font-weight: 600;
	color: #333;
}

.tg-loyalty-redeem-form input[type="number"] {
	width: 100px;
	padding: 6px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 13px;
	color: #111;
}

.tg-loyalty-redeem-form input[type="number"]:focus {
	outline: none;
	border-color: #888;
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08);
}

#tg-loyalty-apply {
	padding: 6px 14px;
	background: #555;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s;
}

#tg-loyalty-apply:hover:not(:disabled) {
	background: #333;
}

#tg-loyalty-apply:disabled {
	opacity: 0.6;
	cursor: default;
}

/* ── Admin — reused badge style ──────────────────────────────────────────── */
.tg-lc-admin-tier-badge {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.3px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.tg-lc-stats {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 420px) {
	.tg-lc-card-scene {
		max-width: 100%;
		height: 200px;
	}

	.tg-lc-front-top {
		padding: 12px 16px 10px;
	}

	.tg-lc-points-value {
		font-size: 24px;
	}

	.tg-lc-tiers-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.tg-lc-stats {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}
}
