/**
 * Frontend Styles - JobRoller Referral Survey
 */

:root {
	--jr-survey-primary: #2c5b8b;
	--jr-survey-primary-hover: #1c3f66;
	--jr-survey-text: #1e293b;
	--jr-survey-muted: #64748b;
	--jr-survey-border: #e2e8f0;
	--jr-survey-bg: #ffffff;
}

/* Responsive Styling for Mobile & Tablet when enabled */
@media (max-width: 767px) {
	.jr-referral-popup {
		bottom: 12px !important;
		right: 12px !important;
		left: 12px !important;
		width: auto !important;
		max-width: none !important;
	}
	.jr-popup-card {
		padding: 16px !important;
		border-radius: 10px !important;
	}
	.jr-radio-label {
		padding: 9px 12px !important;
		font-size: 14px !important;
	}
	.jr-options-container {
		max-height: 180px !important;
	}
}

@media (min-width: 768px) and (max-width: 1023px) {
	.jr-referral-popup {
		bottom: 20px !important;
		right: 20px !important;
		width: 320px !important;
	}
}

/* Popup Container */
.jr-referral-popup {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 320px;
	max-width: calc(100vw - 48px);
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	line-height: 1.45;
	transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.jr-referral-popup.jr-popup-hidden {
	opacity: 0;
	transform: translateY(25px) scale(0.96);
	pointer-events: none;
}

.jr-referral-popup.jr-popup-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Popup Card Box */
.jr-popup-card {
	position: relative;
	background: var(--jr-survey-bg);
	border: 1px solid var(--jr-survey-border);
	border-radius: 12px;
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05);
	padding: 20px;
	overflow: hidden;
}

/* Close Button */
.jr-popup-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: transparent;
	border: none;
	color: #94a3b8;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: all 0.2s ease;
}

.jr-popup-close:hover {
	background: #f1f5f9;
	color: #334155;
	transform: rotate(90deg);
}

.jr-popup-close:focus-visible {
	outline: 2px solid var(--jr-survey-primary);
	outline-offset: 2px;
}

/* Header */
.jr-popup-header {
	margin-bottom: 14px;
	padding-right: 20px;
}

.jr-popup-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--jr-survey-primary);
	background: rgba(44, 91, 139, 0.08);
	padding: 3px 8px;
	border-radius: 20px;
	margin-bottom: 8px;
}

.jr-popup-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--jr-survey-text);
	margin: 0 0 4px 0;
	line-height: 1.35;
}

.jr-popup-subtitle {
	font-size: 12px;
	color: var(--jr-survey-muted);
	margin: 0;
}

/* Form & Radios */
.jr-survey-form {
	margin: 0;
	padding: 0;
}

.jr-options-container {
	display: flex;
	flex-direction: column;
	gap: 7px;
	margin-bottom: 12px;
	max-height: 220px;
	overflow-y: auto;
	padding-right: 4px;
}

/* Scrollbar for options container if list is long */
.jr-options-container::-webkit-scrollbar {
	width: 4px;
}
.jr-options-container::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 4px;
}

.jr-radio-label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 10px;
	border: 1px solid var(--jr-survey-border);
	border-radius: 8px;
	cursor: pointer;
	background: #f8fafc;
	transition: all 0.15s ease;
	font-size: 13px;
	color: #334155;
	user-select: none;
}

.jr-radio-label:hover {
	background: #ffffff;
	border-color: #cbd5e1;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.jr-radio-input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.jr-radio-custom {
	width: 16px;
	height: 16px;
	min-width: 16px;
	border-radius: 50%;
	border: 1.5px solid #94a3b8;
	display: inline-block;
	position: relative;
	transition: all 0.2s ease;
	background: #ffffff;
}

.jr-radio-input:checked + .jr-radio-custom {
	border-color: var(--jr-survey-primary);
	background: var(--jr-survey-primary);
}

.jr-radio-input:checked + .jr-radio-custom::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #ffffff;
	transform: translate(-50%, -50%);
}

.jr-radio-input:checked ~ .jr-radio-text {
	font-weight: 600;
	color: var(--jr-survey-text);
}

.jr-radio-label:has(.jr-radio-input:checked) {
	border-color: var(--jr-survey-primary);
	background: rgba(44, 91, 139, 0.04);
}

/* Other Input Field */
.jr-other-field-wrap {
	margin-bottom: 12px;
	animation: jrFadeSlide 0.2s ease-out;
}

.jr-text-input {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font-size: 13px;
	color: var(--jr-survey-text);
	outline: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.jr-text-input:focus {
	border-color: var(--jr-survey-primary);
	box-shadow: 0 0 0 3px rgba(44, 91, 139, 0.15);
}

/* Submit Button */
.jr-popup-actions {
	display: flex;
}

.jr-survey-submit-btn {
	width: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--jr-survey-primary);
	color: #ffffff;
	font-size: 13px;
	font-weight: 600;
	padding: 9px 16px;
	border: none;
	border-radius: 7px;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.1s ease;
}

.jr-survey-submit-btn:hover {
	filter: brightness(0.92);
}

.jr-survey-submit-btn:active {
	transform: scale(0.98);
}

.jr-survey-submit-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.jr-btn-spinner {
	display: none;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	margin-left: 8px;
	animation: jrSpin 0.7s linear infinite;
}

.jr-survey-submit-btn.loading .jr-btn-spinner {
	display: inline-block;
}

/* Success Card */
.jr-survey-success {
	text-align: center;
	padding: 20px 10px;
	animation: jrFadeSlide 0.3s ease-out;
}

.jr-success-icon {
	color: #10b981;
	margin-bottom: 12px;
	display: flex;
	justify-content: center;
}

.jr-survey-success h5 {
	margin: 0 0 6px 0;
	font-size: 16px;
	color: var(--jr-survey-text);
}

.jr-survey-success p {
	margin: 0;
	font-size: 13px;
	color: var(--jr-survey-muted);
}

/* Animations */
@keyframes jrSpin {
	to { transform: rotate(360deg); }
}

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