/* WPGens Loyalty Program - Frontend Styles
 * Organized by template files and standardized with wpgens-loyalty- prefix
 */

/* ----------------------------------------
 * Global Styles
 * --------------------------------------- */
.wpgens-loyalty-container {
	position: relative;
	padding: 48px 24px;
	max-width: 768px;
	margin: auto;
}

.wpgens-loyalty-container--wide {
	position: relative;
	padding: 48px 24px;
	max-width: 1024px;
	margin: auto;
}

.wpgens-default-button {
	all: unset;
	outline: 0 !important;
	border: 0 !important;
	text-decoration: none !important;
	cursor: pointer;
	font-size: 14px;
	height: 36px;
	line-height: 36px;
	padding: 0 24px;
	margin: 0;
	text-align: center;
	min-width: 60px;
	display: inline;
	border-radius: 4px;
	transition: opacity 0.2s ease-in-out;
	background-color: #444;
	color: #fff;
}

.wpgens-loyalty-button {
	all: unset;
	outline: 0 !important;
	border: 0 !important;
	text-decoration: none !important;
	cursor: pointer;
	font-size: 14px;
	height: 36px;
	line-height: 36px;
	padding: 0 24px;
	margin: 0;
	text-align: center;
	min-width: 60px;
	display: inline;
	border-radius: 4px;
	transition: opacity 0.2s ease-in-out;
	background-color: #444;
	color: #fff;
}

.wpgens-loyalty-button:hover {
	opacity: 0.8;
}

.wpgens-loyalty-button:disabled {
	cursor: unset;
	opacity: 0.3;
}

.wpgens-loyalty-button.used {
	background-color: #e5e7eb;
	color: #6b7280;
	cursor: default;
}

.wpgens-loyalty-button.available {
	background-color: #dcfce7;
	color: #166534;
}

/* ----------------------------------------
 * Message Styles
 * --------------------------------------- */
.wpgens-loyalty-message {
	padding: 1em;
	margin: 1em 0;
	border-radius: 4px;
	border: 1px solid;
}

.wpgens-loyalty-message.success {
	background: #f7fff7;
	border-color: #c3e6cb;
	color: #155724;
}

.wpgens-loyalty-message.error {
	background: #fff7f7;
	border-color: #f5c6cb;
	color: #721c24;
}

/* ----------------------------------------
 * Main Landing Page (points-page.php)
 * --------------------------------------- */
.wpgens-loyalty-landing {
	padding: 0;
	margin: auto;
}

.wpgens-loyalty-landing p {
	font-size: 16px;
	line-height: 24px;
	margin: 0 0 12px;
	color: #000;
}

.wpgens-loyalty-landing .wpgens-loyalty-subsection-title {
	font-weight: 600;
	margin-bottom: 6px;
	color: #000;
}

.wpgens-loyalty-landing .wpgens-loyalty-subsection-desc {
	color: #000;
}

.wpgens-loyalty-section {
	text-align: center;
	padding: 40px 0;
	background-color: #fafafa;
}

.wpgens-loyalty-section-hero {
	text-align: center;
	margin-bottom: 60px;
}

.wpgens-loyalty-section-icon {
	margin-bottom: 20px;
}

.wpgens-loyalty-section-hero svg {
	width: 48px;
	height: 48px;
	margin: auto;
	color: #be8b3b;
}

.wpgens-loyalty-section-title {
	font-size: 26px;
	margin: 24px 0 12px;
}

.wpgens-loyalty-section-description {
	max-width: 640px;
	margin: auto;
}

.wpgens-loyalty-landing .success {
	color: #038a03;
}

.wpgens-loyalty-landing .error {
	color: red;
}

/* ----------------------------------------
 * Points Tabs (points-page.php)
 * --------------------------------------- */
.wpgens-loyalty-tabs {
	margin: 0 0 24px;
}

.wpgens-loyalty-tabs span {
	cursor: pointer;
	color: #000;
	display: inline-block;
	margin: 0 12px;
	font-size: 17px;
	text-transform: uppercase;
	letter-spacing: 1px;
	font-weight: 600;
}

.wpgens-loyalty-tabs span:hover {
	text-decoration: underline;
}

/* ----------------------------------------
 * Points Earning (points-earn.php)
 * --------------------------------------- */
.wpgens-loyalty-listing {
	margin: 0;
	padding: 0;
}

.wpgens-loyalty-listing-earn {
	margin: 0;
	padding: 0;
	text-indent: 0;
	display: flex;
	flex-flow: row wrap;
	justify-content: center;
	list-style: none;
	line-height: 1;
}

.wpgens-loyalty-listing-earn li {
	margin: 0 16px 32px;
	padding: 32px 0 0;
	text-indent: 0;
	list-style-type: none;
	box-sizing: border-box;
	display: flex;
	flex-flow: column wrap;
	align-items: center;
	text-align: center;
	width: 200px;
	position: relative;
	color: #333;
	border-bottom: 1px solid #000;
	transition: all 0.2s ease-in-out;
}

.wpgens-loyalty-listing-earn li:hover {
	background-color: #fff;
}

.wpgens-loyalty-listing-earn li .wpgens-loyalty-listing-cost {
	text-transform: uppercase;
	font-weight: 600;
	font-size: 18px;
	margin: 24px 0 18px;
}

.wpgens-loyalty-listing-earn li .wpgens-loyalty-listing-title {
	padding-bottom: 18px;
	line-height: 1.2;
	display: flex;
	align-items: center;
	gap: 4px;
}

.wpgens-loyalty-listing-earn li svg {
	max-height: 38px;
	max-width: 38px;
}

/* ----------------------------------------
 * Points Redeeming (points-redeem.php)
 * --------------------------------------- */
.wpgens-loyalty-listing-redeem {
	margin: 0;
	padding: 0;
	text-indent: 0;
	display: flex;
	flex-flow: row wrap;
	justify-content: center;
	list-style: none;
	line-height: 1;
}

.wpgens-loyalty-listing-redeem li {
	margin: 16px;
	padding: 24px;
	list-style-type: none;
	box-sizing: border-box;
	display: flex;
	flex-flow: row wrap;
	justify-content: space-between;
	width: 100%;
	max-width: 480px;
	align-items: center;
	text-align: left;
	position: relative;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3csvg width='100%' height='100%' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%' height='100%' fill='none' stroke='%23AEAEAEFF' strokeWidth='2' stroke-dasharray='6%2c 14' stroke-dashoffset='0' strokeLinecap='square'/%3e%3c/svg%3e");
	color: #333;
	transition: all 0.2s ease-in-out;
}

.wpgens-loyalty-listing-redeem li:hover {
	background-color: #fff;
}

.wpgens-loyalty-listing-redeem li .wpgens-loyalty-listing-redeem-info {
	display: flex;
	flex-direction: row;
}

.wpgens-loyalty-listing-redeem li .wpgens-loyalty-reward-icon {
	margin-right: 24px;
}

.wpgens-loyalty-listing-redeem li .wpgens-loyalty-listing-title {
	max-width: 215px;
	margin-bottom: 12px;
}

.wpgens-loyalty-listing-redeem li svg {
	height: 38px;
	width: 38px;
}

.wpgens-loyalty-listing-redeem li .wpgens-loyalty-reward-expiry,
.wpgens-loyalty-listing-redeem li .wpgens-loyalty-reward-amount {
	display: block;
	font-size: 14px;
	color: #6b7280;
	margin-top: 4px;
}

/* ----------------------------------------
 * Points Stats (points-stats.php)
 * --------------------------------------- */
.wpgens-loyalty-points-boxes {
	display: flex;
	flex-direction: row;
}

.wpgens-loyalty-points-box {
	margin: 12px;
	padding: 24px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	width: 100%;
	min-height: 160px;
	align-items: center;
	text-align: left;
	position: relative;
	background-color: #fff;
	background-image: url("data:image/svg+xml,%3csvg width='100%' height='100%' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%' height='100%' fill='none' stroke='%23AEAEAEFF' strokeWidth='2' stroke-dasharray='6%2c 14' stroke-dashoffset='0' strokeLinecap='square'/%3e%3c/svg%3e");
	color: #333;
	transition: all 0.2s ease-in-out;
}

.wpgens-loyalty-points-box-value {
	margin-bottom: 24px;
	font-weight: 600;
	font-size: 21px;
}

/* ----------------------------------------
 * Points History (points-history.php)
 * --------------------------------------- */
.wpgens-loyalty-history-container {
	margin: 12px;
}

.wpgens-loyalty-history {
	background-color: #fff;
	padding: 24px;
	margin-top: 12px;
	width: 100%;
	text-align: left;
	border: 0;
	border-spacing: 0;
	border-collapse: separate;
	text-transform: capitalize;
}

.wpgens-loyalty-history thead th {
	font-size: 16px;
	display: table-cell !important;
	border: 0;
	border-bottom: 1px solid #ddd;
	line-height: 26px;
	height: 26px;
	font-weight: 400;
	padding: 15px;
}

.wpgens-loyalty-history tbody td {
	border: 0;
	display: table-cell !important;
	line-height: 26px;
	height: 26px;
	padding: 12px;
	font-size: 15px;
}

.wpgens-loyalty-points-earn {
	color: #28a745;
}

.wpgens-loyalty-points-spend,
.wpgens-loyalty-points-expire {
	color: #dc3545;
}

.wpgens-loyalty-no-history {
	text-align: center;
	padding: 20px;
}

/* ----------------------------------------
 * Points Earning Notice
 * --------------------------------------- */

.wpgens-product-single-earning-notice {
	display: inline-flex;
	align-items: center;
	border-radius: 6px;
	background-color: #f5f5f5;
	padding: 8px 16px;
	margin: 10px 0;
	gap: 8px;
	font-size: 15px;
}

#review_form .wpgens-product-single-earning-notice {
	margin-bottom: 24px;
}

.wpgens-product-single-earning-notice svg {
	flex-shrink: 0;
}

.wpgens-points-earning-notice {
	margin: 16px 0;
}

.wpgens-points-earning-notice-inner {
	margin: 0 16px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 24px;
	background-color: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 8px;
	text-align: center;
}
.woocommerce-checkout-review-order .wpgens-points-earning-notice-inner {
	margin: 0;
}
.woocommerce-cart .wpgens-points-earning-notice-inner {
	max-width: 100%;
	margin: 0;
}
.woocommerce-cart
	.wpgens-points-earning-notice-inner
	.wpgens-points-earning-notice-icon {
	display: none;
}

.wpgens-points-earning-notice-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 4px;
}

.wpgens-points-earning-notice-icon svg {
	flex-shrink: 0;
}

.wpgens-points-earning-notice-content {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.wpgens-points-earning-notice-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #212529;
	line-height: 1.4;
}

.wpgens-points-earning-notice-subtitle {
	color: #6c757d;
	font-size: 14px;
	line-height: 1.5;
}

/* ----------------------------------------
 * Classic Checkout Points Redemption
 * --------------------------------------- */
.wpgens-points-redemption-block {
	margin-bottom: 20px;
}

.wpgens-points-redemption-block h4 {
	margin-top: 0;
	margin-bottom: 8px;
	font-size: 16px;
	font-weight: 600;
}

.wpgens-points-redemption-block p {
	margin-bottom: 12px;
}

/* Accordion Styles */
.wpgens-accordion h3 {
	padding: 16px;
	margin: 0;
	cursor: pointer;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 16px;
	font-weight: 600;
	background-color: #f8f9fa;
	border: 1px solid #ddd;
	border-radius: 4px;
}

.wpgens-accordion-title {
	flex: 1;
}

.wpgens-accordion .caret {
	transition: transform 0.3s ease;
}

.wpgens-accordion.show .caret {
	transform: rotate(180deg);
}

.wpgens-accordion-inner {
	padding: 16px;
	overflow: hidden;
	transition: max-height 0.3s ease;
	border: 1px solid #ddd;
	border-top: none;
	border-radius: 0 0 4px 4px;
}

/* Form Styles */
.wpgens-points-user-balance {
	margin-bottom: 16px;
	font-size: 14px;
}

.wpgens-points-instructions {
	margin-bottom: 16px;
	font-size: 14px;
}

.wpgens-redeem-points-form-field {
	display: flex;
	flex-wrap: wrap;
	margin: 0 -5px;
}

.wpgens-col-left-half {
	padding: 0 5px;
	flex: 1;
}

.wpgens-form-control-wrapper input {
	width: 100%;
	padding: 8px;
	border: 1px solid #d3d3d3;
	border-radius: 3px;
	box-shadow: none;
	height: 42px;
}

.wpgens_points_btn_wrap {
	display: flex;
	align-items: flex-end;
}

.wpgens_points_btn_wrap .wpgens-loyalty-button {
	width: 100%;
	height: 42px;
}

/* Guest User Styles */
.wpgens-points-guest-message {
	margin-bottom: 15px;
	color: #666;
	font-size: 14px;
	line-height: 1.5;
}

.wpgens-points-login-button-wrapper {
	width: 100%;
	text-align: center;
}

.wpgens-loyalty-login-button {
	box-sizing: border-box;
	display: inline-block;
	width: 100%;
	padding: 0 12px;
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
	text-align: center;
	transition: background-color 0.2s ease;
}

.wpgens-loyalty-login-button:hover {
	color: #fff;
	text-decoration: none;
}

.wpgens-loyalty-guest-message {
	margin-bottom: 24px;
}
.wpgens-loyalty-guest-message a {
	padding: 0 16px;
	width: auto;
}

/* ----------------------------------------
 * Coupon Code Styles
 * --------------------------------------- */
.wpgens-loyalty-button.coupon-code {
	cursor: pointer;
	transition: all 0.2s ease;
	position: relative;
	display: inline-block;
	user-select: all;
	text-transform: none !important;
}

.wpgens-loyalty-button.coupon-code:hover {
	transform: translateY(-2px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wpgens-loyalty-button.coupon-code:active {
	transform: translateY(0);
}

.wpgens-loyalty-button.coupon-code::before {
	content: "";
	position: absolute;
	top: -2px;
	left: -2px;
	right: -2px;
	bottom: -2px;
	border-radius: 6px;
	background: transparent;
	z-index: -1;
	transition: background 0.2s;
}

.wpgens-loyalty-button.coupon-code:hover::before {
	background: rgba(0, 0, 0, 0.03);
}

.wpgens-loyalty-button.redeeming {
	min-width: 100px;
	cursor: wait;
}

/* Tooltip for copied state */
.wpgens-loyalty-button.coupon-code[title="Copied to clipboard!"]::after {
	content: "✓";
	display: inline-block;
	margin-left: 6px;
	font-weight: bold;
}

/* ----------------------------------------
 * Birthday Button Styles
 * --------------------------------------- */
.wpgens-loyalty-birthday-button {
	display: inline-block;
	padding: 8px 16px;
	background-color: #444;
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
	font-size: 14px;
	transition: opacity 0.2s ease-in-out;
	margin-top: 10px;
}

.wpgens-loyalty-birthday-button:hover {
	opacity: 0.8;
	color: #fff;
	text-decoration: none;
}

/* ----------------------------------------
 * Loading Spinner
 * --------------------------------------- */
@keyframes wpgens-loyalty-spinner {
	to {
		transform: rotate(360deg);
	}
}

.wpgens-loyalty-spinner {
	position: relative;
	margin: auto;
	height: 40px;
}

.wpgens-loyalty-spinner:before {
	content: "";
	box-sizing: border-box;
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin-top: -10px;
	margin-left: -10px;
	border-radius: 50%;
	border-top: 2px solid #07d;
	border-right: 2px solid transparent;
	animation: wpgens-loyalty-spinner 0.6s linear infinite;
}

/* Redeeming spinner animation */
.redeeming .wpgens-loyalty-spinner {
	height: 20px;
	margin: 0 auto;
}

.redeeming .wpgens-loyalty-spinner:before {
	width: 16px;
	height: 16px;
	margin-top: -8px;
	margin-left: -8px;
	border-width: 2px;
}

/* ----------------------------------------
 * Responsive Styles
 * --------------------------------------- */
@media (max-width: 768px) {
	/* Tabs */
	.wpgens-loyalty-tabs span {
		display: block;
		margin: 12px 0;
	}

	/* Redeem listings */
	.wpgens-loyalty-listing-redeem li {
		text-align: center;
		flex-flow: column;
		height: auto;
	}

	.wpgens-loyalty-listing-redeem li .wpgens-loyalty-listing-redeem-info {
		flex-direction: column;
		margin-bottom: 24px;
	}

	.wpgens-loyalty-listing-redeem li .wpgens-loyalty-reward-icon {
		margin: 0 0 24px;
	}

	.wpgens-loyalty-listing-redeem li .wpgens-loyalty-listing-title {
		margin-bottom: 16px;
	}

	/* Points boxes */
	.wpgens-loyalty-points-boxes {
		flex-direction: column;
	}

	.wpgens-loyalty-points-box {
		max-width: none;
		width: 100%;
		margin: 12px 0;
	}

	.wpgens-loyalty-history-container {
		margin: 0;
	}

	/* Cart points conversion */
	.wpgens-loyalty-conversion-notice {
		flex-direction: column;
	}
	.wpgens-loyalty-conversion-text {
		margin-bottom: 10px;
	}
}
