/**
 * CompliancePilot Forms — cp-forms.css
 * Styles for [cp_form] shortcode output.
 *
 * Uses CSS custom properties so themes can override colours by setting:
 *   --cp-form-accent: <color>;
 *   --cp-form-error:  <color>;
 *
 * @since 3.0.0
 */

:root {
	--cp-form-accent:       #4ecca3;
	--cp-form-accent-dark:  #3db892;
	--cp-form-error:        #e94560;
	--cp-form-border:       #d0d0d0;
	--cp-form-bg:           #ffffff;
	--cp-form-text:         inherit;
	--cp-form-radius:       6px;
	--cp-form-submit-text:  #1a1a2e;
}

/* -------------------------------------------------------------------------
   Outer centering wrapper (added in v3.1)
   ---------------------------------------------------------------------- */

.cp-form-wrap {
	display: flex;
	justify-content: center;
	width: 100%;
	text-align: left; /* reset any theme text-align: center inheritance */
}

/* -------------------------------------------------------------------------
   Form wrapper
   ---------------------------------------------------------------------- */

.cp-form {
	max-width: 600px;
	width: 100%;
	margin: 0 auto;
	font-family: inherit;
	font-size: inherit;
	color: var(--cp-form-text);
	box-sizing: border-box;
}

.cp-form *,
.cp-form *::before,
.cp-form *::after {
	box-sizing: inherit;
}

/* -------------------------------------------------------------------------
   Fields
   ---------------------------------------------------------------------- */

.cp-form-fields {
	display: flex;
	flex-direction: column;
	gap: 1.1rem;
}

.cp-field {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.cp-field label,
.cp-field legend {
	font-weight: 600;
	font-size: 0.925rem;
	line-height: 1.4;
	color: var(--cp-form-text);
	display: block;
	padding: 0;
	margin: 0;
	border: none;
}

.cp-required {
	color: var(--cp-form-error);
	margin-left: 2px;
}

/* Text-like inputs */
.cp-field input[type="text"],
.cp-field input[type="email"],
.cp-field input[type="tel"],
.cp-field input[type="url"],
.cp-field input[type="number"],
.cp-field textarea,
.cp-field select {
	display: block;
	width: 100%;
	padding: 0.55rem 0.75rem;
	border: 1px solid var(--cp-form-border);
	border-radius: var(--cp-form-radius);
	font-size: 1rem;
	font-family: inherit;
	background: var(--cp-form-bg);
	color: var(--cp-form-text);
	line-height: 1.5;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
	appearance: none;
	-webkit-appearance: none;
}

.cp-field input:focus,
.cp-field textarea:focus,
.cp-field select:focus {
	outline: none;
	border-color: var(--cp-form-accent);
	box-shadow: 0 0 0 3px rgba(78, 204, 163, 0.18);
}

.cp-field textarea {
	resize: vertical;
	min-height: 130px;
}

.cp-field select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	padding-right: 2.25rem;
	cursor: pointer;
}

/* Error state */
.cp-field.cp-has-error input,
.cp-field.cp-has-error textarea,
.cp-field.cp-has-error select {
	border-color: var(--cp-form-error);
	box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.12);
}

.cp-field-error {
	color: var(--cp-form-error);
	font-size: 0.83rem;
	line-height: 1.4;
	min-height: 1.2em;
}

/* -------------------------------------------------------------------------
   Checkboxes and radios
   ---------------------------------------------------------------------- */

.cp-field fieldset {
	border: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.cp-checkbox-label,
.cp-radio-label {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	font-weight: 400;
	cursor: pointer;
	line-height: 1.45;
}

.cp-checkbox-label input,
.cp-radio-label input {
	margin-top: 0.15em;
	flex-shrink: 0;
	accent-color: var(--cp-form-accent);
}

/* -------------------------------------------------------------------------
   Conditional fields
   ---------------------------------------------------------------------- */

.cp-conditional {
	transition: opacity 0.15s ease;
}

/* -------------------------------------------------------------------------
   Submit button
   ---------------------------------------------------------------------- */

.cp-form-submit,
.cp-form .cp-form-submit,
.cp-form button[type="submit"] {
	display: inline-block !important;
	margin-top: 0.75rem !important;
	padding: 0.7rem 2.25rem !important;
	background: var(--cp-form-accent) !important;
	background-color: #4ecca3 !important;
	color: var(--cp-form-submit-text) !important;
	color: #1a1a2e !important;
	border: none !important;
	border-radius: var(--cp-form-radius) !important;
	font-size: 1rem !important;
	font-weight: 700 !important;
	font-family: inherit !important;
	cursor: pointer !important;
	line-height: 1 !important;
	transition: background 0.18s ease, transform 0.1s ease, opacity 0.18s;
	-webkit-appearance: none !important;
	appearance: none !important;
	visibility: visible !important;
	opacity: 1 !important;
	text-shadow: none !important;
	box-shadow: none !important;
	min-width: 120px !important;
}

.cp-form-submit:hover:not(:disabled),
.cp-form .cp-form-submit:hover:not(:disabled),
.cp-form button[type="submit"]:hover:not(:disabled) {
	background: var(--cp-form-accent-dark) !important;
	background-color: #3db892 !important;
}

.cp-form-submit:active:not(:disabled) {
	transform: scale(0.97);
}

.cp-form-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

/* -------------------------------------------------------------------------
   Response message
   ---------------------------------------------------------------------- */

.cp-form-response {
	display: none;
	margin: 1rem 0 0.5rem;
	padding: 0.7rem 1rem;
	border-radius: var(--cp-form-radius);
	font-size: 0.95rem;
	line-height: 1.5;
}

.cp-form-response:not(:empty) {
	display: block;
}

.cp-response-success {
	background: rgba(78, 204, 163, 0.12);
	color: #2a7a5f;
	border: 1px solid rgba(78, 204, 163, 0.35);
}

.cp-response-error {
	background: rgba(233, 69, 96, 0.08);
	color: #b0282e;
	border: 1px solid rgba(233, 69, 96, 0.3);
}

/* -------------------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------------- */

@media (max-width: 480px) {
	.cp-form-submit {
		width: 100%;
		text-align: center;
	}
}
