/* CRMove — Front-end styles
   Uses Ollie theme CSS custom properties (--wp--preset--color--*, etc.)
*/

/* ── Utility ─────────────────────────────────────────────────────────── */

.is-hidden {
	display: none !important;
}

/* ── Layout ──────────────────────────────────────────────────────────── */

.crmove-wrap {
	max-width: 740px;
	margin: 0 auto;
}

/* ── Section cards ───────────────────────────────────────────────────── */

.crmove-section {
	margin-bottom: clamp(1.5rem, 4vw, 2rem);
	padding: clamp(1.5rem, 4vw, 2rem);
	background: var(--wp--preset--color--base, #fff);
	border: 1px solid var(--wp--preset--color--border-light, #E3E3F0);
	border-radius: 1.25rem;
	box-shadow: 0px 3px 6px 0px rgba(20, 17, 31, 0.03),
		0px 1px 1px 0px rgba(20, 17, 31, 0.03);
}

.crmove-section h2 {
	margin-top: 0;
	margin-bottom: 1.5rem;
	font-size: var(--wp--preset--font-size--base, 1.165rem);
	font-weight: 600;
	color: var(--wp--preset--color--main, #1E1E26);
	line-height: 1.2;
}

/* ── Form ────────────────────────────────────────────────────────────── */

#crmove-credentials-form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.crmove-field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}

.crmove-field span {
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	font-weight: 500;
	color: var(--wp--preset--color--secondary, #545473);
}

.crmove-field input[type="text"],
.crmove-field input[type="password"],
.crmove-field select {
	width: 100%;
	padding: 0.625rem 0.875rem;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small, 1rem);
	color: var(--wp--preset--color--main, #1E1E26);
	background: var(--wp--preset--color--base, #fff);
	border: 1px solid var(--wp--preset--color--border-light, #E3E3F0);
	border-radius: 0.75rem;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	appearance: none;
	-webkit-appearance: none;
}

.crmove-field select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23545473' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	padding-right: 2.5rem;
	cursor: pointer;
}

.crmove-field input:focus,
.crmove-field select:focus {
	border-color: var(--wp--preset--color--primary, #5344F4);
	box-shadow: 0 0 0 3px var(--wp--preset--color--primary-accent, #e9e7ff);
}

.crmove-form-actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
	padding-top: 0.5rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */

.crmove-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.6em 1.25em;
	background: var(--wp--preset--color--main, #1E1E26);
	color: var(--wp--preset--color--base, #fff);
	border: 1px solid transparent;
	border-radius: 0.5rem;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small, 1rem);
	font-weight: 500;
	line-height: 1;
	cursor: pointer;
	text-decoration: none;
	transition: opacity 0.15s ease, background 0.15s ease;
	white-space: nowrap;
}

.crmove-btn:hover {
	opacity: 0.85;
	color: var(--wp--preset--color--base, #fff);
	text-decoration: none;
}

.crmove-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.crmove-btn--secondary {
	background: transparent;
	color: var(--wp--preset--color--secondary, #545473);
	border-color: var(--wp--preset--color--border-light, #E3E3F0);
}

.crmove-btn--secondary:hover {
	color: var(--wp--preset--color--main, #1E1E26);
	border-color: var(--wp--preset--color--main-accent, #d4d4ec);
}

.crmove-btn--outline {
	background: transparent;
	color: var(--wp--preset--color--primary, #5344F4);
	border-color: var(--wp--preset--color--primary, #5344F4);
}

.crmove-btn--outline:hover {
	background: var(--wp--preset--color--primary-accent, #e9e7ff);
	color: var(--wp--preset--color--primary, #5344F4);
}

.crmove-btn--success {
	background: #16a34a;
	color: #fff;
}

.crmove-btn--danger {
	background: #dc2626;
	color: #fff;
}

.crmove-btn--danger:hover {
	opacity: 0.85;
	color: #fff;
}

/* ── Export controls (pause / resume / cancel) ───────────────────────── */

.crmove-export-controls {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.75rem;
	flex-wrap: wrap;
}

/* ── Separator between credentials form and test button ─────────────── */

#crmove-credentials-form+.crmove-form-actions {
	margin-top: 1rem;
}

/* ── Feedback messages ───────────────────────────────────────────────── */

.crmove-feedback {
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	font-weight: 500;
}

.crmove-feedback--ok {
	color: #16a34a;
}

.crmove-feedback--error {
	color: #dc2626;
}

/* ── Notices ─────────────────────────────────────────────────────────── */

.crmove-notice {
	padding: 0.875rem 1rem;
	border-left: 3px solid var(--wp--preset--color--primary, #5344F4);
	background: var(--wp--preset--color--primary-accent, #e9e7ff);
	border-radius: 0 0.5rem 0.5rem 0;
	color: var(--wp--preset--color--main, #1E1E26);
	font-size: var(--wp--preset--font-size--small, 1rem);
}

.crmove-wrap>.crmove-notice {
	margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

.crmove-notice--freemium {
	border-color: #7c3aed;
	background: #f5f3ff;
}

.crmove-notice--warning {
	border-color: #d97706;
	background: #fffbeb;
}

.crmove-notice__cta {
	margin-top: 1rem;
}

.crmove-suspended {
	padding: clamp(1.5rem, 4vw, 2rem);
	background: #fef2f2;
	border: 1px solid #fca5a5;
	border-radius: 1.25rem;
	text-align: center;
}

.crmove-limit-notice {
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	color: var(--wp--preset--color--secondary, #545473);
	margin: 0 0 1.25rem;
}

/* ── Progress bar ────────────────────────────────────────────────────── */

.crmove-progress {
	margin-top: 1.25rem;
	padding: 0.875rem 1rem;
	border: 1px solid transparent;
	border-radius: 0.75rem;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.crmove-progress--running {
	background: #eff6ff;
	border-color: #bfdbfe;
}

.crmove-progress--running .crmove-progress__label {
	color: #1d4ed8;
}

.crmove-progress--done {
	background: #f0fdf4;
	border-color: #bbf7d0;
}

.crmove-progress--done .crmove-progress__label {
	color: #15803d;
}

.crmove-progress--paused {
	background: #fffbeb;
	border-color: #fde68a;
}

.crmove-progress--paused .crmove-progress__label {
	color: #b45309;
}

.crmove-progress--error {
	background: #fef2f2;
	border-color: #fecaca;
}

.crmove-progress--error .crmove-progress__label {
	color: #dc2626;
}

.crmove-progress--cancelled {
	background: #f3f4f6;
	border-color: #d1d5db;
}

.crmove-progress--cancelled .crmove-progress__label {
	color: var(--wp--preset--color--secondary, #545473);
}

.crmove-progress__header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: 0.375rem;
	gap: 0.5rem;
}

.crmove-progress__label {
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	font-weight: 600;
	color: var(--wp--preset--color--main, #1E1E26);
	flex-shrink: 0;
}

.crmove-progress__meta {
	display: flex;
	justify-content: flex-end;
	align-items: baseline;
	gap: 0.5rem;
	flex: 1;
	min-width: 0;
}

.crmove-progress__count {
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	color: var(--wp--preset--color--secondary, #545473);
	flex: 1;
}

.crmove-progress__percent {
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	font-weight: 600;
	color: var(--wp--preset--color--main, #1E1E26);
	white-space: nowrap;
}

.crmove-progress__bar {
	height: 10px;
	background: rgba(255, 255, 255, 0.65);
	border-radius: 99px;
	overflow: hidden;
}

.crmove-progress__fill {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #7c5af6 0%, #5344F4 50%, #3b82f6 100%);
	border-radius: 99px;
	transition: width 0.4s ease;
}

.crmove-progress__message {
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	color: var(--wp--preset--color--secondary, #545473);
	margin: 0.375rem 0 0;
	text-align: right;
}

/* ── Export section actions ──────────────────────────────────────────── */

#crmove-download-contacts,
#crmove-download-history {
	margin-top: 1rem;
}

/* ── Export debug log ─────────────────────────────────────────────────── */

.crmove-log {
	margin-top: 1rem;
	border: 1px solid var(--wp--preset--color--border-light, #E3E3F0);
	border-radius: 0.5rem;
	overflow: hidden;
}

.crmove-log__entries {
	max-height: 14rem;
	overflow-y: auto;
	padding: 0.5rem 0.75rem;
	font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
	font-size: 0.75rem;
	line-height: 1.6;
	color: var(--wp--preset--color--contrast, #1E1E26);
	background: var(--wp--preset--color--base, #fff);
}

.crmove-log__line {
	display: flex;
	gap: 0.75rem;
	border-bottom: 1px solid var(--wp--preset--color--border-light, #E3E3F0);
	padding: 0.15rem 0;
}

.crmove-log__line:last-child {
	border-bottom: none;
}

.crmove-log__time {
	color: var(--wp--preset--color--secondary, #545473);
	flex-shrink: 0;
}

/* ── Auth forms (login / register) ───────────────────────────────────── */

.crmove-auth-form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.crmove-fields-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
}

@media (max-width: 540px) {
	.crmove-fields-row {
		grid-template-columns: 1fr;
	}
}

.crmove-required {
	color: #dc2626;
	font-weight: 700;
	margin-left: 2px;
}

.crmove-input {
	display: block;
	width: 100%;
	padding: 0.625rem 0.75rem;
	border: 1px solid var(--wp--preset--color--border-light, #E3E3F0);
	border-radius: 0.5rem;
	font-size: var(--wp--preset--font-size--small, 1rem);
	color: var(--wp--preset--color--main, #1E1E26);
	background: var(--wp--preset--color--base, #fff);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	font-family: inherit;
}

.crmove-input:focus {
	outline: none;
	border-color: var(--wp--preset--color--primary, #5344F4);
	box-shadow: 0 0 0 3px var(--wp--preset--color--primary-accent, #e9e7ff);
}

.crmove-input:disabled {
	background: var(--wp--preset--color--tertiary, #f8f7fc);
	color: var(--wp--preset--color--secondary, #545473);
	cursor: not-allowed;
}

.crmove-auth-form label {
	display: block;
	font-weight: 500;
	color: var(--wp--preset--color--main, #1E1E26);
	margin-bottom: 0.375rem;
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
}

.crmove-auth-form label input[type="checkbox"] {
	margin-right: 0.375rem;
}

.cf-turnstile {
	margin-top: 0.5rem;
}

.crmove-auth-link {
	margin-top: 1.25rem;
	text-align: center;
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	color: var(--wp--preset--color--secondary, #545473);
}

.crmove-auth-link a {
	color: var(--wp--preset--color--primary, #5344F4);
	text-decoration: none;
	font-weight: 500;
}

.crmove-auth-link a:hover {
	text-decoration: underline;
}

/* ── Export toolbar ── */

.crmove-export-toolbar {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-bottom: 0.75rem;
}

.crmove-toolbar-fields {
	display: flex;
	align-items: flex-end;
	gap: 1rem;
}

.crmove-toolbar-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.crmove-toolbar-label {
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	font-weight: 500;
	color: var(--wp--preset--color--secondary, #545473);
	white-space: nowrap;
}

.crmove-toolbar-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.crmove-input--limit {
	width: 10rem;
	padding: 0.4rem 0.625rem;
	border: 1px solid var(--wp--preset--color--border-light, #E3E3F0);
	border-radius: 0.5rem;
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	color: var(--wp--preset--color--main, #1E1E26);
	background: var(--wp--preset--color--base, #fff);
	font-family: inherit;
	flex-shrink: 0;
}

.crmove-input--limit:focus {
	outline: none;
	border-color: var(--wp--preset--color--primary, #5344F4);
	box-shadow: 0 0 0 3px var(--wp--preset--color--primary-accent, #e9e7ff);
}

.crmove-input--delay {
	width: 6rem;
	padding: 0.4rem 0.625rem;
	border: 1px solid var(--wp--preset--color--border-light, #E3E3F0);
	border-radius: 0.5rem;
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	color: var(--wp--preset--color--main, #1E1E26);
	background: var(--wp--preset--color--base, #fff);
	font-family: inherit;
	flex-shrink: 0;
}

.crmove-input--delay:focus {
	outline: none;
	border-color: var(--wp--preset--color--primary, #5344F4);
	box-shadow: 0 0 0 3px var(--wp--preset--color--primary-accent, #e9e7ff);
}

.crmove-input--delay:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.crmove-export-toolbar .crmove-export-controls {
	display: contents;
}

/* ── Form inline error (login / register) ────────────────────────────── */

.crmove-form-error {
	padding: 0.75rem 1rem;
	border-left: 3px solid #dc2626;
	background: #fef2f2;
	border-radius: 0 0.5rem 0.5rem 0;
	color: #991b1b;
	font-size: var(--wp--preset--font-size--x-small, 0.875rem);
	font-weight: 500;
	line-height: 1.5;
}