/**
 * SparesSpace Payment Public Styles
 * Version: 1.2.0
 */

/* ========================================
   CHECKOUT FORM STYLES
   ======================================== */

#sparesspace-payment-fields {
	border: 1px solid #e2e8f0;
	padding: 20px;
	border-radius: 12px;
	margin: 20px 0;
	background: #ffffff;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

#sparesspace-payment-fields .form-row {
	margin-bottom: 20px;
}

#sparesspace-payment-fields label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	color: #1a202c;
	font-size: 14px;
}

#sparesspace-payment-fields select,
#sparesspace-payment-fields input[type="tel"],
#sparesspace-payment-fields input[type="text"] {
	width: 100%;
	padding: 12px 16px;
	border: 1px solid #cbd5e0;
	border-radius: 8px;
	font-size: 15px;
	transition: all 0.2s ease;
	background-color: #f8fafc;
}

#sparesspace-payment-fields select:focus,
#sparesspace-payment-fields input:focus {
	outline: none;
	border-color: #3182ce;
	background-color: #ffffff;
	box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

/* Provider Selection Grid */
.sparesspace-provider-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
	gap: 12px;
	margin-top: 10px;
}

.sparesspace-provider-option {
	position: relative;
	cursor: pointer;
}

.sparesspace-provider-option input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.sparesspace-provider-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 16px 12px;
	border: 2px solid #e2e8f0;
	border-radius: 12px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	background: #fff;
	text-align: center;
	height: 100%;
	min-height: 90px;
}

.sparesspace-provider-option:hover .sparesspace-provider-card,
.sparesspace-provider-card.hover {
	border-color: #cbd5e0;
	transform: translateY(-2px);
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.sparesspace-provider-card img {
	height: 32px;
	margin-bottom: 8px;
	object-fit: contain;
}

.sparesspace-provider-card span {
	font-size: 12px;
	font-weight: 600;
	color: #4a5568;
}

.sparesspace-provider-option input:checked + .sparesspace-provider-card {
	border-color: #3182ce;
	background-color: #ebf8ff;
	box-shadow: 0 0 0 1px #3182ce;
}

.sparesspace-provider-option input:checked + .sparesspace-provider-card::after {
	content: '✓';
	position: absolute;
	top: -8px;
	right: -8px;
	background: #3182ce;
	color: white;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	font-size: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sparesspace-provider-option input:checked + .sparesspace-provider-card span {
	color: #2b6cb0;
}

/* Payment Gateway Icon */
.woocommerce-checkout .payment_methods .payment_method_sparesspace_payment img {
	max-width: 60px;
	max-height: 30px;
	width: auto;
	height: auto;
	object-fit: contain;
}

/* ========================================
   THANK YOU PAGE STYLES
   ======================================== */

.sparesspace-thankyou {
	background: #ffffff;
	padding: 32px;
	border-radius: 16px;
	margin: 30px 0;
	border: 1px solid #e2e8f0;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.sparesspace-thankyou h2 {
	color: #1a202c;
	margin-top: 0;
	margin-bottom: 24px;
	font-size: 24px;
	font-weight: 800;
	text-align: center;
}

.payment-details {
	background: #f8fafc;
	padding: 24px;
	border-radius: 12px;
	border: 1px solid #e2e8f0;
}

.detail-box {
	background: #ffffff;
	padding: 16px;
	margin: 12px 0;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	position: relative;
}

.detail-box label {
	font-size: 13px;
	color: #718096;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	margin: 0;
	flex-shrink: 0;
}

.detail-box strong {
	font-size: 16px;
	color: #2d3748;
	word-break: break-all;
	text-align: right;
	flex-grow: 1;
	margin-left: 10px;
}

/* Verification Code Box */
.verification-code-box {
	background: #fffaf0 !important;
	border: 2px dashed #f6ad55 !important;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 24px;
	box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.verification-code-box label {
	margin-bottom: 12px;
	color: #dd6b20 !important;
	text-transform: none !important;
	font-size: 14px !important;
}

.verification-code-box strong {
	font-size: 32px;
	color: #c05621;
	letter-spacing: 4px;
	font-family: 'Courier New', monospace;
	display: block;
	margin-bottom: 12px;
	user-select: all;
	background: #fff;
	padding: 10px 20px;
	border-radius: 8px;
	text-align: center;
	margin-left: 0;
}

.verification-code-box p {
	font-size: 13px;
	color: #718096;
	margin: 0;
	line-height: 1.4;
}

/* Copy Button Styles */
.sparesspace-copy-btn {
	background: #edf2f7;
	border: 1px solid #cbd5e0;
	border-radius: 6px;
	padding: 6px 10px;
	margin-left: 10px;
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 13px;
	color: #4a5568;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.sparesspace-copy-btn:hover {
	background: #e2e8f0;
	border-color: #a0aec0;
}

.sparesspace-copy-btn:active {
	transform: scale(0.95);
}

.sparesspace-copy-btn.copied {
	background: #d4edda;
	border-color: #28a745;
	color: #155724;
}

.sparesspace-copy-btn.copy-error {
	background: #f8d7da;
	border-color: #dc3545;
	color: #721c24;
}

.sparesspace-copy-btn svg {
	width: 14px;
	height: 14px;
}

.sparesspace-copy-btn-large {
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 600;
	margin-top: 12px;
	margin-left: 0;
}

.sparesspace-copy-btn-large svg {
	width: 16px;
	height: 16px;
}

/* Payment Instructions */
.instructions {
	background: #ebf8ff;
	padding: 24px;
	border-radius: 12px;
	margin: 24px 0;
	border: 1px solid #bee3f8;
}

.instructions h3 {
	margin-top: 0;
	margin-bottom: 16px;
	color: #2b6cb0;
	font-size: 18px;
	font-weight: 700;
	display: flex;
	align-items: center;
}

.instructions h3::before {
	content: 'ℹ️';
	margin-right: 10px;
	font-size: 20px;
}

.instructions ol {
	margin: 10px 0;
	padding-left: 25px;
}

.instructions li {
	margin: 10px 0;
	line-height: 1.6;
	color: #2d3748;
}

/* Status Styles */
.status-info {
	background: #fff3cd;
	padding: 15px;
	border-radius: 8px;
	margin-top: 20px;
	border-left: 4px solid #ffc107;
}

.status-info p {
	margin: 5px 0;
	color: #856404;
}

.status-badge {
	display: inline-block;
	padding: 5px 12px;
	border-radius: 15px;
	font-size: 11px;
	font-weight: bold;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.status-badge.status-pending {
	background: #fff3cd;
	color: #856404;
}

.status-badge.status-verified {
	background: #d4edda;
	color: #155724;
}

.status-badge.status-failed {
	background: #f8d7da;
	color: #721c24;
}

.status-badge.status-disputed {
	background: #ffe5cc;
	color: #d97706;
}

/* Order Received Page */
.woocommerce-order-received .sparesspace-thankyou {
	margin-top: 20px;
}

.woocommerce-notice--success.woocommerce-thankyou-order-received {
	background: #d4edda;
	color: #155724;
	padding: 15px 20px;
	border-left: 4px solid #28a745;
	border-radius: 5px;
	margin-bottom: 20px;
	font-size: 16px;
	font-weight: 600;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
	.sparesspace-thankyou {
		padding: 20px;
	}

	.payment-details {
		padding: 16px;
	}

	.detail-box {
		padding: 12px;
		margin: 10px 0;
		flex-direction: column;
		align-items: flex-start;
	}

	.detail-box strong {
		text-align: left;
		margin-left: 0;
		margin-top: 8px;
		width: 100%;
	}

	.sparesspace-copy-btn {
		margin-left: 0;
		margin-top: 8px;
		width: 100%;
		justify-content: center;
	}

	.verification-code-box strong {
		font-size: 24px;
		letter-spacing: 2px;
	}

	.instructions {
		padding: 16px;
	}

	.instructions ol {
		padding-left: 20px;
	}

	.sparesspace-provider-grid {
		grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
		gap: 10px;
	}

	.sparesspace-provider-card {
		padding: 12px 8px;
		min-height: 80px;
	}

	.sparesspace-provider-card img {
		height: 28px;
	}

	.sparesspace-provider-card span {
		font-size: 11px;
	}
}

@media (max-width: 480px) {
	.sparesspace-thankyou h2 {
		font-size: 20px;
	}

	.verification-code-box strong {
		font-size: 20px;
		padding: 8px 12px;
	}

	#sparesspace-payment-fields {
		padding: 15px;
	}
}

/* ========================================
   LOYALTY REWARDS STYLES
   ======================================== */

/* Checkout Section */
.sparesspace-loyalty-checkout-section {
	background: linear-gradient( 135deg, #fff8e1 0%, #fffde7 100% );
	border: 1px solid #ffe082;
	border-radius: 12px;
	padding: 20px 24px;
	margin: 24px 0;
	box-shadow: 0 2px 8px rgba(255, 193, 7, 0.15);
}

.loyalty-checkout-title {
	color: #e65100;
	font-size: 17px;
	font-weight: 700;
	margin: 0 0 14px 0;
	display: flex;
	align-items: center;
	gap: 8px;
}

.loyalty-star {
	color: #ffc107;
	font-size: 22px;
}

.loyalty-balance-info {
	color: #4a4a4a;
	margin: 0 0 14px 0;
	font-size: 14px;
}

/* Balance summary pills */
.loyalty-balance-summary {
	display: flex;
	gap: 12px;
	margin-bottom: 14px;
	flex-wrap: wrap;
}

.loyalty-balance-pill {
	flex: 1;
	min-width: 120px;
	background: #fff;
	border: 1px solid #ffe082;
	border-radius: 10px;
	padding: 10px 16px;
	text-align: center;
}

.loyalty-balance-pill--value {
	background: #fff8e1;
}

.loyalty-balance-pill-label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #888;
	margin-bottom: 4px;
}

.loyalty-balance-pill-value {
	display: block;
	font-size: 20px;
	font-weight: 800;
	color: #e65100;
}

/* Disabled Redeem button */
.loyalty-btn-disabled,
.loyalty-btn[disabled] {
	background: #e0e0e0 !important;
	color: #9e9e9e !important;
	cursor: not-allowed !important;
	opacity: 0.8;
}

/* Earn-preview block (shown when customer cannot yet redeem) */
.loyalty-earn-preview {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	background: #fff3e0;
	border: 1px solid #ffcc80;
	border-radius: 8px;
	padding: 12px 16px;
	margin-bottom: 12px;
}

.loyalty-earn-icon {
	color: #ffa000;
	font-size: 20px;
	line-height: 1.4;
	flex-shrink: 0;
}

.loyalty-earn-text {
	color: #4a4a4a;
	font-size: 14px;
	line-height: 1.5;
}

.loyalty-earn-text strong {
	color: #e65100;
	font-size: 16px;
}

.loyalty-next-order-hint {
	margin: 8px 0 0 0;
	font-size: 13px;
	color: #5d4037;
	background: #fbe9e7;
	border-left: 3px solid #ff7043;
	padding: 8px 12px;
	border-radius: 0 6px 6px 0;
	line-height: 1.5;
}

.loyalty-applied-row {
	background: #e8f5e9;
	border: 1px solid #a5d6a7;
	border-radius: 8px;
	padding: 10px 14px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 12px;
	font-size: 14px;
	color: #2e7d32;
	font-weight: 600;
}

.loyalty-redeem-form label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	color: #4a4a4a;
	font-size: 14px;
}

.loyalty-input-row {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

.loyalty-input-row input[type="number"] {
	width: 140px;
	padding: 10px 14px;
	border: 1px solid #ffe082;
	border-radius: 8px;
	font-size: 15px;
	background: #fff;
	color: #333;
}

.loyalty-input-row input[type="number"]:focus {
	outline: none;
	border-color: #ffc107;
	box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
}

.loyalty-btn {
	background: #ffc107 !important;
	color: #212121 !important;
	border: none !important;
	border-radius: 8px !important;
	padding: 10px 18px !important;
	font-weight: 700 !important;
	font-size: 14px !important;
	cursor: pointer;
	transition: background 0.2s ease;
	white-space: nowrap;
}

.loyalty-btn:hover {
	background: #ffb300 !important;
}

.loyalty-btn-remove {
	background: #ef5350 !important;
	color: #fff !important;
}

.loyalty-btn-remove:hover {
	background: #e53935 !important;
}

.loyalty-value-preview {
	margin: 8px 0 0 0;
	font-size: 13px;
	color: #2e7d32;
	font-weight: 600;
}

.loyalty-feedback {
	margin-top: 12px;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
}

.loyalty-success {
	background: #e8f5e9;
	color: #2e7d32;
	border: 1px solid #a5d6a7;
}

.loyalty-error {
	background: #ffebee;
	color: #c62828;
	border: 1px solid #ef9a9a;
}

.loyalty-not-enough {
	color: #757575;
	font-size: 14px;
	margin: 0;
	font-style: italic;
}

/* My Account Loyalty Tab */
.sparesspace-loyalty-account {
	max-width: 800px;
}

.sparesspace-loyalty-account h2 {
	color: #1a202c;
	font-size: 22px;
	margin-bottom: 20px;
}

.loyalty-balance-card {
	background: linear-gradient( 135deg, #ff8f00 0%, #ffc107 100% );
	border-radius: 16px;
	padding: 24px 28px;
	display: flex;
	align-items: center;
	gap: 20px;
	margin-bottom: 28px;
	box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
	color: #fff;
}

.loyalty-balance-icon {
	font-size: 48px;
	line-height: 1;
	color: rgba(255,255,255,0.85);
}

.loyalty-balance-info {
	flex: 1;
}

.loyalty-balance-label {
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	opacity: 0.85;
	margin-bottom: 4px;
}

.loyalty-balance-value {
	font-size: 42px;
	font-weight: 800;
	line-height: 1;
}

.loyalty-balance-equiv {
	text-align: right;
}

.loyalty-equiv-label {
	display: block;
	font-size: 12px;
	opacity: 0.85;
	text-transform: uppercase;
	margin-bottom: 4px;
}

.loyalty-equiv-value {
	display: block;
	font-size: 22px;
	font-weight: 700;
}

.loyalty-how-it-works {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 20px 24px;
	margin-bottom: 24px;
}

.loyalty-how-it-works h3 {
	margin-top: 0;
	color: #2d3748;
	font-size: 16px;
}

.loyalty-how-it-works ul {
	margin: 0;
	padding-left: 20px;
}

.loyalty-how-it-works li {
	margin: 8px 0;
	color: #4a5568;
	line-height: 1.5;
}

.loyalty-history-table {
	width: 100%;
	border-collapse: collapse;
}

.loyalty-history-table th,
.loyalty-history-table td {
	padding: 10px 14px;
	text-align: left;
	border-bottom: 1px solid #e2e8f0;
	font-size: 14px;
}

.loyalty-history-table th {
	background: #f8fafc;
	font-weight: 700;
	color: #4a5568;
	text-transform: uppercase;
	font-size: 12px;
	letter-spacing: 0.04em;
}

.loyalty-points-earned {
	color: #2e7d32;
	font-weight: 700;
}

.loyalty-points-redeemed {
	color: #c62828;
	font-weight: 700;
}

/* Admin loyalty log styles */
.loyalty-points-earned { color: #2e7d32; font-weight: 700; }
.loyalty-points-redeemed { color: #c62828; font-weight: 700; }

/* Responsive loyalty */
@media (max-width: 600px) {
	.loyalty-balance-summary {
		flex-direction: column;
	}

	.loyalty-balance-pill {
		min-width: unset;
	}

	.loyalty-balance-card {
		flex-direction: column;
		text-align: center;
		gap: 12px;
	}

	.loyalty-balance-equiv {
		text-align: center;
	}

	.loyalty-balance-value {
		font-size: 32px;
	}

	.loyalty-input-row {
		flex-direction: column;
		align-items: stretch;
	}

	.loyalty-input-row input[type="number"] {
		width: 100%;
	}

	.loyalty-btn {
		width: 100%;
		text-align: center;
	}
}

/* ========================================
   LOYALTY THANK-YOU PAGE SECTION
   ======================================== */

.sparesspace-loyalty-thankyou-section {
	background: linear-gradient( 135deg, #fff8e1 0%, #fffde7 100% );
	border: 1px solid #ffe082;
	border-radius: 12px;
	padding: 20px 24px;
	margin: 24px 0;
	box-shadow: 0 2px 8px rgba(255, 193, 7, 0.15);
}

.sparesspace-loyalty-thankyou-section .loyalty-checkout-title {
	margin-top: 0;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
	.verification-code-box {
		background: #ffffe0 !important;
		border: 2px solid #000 !important;
		page-break-inside: avoid;
	}

	.sparesspace-thankyou {
		padding: 0;
		box-shadow: none;
		border: none;
	}

	.sparesspace-copy-btn {
		display: none;
	}
}
