/* 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: 18px;
	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: #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: #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: #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;
	font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

/* 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-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
	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: #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;
	}
}