/* =======================================================
   Custom Login & Register — front-end styles
   ======================================================= */

.clr-form {
	--clr-transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	max-width: 420px;
	width: 100%;
	margin: 0 auto;
	padding: 36px 32px;
	background: var(--clr-bg, #fff);
	color: var(--clr-text, #1e1e1e);
	border-radius: calc(var(--clr-radius, 6px) * 1.5);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.06);
	box-sizing: border-box;
	overflow: visible; /* lets the search dropdown extend past short forms */
}
.clr-form * { box-sizing: border-box; }

/* Entrance animation */
.clr-form.clr-anim {
	animation: clrFadeInUp 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes clrFadeInUp {
	from { opacity: 0; transform: translateY(18px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* Logo */
.clr-logo {
	text-align: center;
	margin-bottom: 18px;
	animation: clrFadeIn 500ms ease 80ms both;
}
.clr-logo img { width: var(--clr-logo-w, 160px); max-width: 100%; height: auto; }
.clr-logo-text {
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0.2px;
	color: var(--clr-primary, #2271b1);
}
@keyframes clrFadeIn {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.clr-title {
	text-align: center;
	margin: 0 0 28px;
	font-size: 22px;
	font-weight: 700;
	animation: clrFadeIn 500ms ease 120ms both;
}

/* ---------- Legend-style floating fields ----------
   The label sits on the border line, like a <fieldset><legend>,
   and "cuts" through it using the form's own background color.
------------------------------------------------------- */
.clr-field {
	position: relative;
	margin-bottom: 24px;
	animation: clrFadeIn 450ms ease both;
}

.clr-field input[type="text"],
.clr-field input[type="email"],
.clr-field input[type="tel"],
.clr-field input[type="password"],
.clr-field select,
.clr-field textarea {
	width: 100%;
	padding: 15px 14px 13px;
	font-size: 16px; /* prevents iOS auto-zoom on focus */
	line-height: 1.3;
	color: var(--clr-text, #1e1e1e);
	background: transparent;
	border: 1.5px solid #d5d8dc;
	border-radius: var(--clr-radius, 6px);
	transition: border-color var(--clr-transition), box-shadow var(--clr-transition);
	appearance: none;
	-webkit-appearance: none;
}
.clr-field textarea { min-height: 90px; resize: vertical; }

.clr-field input:hover,
.clr-field select:hover,
.clr-field textarea:hover {
	border-color: #b7bbc0;
}

.clr-field input:focus,
.clr-field select:focus,
.clr-field textarea:focus {
	outline: none;
	border-color: var(--clr-primary, #2271b1);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--clr-primary, #2271b1) 16%, transparent);
}

/* The legend label itself */
.clr-field > label {
	position: absolute;
	top: 14px;
	left: 12px;
	padding: 0 6px;
	font-size: 16px;
	font-weight: 500;
	color: #7a7f85;
	background: transparent;
	pointer-events: none;
	transform-origin: left top;
	transition: transform var(--clr-transition), color var(--clr-transition), top var(--clr-transition), background var(--clr-transition);
	max-width: calc(100% - 24px);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	z-index: 1;
}

/* Float the label up and "notch" the border when focused or filled */
.clr-field.clr-focused > label,
.clr-field.clr-filled > label {
	top: -9px;
	transform: scale(0.82);
	background: var(--clr-bg, #fff);
	color: var(--clr-primary, #2271b1);
}
.clr-field.clr-filled:not(.clr-focused) > label {
	color: #5c6066;
}

.clr-required { color: #d63638; }

/* Checkbox fields keep a standard inline layout (no floating legend) */
.clr-field.clr-checkbox-field { display: flex; align-items: flex-start; }
.clr-checkbox-inline {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 400;
	cursor: pointer;
}
.clr-checkbox-inline input[type="checkbox"] {
	width: 17px;
	height: 17px;
	accent-color: var(--clr-primary, #2271b1);
	cursor: pointer;
}

.clr-row-between {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 22px;
	font-size: 13px;
}
.clr-row-between a {
	color: var(--clr-primary, #2271b1);
	text-decoration: none;
	transition: color var(--clr-transition);
}
.clr-row-between a:hover { color: var(--clr-primary-hover, #135e96); text-decoration: underline; }

/* Submit button with hover lift + ripple */
.clr-submit-btn {
	position: relative;
	width: 100%;
	padding: 14px;
	min-height: 48px;
	background: var(--clr-primary, #2271b1);
	color: #fff;
	border: none;
	border-radius: var(--clr-radius, 6px);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.2px;
	cursor: pointer;
	overflow: hidden;
	transition: background var(--clr-transition), transform var(--clr-transition), box-shadow var(--clr-transition);
}
.clr-submit-btn:hover {
	background: var(--clr-primary-hover, #135e96);
	transform: translateY(-1px);
	box-shadow: 0 6px 16px color-mix(in srgb, var(--clr-primary, #2271b1) 35%, transparent);
}
.clr-submit-btn:active { transform: translateY(0); }
.clr-submit-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; box-shadow: none; }

.clr-submit-btn .clr-ripple {
	position: absolute;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.55);
	transform: scale(0);
	animation: clrRipple 550ms ease-out;
	pointer-events: none;
}
@keyframes clrRipple {
	to { transform: scale(3); opacity: 0; }
}

/* Loading spinner shown inside the button while submitting */
.clr-submit-btn.clr-loading { color: transparent; }
.clr-submit-btn .clr-spinner {
	display: none;
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 18px;
	margin: -9px 0 0 -9px;
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: clrSpin 650ms linear infinite;
}
.clr-submit-btn.clr-loading .clr-spinner { display: block; }
@keyframes clrSpin {
	to { transform: rotate(360deg); }
}

/* Message banner */
.clr-message {
	padding: 12px 14px;
	border-radius: var(--clr-radius, 6px);
	margin-bottom: 18px;
	font-size: 13px;
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition: max-height 260ms ease, opacity 200ms ease, margin 260ms ease, padding 260ms ease;
}
.clr-message.clr-visible {
	max-height: 120px;
	opacity: 1;
}
.clr-message.clr-error { background: #fcf0f1; color: #d63638; border: 1px solid #f3c1c2; }
.clr-message.clr-success { background: #edfaef; color: #1a7f37; border: 1px solid #b7e4c0; }
.clr-message.clr-shake { animation: clrShake 400ms ease; }
@keyframes clrShake {
	10%, 90% { transform: translateX(-1px); }
	20%, 80% { transform: translateX(2px); }
	30%, 50%, 70% { transform: translateX(-4px); }
	40%, 60% { transform: translateX(4px); }
}

.clr-switch-link { text-align: center; margin-top: 20px; font-size: 13px; }
.clr-switch-link a {
	color: var(--clr-primary, #2271b1);
	text-decoration: none;
	transition: color var(--clr-transition);
}
.clr-switch-link a:hover { color: var(--clr-primary-hover, #135e96); text-decoration: underline; }

.clr-notice, .clr-already-logged-in { text-align: center; }

/* =======================================================
   Responsive — tablet & mobile
   ======================================================= */
@media (max-width: 600px) {
	.clr-form {
		max-width: 100%;
		padding: 26px 18px;
		border-radius: var(--clr-radius, 6px);
		box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
	}
	.clr-title { font-size: 19px; margin-bottom: 22px; }
	.clr-logo img { width: min(var(--clr-logo-w, 160px), 70%); }

	.clr-field { margin-bottom: 20px; }
	.clr-field input,
	.clr-field select,
	.clr-field textarea {
		padding: 14px 12px 12px;
		font-size: 16px; /* keep >=16px to stop mobile zoom */
	}
	.clr-field > label { font-size: 15px; top: 13px; }

	.clr-row-between {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.clr-submit-btn { padding: 14px; font-size: 15px; }
}

@media (max-width: 380px) {
	.clr-form { padding: 20px 14px; }
}


/* =======================================================
   Social login
   ======================================================= */
.clr-divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 22px 0 18px;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: #7a7f85;
}
.clr-divider::before,
.clr-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: #e2e4e7;
}

.clr-social { display: flex; gap: 10px; margin-bottom: 4px; }
.clr-social-full { flex-direction: column; }
.clr-social-icons { flex-direction: row; justify-content: center; }

.clr-social-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 46px;
	padding: 10px 14px;
	background: #fff;
	color: #1f1f1f;
	border: 1.5px solid #d5d8dc;
	border-radius: var(--clr-radius, 6px);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: transform var(--clr-transition), box-shadow var(--clr-transition), border-color var(--clr-transition), background var(--clr-transition);
}
.clr-social-btn:hover {
	transform: translateY(-1px);
	border-color: #aeb3b8;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	color: inherit;
}
.clr-social-btn:active { transform: translateY(0); }
.clr-social-apple { background: #000; border-color: #000; color: #fff; }
.clr-social-apple:hover { color: #fff; border-color: #000; }

.clr-social-icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.clr-social-icon svg,
.clr-social-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }

.clr-social-icons .clr-social-btn { width: 54px; height: 46px; padding: 0; flex: none; }
.clr-social-icons .clr-social-label {
	position: absolute;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* =======================================================
   Search box (dropdown + popup modal)
   ======================================================= */
.clr-search { position: relative; }
.clr-search-slot { margin-bottom: 22px; }

.clr-search-box {
	position: relative;
	display: flex;
	align-items: center;
}
.clr-search-box .clr-search-icon {
	position: absolute;
	left: 13px;
	color: #7a7f85;
	pointer-events: none;
}
.clr-form input.clr-search-input,
input.clr-search-input {
	width: 100%;
	min-height: 46px;
	padding: 11px 40px 11px 42px;
	font-size: 16px;
	color: var(--clr-text, #1e1e1e);
	background: transparent;
	border: 1.5px solid #d5d8dc;
	border-radius: var(--clr-radius, 6px);
	transition: border-color var(--clr-transition), box-shadow var(--clr-transition);
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
}
input.clr-search-input:focus {
	outline: none;
	border-color: var(--clr-primary, #2271b1);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--clr-primary, #2271b1) 16%, transparent);
}
.clr-search-spinner {
	display: none;
	position: absolute;
	right: 13px;
	width: 16px;
	height: 16px;
	border: 2px solid #d5d8dc;
	border-top-color: var(--clr-primary, #2271b1);
	border-radius: 50%;
	animation: clrSpin 650ms linear infinite;
}
.clr-searching .clr-search-spinner { display: block; }

.clr-search-results { display: none; }
.clr-search-results.clr-open { display: block; }

.clr-search-dropdown .clr-search-results {
	position: absolute;
	z-index: 50;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	max-height: 340px;
	overflow-y: auto;
	background: var(--clr-bg, #fff);
	border: 1px solid #e2e4e7;
	border-radius: var(--clr-radius, 6px);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
	animation: clrDrop 160ms ease both;
}
@keyframes clrDrop {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.clr-search-item {
	display: flex;
	gap: 12px;
	align-items: center;
	padding: 10px 14px;
	color: var(--clr-text, #1e1e1e);
	text-decoration: none;
	border-bottom: 1px solid #f0f1f2;
	transition: background var(--clr-transition);
}
.clr-search-item:last-child { border-bottom: 0; }
.clr-search-item:hover,
.clr-search-item.clr-active {
	background: color-mix(in srgb, var(--clr-primary, #2271b1) 8%, transparent);
	color: var(--clr-text, #1e1e1e);
}
.clr-search-thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; background: #eef0f2; }
.clr-search-text { min-width: 0; }
.clr-search-title { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.clr-search-meta { display: block; font-size: 12px; color: #7a7f85; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clr-search-type {
	display: inline-block;
	margin-right: 6px;
	padding: 1px 7px;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	color: var(--clr-primary, #2271b1);
	background: color-mix(in srgb, var(--clr-primary, #2271b1) 10%, transparent);
	border-radius: 20px;
}
.clr-search-empty { padding: 16px 14px; font-size: 13px; color: #7a7f85; text-align: center; }

/* Modal mode */
.clr-search-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 18px;
	color: var(--clr-primary, #2271b1);
	background: transparent;
	border: 1.5px solid var(--clr-primary, #2271b1);
	border-radius: var(--clr-radius, 6px);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--clr-transition), color var(--clr-transition), transform var(--clr-transition);
}
.clr-search-trigger:hover { background: var(--clr-primary, #2271b1); color: #fff; transform: translateY(-1px); }
.clr-search-slot .clr-search-trigger { width: 100%; justify-content: center; }

.clr-search-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 8vh 16px 16px;
}
.clr-search-modal[hidden] { display: none; }
.clr-search-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 18, 25, 0.55);
	backdrop-filter: blur(3px);
	animation: clrFadeIn 200ms ease both;
}
.clr-search-dialog {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: 84vh;
	display: flex;
	flex-direction: column;
	padding: 24px 20px 16px;
	background: var(--clr-bg, #fff);
	color: var(--clr-text, #1e1e1e);
	border-radius: calc(var(--clr-radius, 6px) * 1.5);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
	animation: clrModalIn 240ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes clrModalIn {
	from { opacity: 0; transform: translateY(-14px) scale(0.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}
.clr-search-close {
	position: absolute;
	top: 6px;
	right: 10px;
	width: 34px;
	height: 34px;
	font-size: 26px;
	line-height: 1;
	color: #7a7f85;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: background var(--clr-transition), color var(--clr-transition);
}
.clr-search-close:hover { background: #f0f1f2; color: #1e1e1e; }
.clr-search-modal .clr-search-box { margin-top: 14px; }
.clr-search-modal .clr-search-results { margin-top: 10px; overflow-y: auto; }
body.clr-modal-open { overflow: hidden; }

@media (max-width: 600px) {
	.clr-search-modal { padding: 0; align-items: stretch; }
	.clr-search-dialog { max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; padding: 20px 14px 12px; }
	.clr-social-btn { min-height: 48px; }
}

/* Hidden banner must take no space */
.clr-message:not(.clr-visible) {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	margin-bottom: 0 !important;
	border-width: 0 !important;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
	.clr-form,
	.clr-logo,
	.clr-title,
	.clr-field,
	.clr-submit-btn,
	.clr-message,
	.clr-search-modal,
	.clr-search-backdrop,
	.clr-search-dialog,
	.clr-search-results,
	.clr-social-btn {
		animation: none !important;
		transition: none !important;
	}
}
