/* Reward Points for WooCommerce Styles */

.spar-earn-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 20px;
	margin-bottom: 0px;
}

.spar-redeem-grid,
.spar-tiers {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 20px;
	margin-bottom: 40px;
}

body .page .spar-rewards-dashboard .spar-redeem-title {
	margin-bottom: 15px;
	margin-top: 0;
}

body .page .spar-rewards-dashboard .spar-redeem-intro {
	margin-bottom: 20px;
}

.spar-box, .spar-tier-box {
	border: 1px solid #ccc;
	border-radius: 10px;
	padding: 20px;
	text-align: center;
	background: #fff;
	box-shadow: 0 0 5px rgba(0,0,0,0.05);
}

.spar-box-full {
	border: 1px solid #ccc;
	border-radius: 10px;
	padding: 20px;
	background: #fff;
	box-shadow: 0 0 5px rgba(0,0,0,0.05);
	display: flex;
	justify-content: space-between;
	align-items: center;
	text-align: left;
}

/* Ways-to-earn: left icon style */
.spar-earn-grid .spar-box-full { position: relative; padding-left: 68px; }
.spar-earn-grid .spar-earn-fa-icon {
	position: absolute;
	left: 20px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 28px;
	width: 36px; /* reserve width so text has extra space to the right of icon */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	opacity: 0.98;
}

/* Gradient fill for the icon using theme colors */
.spar-earn-grid .spar-earn-fa-icon i {
	background: linear-gradient(135deg, var(--spar-theme-color-1, #007cba), var(--spar-theme-color-2, #005a87));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

@media (max-width: 768px) {
	.spar-earn-grid .spar-box-full {
		padding-left: 58px;
		flex-wrap: wrap;
	}
	.spar-earn-grid .spar-box-full > div:first-child {
		width: 100%;
		margin-bottom: 5px;
	}
	.spar-earn-grid .spar-box-full .spar-points-info {
		width: 100%;
		text-align: left;
	}
	.spar-earn-grid .spar-earn-fa-icon {
		left: 16px;
		font-size: 24px;
		width: 28px;
		top: 20px;
		transform: none;
	}
}

/* Wrapper for referral system with connected elements */
.spar-referral-wrapper {
	border: 1px solid #ccc;
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 0 5px rgba(0,0,0,0.05);
	overflow: hidden;
}

/* Special styling for boxes that have a referral system below them */
.spar-box-full.has-referral-system {
	border: none;
	border-bottom: 1px solid #e0e0e0;
	border-radius: 0;
	box-shadow: none;
	margin-bottom: 0 !important;
}

.spar-box-full .spar-points-info {
	font-size: 17px;
	color: var(--spar-theme-accent-color, #2ca58d);
	font-weight: bold;
	text-align: right;
}

.spar-progress-bar {
	height: 10px;
	background: #eee;
	border-radius: 5px;
	margin: 10px 0 25px 0;
	overflow: hidden;
}

.spar-redeem-grid .spar-progress-bar span {
	display: block;
	height: 100%;
	background: var(--spar-theme-accent-color, #2ca58d);
	transition: width 0.4s ease;
}

.spar-redeem-grid .spar-box h4 {
	margin-top: 0;
	font-size: 16px;
	font-weight: 600;
}

.spar-redeem-grid .spar-box .button {
	background: var(--spar-theme-accent-color, #2ca58d);
	color: #fff;
	border: none;
	padding: 10px 15px;
	border-radius: 5px;
	cursor: pointer;
	font-size: 14px;
	transition: background 0.3s ease;
}

.spar-redeem-grid .spar-box.spar-can-redeem {
	background: #f0f8ff;
	border-color: var(--spar-theme-accent-color, #2ca58d);
}

.spar-redeem-grid .spar-box p {
	margin: 10px 0;
}

/* Modern Table Styling */
table.spar-points-log,
.spar-tier-box table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
	border: 0;
	margin: 20px 0;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Table Header */
table.spar-points-log thead {
	background: linear-gradient(135deg, #ededed 0%, #f1f1f1 100%);
	color: #000;
}

table.spar-points-log th {
	padding: 18px 20px;
	text-align: left;
	font-weight: 600;
	font-size: 14px;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	border: none;
	position: relative;
}

table.spar-points-log th:not(:last-child)::after {
	content: '';
	position: absolute;
	right: 0;
	top: 25%;
	height: 50%;
	width: 1px;
	background: rgba(255, 255, 255, 0.2);
}

/* Table Body */
table.spar-points-log tbody {
	background: #fff;
}

table.spar-points-log td {
	padding: 16px 20px;
	border: none;
	border-bottom: 1px solid #f1f3f4;
	text-align: left;
	font-size: 14px;
	line-height: 1.5;
	color: #2c3e50;
	vertical-align: top;
}

/* Alternating row colors */
table.spar-points-log tbody tr:nth-child(even) {
	background: #f8f9fa;
}

/* Hover effect */
table.spar-points-log tbody tr:hover {
	background: #e3f2fd;
	transform: translateY(-1px);
	transition: all 0.2s ease;
}

/* Remove border from last row */
table.spar-points-log tbody tr:last-child td {
	border-bottom: none;
}

/* Action column links styling */
table.spar-points-log td a {
	color: #667eea;
	text-decoration: none;
	font-weight: 500;
	transition: color 0.2s ease;
}

table.spar-points-log td a:hover {
	color: #5a6fd8;
	text-decoration: underline;
}

/* Points values styling */
table.spar-points-log td:nth-child(2) {
	font-weight: 600;
}

/* Date column styling */
table.spar-points-log td:nth-child(3) {
	color: #6c757d;
	font-size: 13px;
}

/* Code elements within table */
table.spar-points-log code {
	background: #f1f3f4;
	border: 1px solid #e1e5e9;
	border-radius: 4px;
	padding: 2px 6px;
	font-size: 12px;
	color: #e83e8c;
}

/* Responsive table styling */
@media (max-width: 768px) {
	table.spar-points-log {
		font-size: 12px;
		margin: 15px 0;
	}
	
	table.spar-points-log th,
	table.spar-points-log td {
		padding: 12px 8px;
	}
	
	table.spar-points-log th {
		font-size: 12px;
	}
	
	/* Stack table content on very small screens */
	@media (max-width: 480px) {
		table.spar-points-log,
		table.spar-points-log thead,
		table.spar-points-log tbody,
		table.spar-points-log th,
		table.spar-points-log td,
		table.spar-points-log tr {
			display: block;
		}
		
		table.spar-points-log thead tr {
			position: absolute;
			top: -9999px;
			left: -9999px;
		}
		
		table.spar-points-log tr {
			background: #fff;
			border: 1px solid #e1e5e9;
			border-radius: 8px;
			margin-bottom: 10px;
			padding: 15px;
			box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
		}
		
		table.spar-points-log td {
			border: none;
			border-bottom: 1px solid #f1f3f4;
			position: relative;
			padding: 8px 0 8px 40%;
			text-align: right;
		}
		
		table.spar-points-log td:before {
			position: absolute;
			left: 0;
			width: 35%;
			padding-right: 10px;
			white-space: nowrap;
			font-weight: 600;
			color: #667eea;
			text-align: left;
		}

		table.spar-points-log .spar-apply-to-cart-btn {
			display: block;
			width: 100%;
			margin-top: 10px;
			float: none;
			text-align: center;
		}
		
		table.spar-points-log td:last-child {
			border-bottom: none;
		}
	}
}

.spar-points-total {
	font-size: 25px;
	margin-bottom: 20px;
	display: inline-block;
}

.spar-redeem-cost {
	font-size: 18px;
	color: var(--spar-theme-accent-color, #2ca58d);
	font-weight: bold;
	margin-top: 10px;
}

/* Points History Pagination Styles */
.spar-pagination {
	margin: 20px 0;
	text-align: center;
}

.spar-pagination-controls {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 5px;
	flex-wrap: wrap;
}

.spar-pagination-btn {
	background: #fff;
	border: 1px solid #ddd;
	color: #333;
	padding: 8px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	text-decoration: none;
	transition: all 0.2s ease;
	min-width: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.spar-pagination-btn:hover:not([disabled]) {
	background: #f0f0f0;
	border-color: #999;
	transform: translateY(-1px);
}

.spar-pagination-btn:active:not([disabled]) {
	transform: translateY(0);
}

.spar-pagination-btn[disabled] {
	background: #f5f5f5;
	color: #999;
	cursor: not-allowed;
	opacity: 0.6;
}

.spar-pagination-current {
	background: #007cba !important;
	color: #fff !important;
	border-color: #007cba !important;
	font-weight: 600;
}

.spar-pagination-current:hover {
	background: #005a87 !important;
	border-color: #005a87 !important;
}

.spar-pagination-info {
	color: #666;
	font-size: 14px;
	margin-bottom: 10px;
}

.spar-pagination-loading {
	display: none;
	margin-top: 10px;
	color: #007cba;
	font-weight: 500;
}

/* Levels & badges (frontend) */
.spar-level-badge-img { width:24px; height:24px; vertical-align: middle; }
.spar-level-badge-icon { font-size:24px; vertical-align: middle; }
.spar-level-progress-bar { background:#e9ecef; border-radius:10px; height:6px; margin:8px 0; overflow:hidden; }
.spar-level-progress-fill { background: linear-gradient(90deg, #007cba, #005a87); height:100%; transition: width 0.3s ease; }
.spar-level-next { display:flex; justify-content:space-between; align-items:center; font-size:11px; color:#6c757d; }
.spar-level-max { text-align:center; color:#007cba; font-weight:600; margin:8px 0; font-size:12px; }

/* Points history ajax table helpers */
.spar-row-even { background:#f8f9fa; }
.spar-row-odd { background:#fff; }
.spar-points-pos { color:#28a745; font-weight:600; text-align:center; }
.spar-points-neg { color:#dc3545; font-weight:600; text-align:center; }
.spar-date { text-align:center; color:#6c757d; font-size:13px; }
.spar-empty td { padding:20px; text-align:center; color:#6c757d; font-style:italic; }

/* Responsive pagination */
@media (max-width: 768px) {
	.spar-pagination-btn {
		padding: 6px 8px;
		font-size: 12px;
		min-width: 32px;
	}
	
	.spar-pagination-controls {
		gap: 2px;
	}
	
	.spar-pagination-info {
		font-size: 12px;
	}
}

@media (max-width: 480px) {
	.spar-pagination-controls {
		justify-content: space-between;
		max-width: 100%;
	}
	
	.spar-pagination-prev,
	.spar-pagination-next {
		flex: 0 0 auto;
	}
	
	.spar-pagination-page,
	.spar-pagination-current {
		flex: 1 1 auto;
		min-width: 28px;
		max-width: 40px;
	}
}

/* ============================================================
   Points History Timeline
   ============================================================ */

.spar-history-timeline {
	position: relative;
	padding: 4px 0 8px;
}

/* Vertical connecting line */
.spar-history-timeline::before {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 18px;
	width: 2px;
	background: #e5e7eb;
	border-radius: 1px;
}

/* ---- Date separator ---- */
.spar-tl-date-sep {
	position: relative;
	display: flex;
	align-items: center;
	margin: 20px 0 10px;
	padding-left: 46px;
}

.spar-tl-date-sep span {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #9ca3af;
	background: #fff;
	padding: 0 8px 0 0;
}

/* ---- Single timeline item ---- */
.spar-tl-item {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 7px 0;
}

/* ---- Dot / icon circle ---- */
.spar-tl-dot {
	flex: 0 0 36px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	position: relative;
	z-index: 1;
	box-shadow: 0 0 0 3px #fff;
	background: #f3f4f6;
}

.spar-tl-icon {
	line-height: 1;
}

/* Colour variants for the dot */
.spar-tl-green  { background: #d1fae5; }
.spar-tl-purple { background: #ede9fe; }
.spar-tl-red    { background: #fee2e2; }
.spar-tl-blue   { background: #dbeafe; }
.spar-tl-amber  { background: #fef3c7; }
.spar-tl-indigo { background: #e0e7ff; }
.spar-tl-gray   { background: #f3f4f6; }
.spar-tl-pink   { background: #fce7f3; }
.spar-tl-teal   { background: #ccfbf1; }

/* ---- Card body ---- */
.spar-tl-card {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: #fff;
	border: 1px solid #f0f0f0;
	border-radius: 10px;
	padding: 10px 14px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.05);
	min-width: 0;
}

.spar-tl-card-left {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.spar-tl-title {
	font-size: 13px;
	font-weight: 600;
	color: #111827;
	line-height: 1.3;
	white-space: normal;
	word-break: break-word;
}

.spar-tl-time {
	font-size: 11px;
	color: #9ca3af;
	white-space: nowrap;
}

/* ---- Points badge ---- */
.spar-tl-badge {
	flex: 0 0 auto;
	display: inline-block;
	font-size: 12px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 999px;
	white-space: nowrap;
}

.spar-tl-badge--add {
	background: #d1fae5;
	color: #065f46;
}

.spar-tl-badge--remove {
	background: #fee2e2;
	color: #991b1b;
}

/* ---- Order stats (subtotal / discount / total) for referral entries ---- */
.spar-tl-order-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	margin-top: 6px;
}

.spar-tl-stat {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	color: #6b7280;
}

.spar-tl-stat-label {
	font-weight: 500;
}

.spar-tl-stat-label::after {
	content: ':';
}

.spar-tl-stat-value {
	font-weight: 600;
	color: #374151;
}

.spar-tl-stat--discount .spar-tl-stat-value {
	color: #dc2626;
}

.spar-tl-stat--total .spar-tl-stat-value {
	color: #065f46;
	font-size: 12px;
}

/* When the card has stats, allow the left column to wrap */
.spar-tl-card--has-stats {
	align-items: flex-start;
}

/* ---- Empty state ---- */
.spar-tl-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	padding: 40px 20px;
	text-align: center;
}

.spar-tl-empty-icon {
	font-size: 36px;
	line-height: 1;
}

.spar-tl-empty-text {
	font-size: 13px;
	color: #6b7280;
}

/* ---- Responsive: narrow cards ---- */
@media (max-width: 480px) {
	.spar-tl-card {
		flex-wrap: wrap;
		gap: 6px;
	}

	.spar-tl-badge {
		align-self: flex-end;
	}
}