/**
 * QR Coupon & Lead Generator - Frontend Stylesheet
 *
 * Mobile-first, touch-friendly, namespaced to prevent theme conflicts.
 */

.qrc-wrapper {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #0f172a;
	background: #f8fafc;
	min-height: 80vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px 16px;
}

.qrc-wrapper *,
.qrc-wrapper *::before,
.qrc-wrapper *::after {
	box-sizing: inherit;
}

.qrc-container {
	width: 100%;
	max-width: 440px;
	margin: 0 auto;
}

.qrc-card {
	background: #ffffff;
	border-radius: 20px;
	padding: 32px 24px;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
	border: 1px solid #e2e8f0;
	transition: all 0.3s ease;
}

/* Brand Header */
.qrc-brand-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 24px;
	padding-bottom: 16px;
	border-bottom: 1px solid #f1f5f9;
}

.qrc-brand-badge {
	width: 40px;
	height: 40px;
	background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
	color: #ffffff;
	font-weight: 700;
	font-size: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	box-shadow: 0 4px 8px rgba(99, 102, 241, 0.25);
}

.qrc-brand-name {
	font-weight: 700;
	font-size: 16px;
	color: #1e293b;
	letter-spacing: -0.2px;
}

/* Intro */
.qrc-intro {
	text-align: center;
	margin-bottom: 24px;
}

.qrc-title {
	font-size: 22px;
	font-weight: 800;
	color: #0f172a;
	line-height: 1.25;
	margin: 0 0 8px 0;
	letter-spacing: -0.5px;
}

.qrc-subtitle {
	font-size: 14px;
	color: #64748b;
	line-height: 1.5;
	margin: 0;
}

/* Alerts */
.qrc-alert {
	padding: 12px 16px;
	border-radius: 10px;
	font-size: 13px;
	line-height: 1.4;
	margin-bottom: 20px;
	animation: qrcSlideDown 0.2s ease-out;
}

@keyframes qrcSlideDown {
	from { opacity: 0; transform: translateY(-6px); }
	to { opacity: 1; transform: translateY(0); }
}

.qrc-alert-danger {
	background: #fef2f2;
	color: #dc2626;
	border: 1px solid #fecaca;
}

.qrc-alert-success {
	background: #ecfdf5;
	color: #059669;
	border: 1px solid #a7f3d0;
}

.qrc-alert-info {
	background: #eff6ff;
	color: #2563eb;
	border: 1px solid #bfdbfe;
}

/* Form Fields */
.qrc-field-group {
	margin-bottom: 18px;
	text-align: left;
}

.qrc-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #334155;
	margin-bottom: 6px;
}

.qrc-req {
	color: #ef4444;
}

.qrc-input {
	width: 100% !important;
	height: 48px !important;
	padding: 10px 14px !important;
	font-size: 15px !important;
	border: 1.5px solid #cbd5e1 !important;
	border-radius: 10px !important;
	background: #ffffff !important;
	color: #0f172a !important;
	outline: none !important;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.qrc-input:focus {
	border-color: #6366f1 !important;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

.qrc-phone-wrapper {
	display: flex;
	align-items: center;
	border: 1.5px solid #cbd5e1;
	border-radius: 10px;
	background: #ffffff;
	overflow: hidden;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.qrc-phone-wrapper:focus-within {
	border-color: #6366f1;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.qrc-phone-prefix {
	padding: 0 12px;
	background: #f1f5f9;
	color: #475569;
	font-weight: 600;
	font-size: 14px;
	border-right: 1.5px solid #cbd5e1;
	height: 48px;
	display: flex;
	align-items: center;
	user-select: none;
}

.qrc-phone-input {
	border: none !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	flex: 1;
}

.qrc-field-hint {
	font-size: 11px;
	color: #94a3b8;
	margin: 6px 0 0 0;
}

/* Consent Checkbox */
.qrc-consent-group {
	margin-top: 10px;
}

.qrc-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	font-size: 12px;
	color: #64748b;
	line-height: 1.4;
}

.qrc-checkbox-label input[type="checkbox"] {
	margin-top: 2px;
	cursor: pointer;
	accent-color: #6366f1;
	width: 16px;
	height: 16px;
}

/* Submit Button */
.qrc-btn-submit {
	width: 100%;
	height: 52px;
	background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
	color: #ffffff;
	border: none;
	border-radius: 12px;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.5px;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.qrc-btn-submit:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
	background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.qrc-btn-submit:active {
	transform: translateY(1px);
}

.qrc-btn-submit:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	transform: none !important;
}

/* Spinner */
.qrc-btn-spinner {
	width: 20px;
	height: 20px;
	border: 2.5px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: qrcSpin 0.7s linear infinite;
	display: inline-block;
}

@keyframes qrcSpin {
	to { transform: rotate(360deg); }
}

/* Success Card */
.qrc-card-success {
	text-align: center;
	padding: 40px 24px;
}

.qrc-success-icon {
	position: relative;
	width: 68px;
	height: 68px;
	background: #ecfdf5;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px auto;
}

.qrc-pulse-ring {
	position: absolute;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: #10b981;
	opacity: 0.2;
	animation: qrcPulse 2s ease-out infinite;
}

@keyframes qrcPulse {
	0% { transform: scale(1); opacity: 0.4; }
	100% { transform: scale(1.6); opacity: 0; }
}

.qrc-lead-pill {
	display: inline-block;
	background: #f1f5f9;
	padding: 6px 14px;
	border-radius: 9999px;
	font-size: 13px;
	color: #334155;
	margin-top: 16px;
	border: 1px solid #e2e8f0;
}

/* Error Card */
.qrc-card-error {
	text-align: center;
	padding: 40px 24px;
}

.qrc-error-icon {
	margin-bottom: 12px;
}

.qrc-error-message {
	font-size: 14px;
	color: #64748b;
	line-height: 1.5;
}

/* Phase 5 - Scratch Card Styles */
.qrc-card-scratch {
	text-align: center;
}

.qrc-scratch-wrapper {
	position: relative;
	width: 100%;
	max-width: 360px;
	height: 220px;
	margin: 0 auto 16px auto;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
	background: #ffffff;
	border: 2px dashed #cbd5e1;
}

.qrc-scratch-canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 10;
	touch-action: none;
	user-select: none;
	cursor: crosshair;
	transition: opacity 0.4s ease;
}

.qrc-reward-card {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
	z-index: 1;
}

.qrc-reward-badge {
	font-size: 32px;
	font-weight: 900;
	color: #4f46e5;
	line-height: 1.1;
	letter-spacing: -0.5px;
	text-shadow: 0 2px 4px rgba(79, 70, 229, 0.15);
	margin-bottom: 8px;
}

.qrc-reward-code-box {
	background: #ffffff;
	border: 1.5px dashed #6366f1;
	border-radius: 10px;
	padding: 8px 14px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	width: 100%;
	max-width: 280px;
}

.qrc-reward-code-label {
	font-size: 10px;
	font-weight: 700;
	color: #64748b;
	letter-spacing: 0.5px;
}

.qrc-reward-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 18px;
	font-weight: 800;
	color: #1e293b;
	letter-spacing: 1.5px;
}

.qrc-btn-copy {
	background: #4f46e5;
	color: #ffffff;
	border: none;
	border-radius: 6px;
	padding: 4px 10px;
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
	margin-top: 2px;
	transition: background 0.2s;
}

.qrc-btn-copy:hover {
	background: #4338ca;
}

.qrc-reward-expiry {
	font-size: 11px;
	color: #64748b;
	margin-top: 6px;
}

.qrc-scratch-loader {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 14px;
	font-size: 13px;
}

/* Phase 6 - Congratulations Modal & Confetti */
.qrc-modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(15, 23, 42, 0.7);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	padding: 16px;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.qrc-modal-backdrop.qrc-modal-open {
	opacity: 1;
	visibility: visible;
}

.qrc-modal-card {
	background: #ffffff;
	border-radius: 24px;
	padding: 32px 24px 28px 24px;
	max-width: 380px;
	width: 100%;
	position: relative;
	text-align: center;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
	transform: scale(0.9) translateY(12px);
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
	border: 1px solid #e2e8f0;
}

.qrc-modal-backdrop.qrc-modal-open .qrc-modal-card {
	transform: scale(1) translateY(0);
}

.qrc-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 34px;
	height: 34px;
	border: none;
	background: #f1f5f9;
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	color: #64748b;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.qrc-modal-close:hover,
.qrc-modal-close:focus-visible {
	background: #e2e8f0;
	color: #0f172a;
	outline: none;
}

.qrc-modal-celebration-icon {
	font-size: 46px;
	line-height: 1;
	margin-bottom: 12px;
	display: inline-block;
	animation: qrcCelebrationPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes qrcCelebrationPop {
	0% { transform: scale(0) rotate(-20deg); opacity: 0; }
	60% { transform: scale(1.2) rotate(10deg); }
	100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.qrc-modal-title {
	font-size: 24px;
	font-weight: 800;
	color: #0f172a;
	margin: 0 0 6px 0;
	letter-spacing: -0.5px;
}

.qrc-modal-subtitle {
	font-size: 14px;
	color: #64748b;
	margin: 0 0 20px 0;
	line-height: 1.4;
}

.qrc-modal-reward-box {
	background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
	border: 2px dashed #6366f1;
	border-radius: 18px;
	padding: 18px 16px;
	margin-bottom: 20px;
}

.qrc-modal-discount-badge {
	font-size: 36px;
	font-weight: 900;
	color: #4f46e5;
	line-height: 1.1;
	letter-spacing: -0.5px;
	text-shadow: 0 2px 4px rgba(79, 70, 229, 0.15);
	margin-bottom: 10px;
}

.qrc-modal-code-wrapper {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 10px 14px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.qrc-modal-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 20px;
	font-weight: 800;
	color: #1e293b;
	letter-spacing: 1.5px;
}

.qrc-btn-copy-modal {
	padding: 6px 14px;
	font-size: 12px;
	font-weight: 700;
	border-radius: 8px;
	margin-top: 2px;
}

.qrc-modal-expiry {
	font-size: 11px;
	color: #64748b;
	margin-top: 8px;
}

.qrc-modal-actions {
	display: flex;
	gap: 10px;
}

.qrc-btn-continue {
	width: 100%;
	height: 48px;
	background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
	color: #ffffff;
	border: none;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
	transition: all 0.2s ease;
}

.qrc-btn-continue:hover,
.qrc-btn-continue:focus-visible {
	background: #334155;
	outline: none;
	transform: translateY(-1px);
}

.qrc-btn-continue:active {
	transform: translateY(1px);
}

/* Confetti Layer */
.qrc-confetti-canvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	pointer-events: none;
	z-index: 99999;
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.qrc-modal-backdrop,
	.qrc-modal-card,
	.qrc-modal-celebration-icon,
	.qrc-btn-continue,
	.qrc-btn-submit,
	.qrc-pulse-ring,
	.qrc-scratch-canvas {
		transition: none !important;
		animation: none !important;
		transform: none !important;
	}
	.qrc-confetti-canvas {
		display: none !important;
	}
}

