/* Zicform Frontend Styles */

.zicform-form-wrapper {
	box-sizing: border-box;
	position: relative;
}

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

.zicform-form {
	width: 100%;
}

/* Fields Grid */
.zicform-fields-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0 16px;
}

.zicform-field-wrap {
	width: 100%;
	margin-bottom: 16px;
}

.zicform-width-full  { width: 100%; }
.zicform-width-half  { width: calc(50% - 8px); }
.zicform-width-third { width: calc(33.333% - 11px); }

@media (max-width: 640px) {
	.zicform-width-half,
	.zicform-width-third {
		width: 100%;
	}
}

/* Labels */
.zicform-label {
	display: block;
	font-weight: 600;
	margin-bottom: 6px;
	font-size: 0.9em;
}

.zicform-group-label {
	display: block;
	font-weight: 600;
	margin-bottom: 8px;
	font-size: 0.9em;
}

.zicform-required {
	color: #e53e3e;
	margin-left: 3px;
}

/* Inputs */
.zicform-input,
.zicform-textarea,
.zicform-select {
	display: block;
	width: 100%;
	padding: 12px 16px;
	border: 1.5px solid #e2e8f0;
	border-radius: 10px;
	font-size: 15px;
	line-height: 1.5;
	color: #1e293b;
	background-color: #ffffff;
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
	font-family: inherit;
	appearance: none;
	-webkit-appearance: none;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.zicform-input::placeholder,
.zicform-textarea::placeholder {
	color: #94a3b8;
}

.zicform-select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5l6 6 6-6' stroke='%2364748b' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 16px center;
	padding-right: 42px;
	cursor: pointer;
}

.zicform-textarea {
	resize: vertical;
	min-height: 112px;
}

.zicform-input:hover,
.zicform-textarea:hover,
.zicform-select:hover {
	border-color: #cbd5e1;
}

.zicform-input:focus,
.zicform-textarea:focus,
.zicform-select:focus {
	outline: none;
	border-color: #4f46e5;
	box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
	background-color: #ffffff;
}

/* Field validation states */
.zicform-input.zicform-invalid,
.zicform-textarea.zicform-invalid,
.zicform-select.zicform-invalid {
	border-color: #ef4444;
	box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

.zicform-field-error {
	display: none;
	color: #e53e3e;
	font-size: 0.82em;
	margin-top: 4px;
}

.zicform-field-error.visible {
	display: block;
}

.zicform-field-hint {
	display: block;
	color: #6b7280;
	font-size: 0.8em;
	margin-top: 4px;
}

/* File upload */
.zicform-file {
	display: block;
	width: 100%;
	padding: 14px 16px;
	border: 2px dashed #cbd5e1;
	border-radius: 10px;
	font-size: 14px;
	cursor: pointer;
	background: #f8fafc;
	color: #64748b;
	transition: border-color 0.18s ease, background-color 0.18s ease;
}

.zicform-file:hover {
	border-color: #4f46e5;
	background: #f5f3ff;
}

.zicform-file:focus {
	outline: none;
	border-color: #4f46e5;
	box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

/* Radio & Checkbox — modern card style */
.zicform-radio-group,
.zicform-checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.zicform-radio-label,
.zicform-checkbox-label {
	display: flex;
	align-items: center;
	gap: 11px;
	cursor: pointer;
	font-weight: 400;
	font-size: 0.95em;
	padding: 11px 14px;
	border: 1.5px solid #e2e8f0;
	border-radius: 10px;
	background: #ffffff;
	transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.zicform-radio-label:hover,
.zicform-checkbox-label:hover {
	border-color: #c7d2fe;
	background: #f8faff;
}

/* The actual native control, restyled */
.zicform-radio,
.zicform-checkbox {
	appearance: none;
	-webkit-appearance: none;
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	margin: 0;
	border: 1.5px solid #cbd5e1;
	background: #fff;
	cursor: pointer;
	position: relative;
	transition: border-color 0.16s ease, background-color 0.16s ease;
}
.zicform-radio { border-radius: 50%; }
.zicform-checkbox { border-radius: 6px; }

.zicform-radio:hover,
.zicform-checkbox:hover {
	border-color: #4f46e5;
}

.zicform-radio:checked,
.zicform-checkbox:checked {
	background: #4f46e5;
	border-color: #4f46e5;
}

/* Radio dot */
.zicform-radio:checked::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
	transform: translate(-50%, -50%);
}

/* Checkbox tick */
.zicform-checkbox:checked::after {
	content: '';
	position: absolute;
	top: 46%;
	left: 50%;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: translate(-50%, -55%) rotate(45deg);
}

.zicform-radio:focus-visible,
.zicform-checkbox:focus-visible {
	outline: none;
	box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
}

/* Highlight the whole label row when its control is checked */
.zicform-radio-label:has(.zicform-radio:checked),
.zicform-checkbox-label:has(.zicform-checkbox:checked) {
	border-color: #4f46e5;
	background: #f5f3ff;
}

/* Honeypot */
.zicform-hp-wrap {
	position: absolute !important;
	left: -9999px !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* Submit button */
.zicform-submit-wrap {
	margin-top: 8px;
}

.zicform-submit-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 28px;
	background-color: #4f46e5;
	color: #ffffff;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: filter 0.15s ease, transform 0.1s ease;
	text-decoration: none;
}

.zicform-submit-btn:hover {
	filter: brightness(90%);
}

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

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

/* Spinner */
.zicform-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255,255,255,0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: zicform-spin 0.7s linear infinite;
	flex-shrink: 0;
}

@keyframes zicform-spin {
	to { transform: rotate(360deg); }
}

/* Messages */
.zicform-messages {
	margin-top: 16px;
}

.zicform-success-message {
	padding: 14px 18px;
	background-color: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-left: 4px solid #22c55e;
	border-radius: 10px;
	color: #166534;
	font-size: 0.95em;
	line-height: 1.5;
}

.zicform-error-message {
	padding: 14px 18px;
	background-color: #fef2f2;
	border: 1px solid #fecaca;
	border-left: 4px solid #e53e3e;
	border-radius: 10px;
	color: #991b1b;
	font-size: 0.95em;
	line-height: 1.5;
}

/* Shortcode preview error (admin only) */
.zicform-shortcode-error {
	color: #e53e3e !important;
	font-style: italic;
}

/* ===== Name Fields ===== */
.zicform-name-group { display: flex; flex-wrap: wrap; gap: 10px; }
.zicform-name-part { flex: 1 1 120px; display: flex; flex-direction: column; gap: 4px; }
.zicform-name-part label { font-size: 11px; color: #6b7280; font-weight: 600; }

/* ===== Address Fields ===== */
.zicform-address-group { display: flex; flex-direction: column; gap: 10px; }
.zicform-address-row { display: flex; flex-direction: column; gap: 4px; }
.zicform-address-row label { font-size: 11px; color: #6b7280; font-weight: 600; }
.zicform-address-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .zicform-address-cols { grid-template-columns: 1fr; } }

/* ===== Section Break ===== */
.zicform-section-break { padding: 8px 0 !important; }
.zicform-section-title { font-size: 16px; font-weight: 700; margin: 0 0 6px; color: inherit; }
.zicform-section-content { font-size: 14px; color: #6b7280; margin-bottom: 10px; }
.zicform-section-rule { border: none; border-top: 2px solid #e5e7eb; margin: 0; }

/* ===== Multiple Choice ===== */
.zicform-multiple-choice { display: flex; flex-wrap: wrap; gap: 10px; }
.zicform-mc-option { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1.5px solid #e2e8f0; border-radius: 10px; cursor: pointer; font-size: 14px; background: #fff; transition: all 0.16s ease; box-shadow: 0 1px 2px rgba(15,23,42,0.04); }
.zicform-mc-option:hover { border-color: #c7d2fe; background: #f8faff; }
.zicform-mc-option input[type=checkbox], .zicform-mc-option input[type=radio] { display: none; }
.zicform-mc-option:has(input:checked) { border-color: #4f46e5; background: #f5f3ff; color: #4f46e5; font-weight: 600; box-shadow: 0 0 0 1px #4f46e5; }

/* ===== Checkable Grid ===== */
.zicform-checkable-grid { overflow-x: auto; }
.zicform-checkable-grid table { width: 100%; border-collapse: collapse; font-size: 13px; }
.zicform-checkable-grid th, .zicform-checkable-grid td { padding: 8px 12px; border: 1px solid #e5e7eb; text-align: center; }
.zicform-checkable-grid th { background: #f9fafb; font-weight: 600; }
.zicform-checkable-grid td:first-child { text-align: left; font-weight: 500; }

/* ===== Ratings ===== */
.zicform-ratings { display: flex; gap: 4px; flex-direction: row-reverse; justify-content: flex-end; }
.zicform-rating-star { cursor: pointer; font-size: 28px; color: #d1d5db; transition: color 0.1s; }
.zicform-rating-star input { display: none; }
.zicform-ratings .zicform-rating-star:hover,
.zicform-ratings .zicform-rating-star:hover ~ .zicform-rating-star,
.zicform-ratings .zicform-rating-star:has(input:checked),
.zicform-ratings .zicform-rating-star:has(input:checked) ~ .zicform-rating-star { color: #f59e0b; }

/* ===== Net Promoter Score ===== */
.zicform-nps-scale { display: flex; gap: 4px; flex-wrap: wrap; }
.zicform-nps-option { cursor: pointer; }
.zicform-nps-option input { display: none; }
.zicform-nps-option span { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 2px solid #e5e7eb; border-radius: 6px; font-weight: 700; font-size: 14px; transition: all 0.15s; }
.zicform-nps-option:hover span { border-color: #4f46e5; background: #eef2ff; }
.zicform-nps-option:has(input:checked) span { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.zicform-nps-labels { display: flex; justify-content: space-between; font-size: 11px; color: #9ca3af; margin-top: 6px; }

/* ===== Range Slider ===== */
.zicform-range-wrap { display: flex; align-items: center; gap: 12px; }
.zicform-range { flex: 1; cursor: pointer; accent-color: #4f46e5; }
.zicform-range-wrap o { font-weight: 700; color: #4f46e5; min-width: 36px; text-align: right; font-style: normal; }

/* ===== Color Picker ===== */
.zicform-color-field { width: 60px; height: 40px; padding: 2px; border-radius: 6px; cursor: pointer; }

/* ===== Date/Time ===== */
.zicform-datetime-group { display: flex; gap: 10px; flex-wrap: wrap; }
.zicform-datetime-group input { flex: 1 1 140px; }

/* ===== Terms / GDPR ===== */
.zicform-terms-text, .zicform-gdpr-text { max-height: 120px; overflow-y: auto; padding: 10px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 12px; color: #6b7280; margin-bottom: 10px; }

/* ===== Container layouts ===== */
.zicform-container { border: 2px dashed #c7d2fe; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.zicform-container-label { font-size: 11px; font-weight: 700; color: #4f46e5; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.zicform-container-inner { display: grid; grid-template-columns: repeat(var(--cols, 1), 1fr); gap: 12px; }

/* ===== Form Step ===== */
.zicform-form-step { margin: 20px 0 10px !important; }
.zicform-step-marker { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: #4f46e5; }
.zicform-step-marker::before { content: ''; flex: 1; height: 2px; background: #e0e7ff; }
.zicform-step-marker::after { content: ''; flex: 1; height: 2px; background: #e0e7ff; }

/* ===== Save Resume Button ===== */
.zicform-save-resume-btn { background: transparent; border: 2px solid #4f46e5; color: #4f46e5; padding: 8px 20px; border-radius: 6px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.zicform-save-resume-btn:hover { background: #4f46e5; color: #fff; }

/* ===== Conditional Logic — hidden field animation ===== */
.zicform-cond-hidden {
	display: none !important;
	visibility: hidden;
	pointer-events: none;
}

/* ===== Payment Field ===== */
.zicform-payment-field {
	padding: 16px;
	border: 2px solid #e0e7ff;
	border-radius: 10px;
	background: #f8faff;
}
.zicform-payment-description {
	font-size: 13px;
	color: #6b7280;
	margin: 0 0 10px;
}
.zicform-amount-input-wrap {
	display: flex;
	align-items: center;
	gap: 6px;
}
.zicform-currency-symbol {
	font-size: 18px;
	font-weight: 700;
	color: #374151;
}
.zicform-fixed-price {
	font-size: 28px;
	font-weight: 800;
	color: #4f46e5;
}
.zicform-price-display {
	display: flex;
	align-items: baseline;
	gap: 3px;
	margin-bottom: 12px;
}
.zicform-payment-ui {
	margin-top: 14px;
	padding: 12px;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	background: #fff;
	min-height: 42px;
}

/* ===== Multi-Step Forms (Pro) ===== */
.zicform-multistep .zicform-step { display: none; }
/* The step wraps the fields for that step. Because .zicform-fields-grid is a
   flex row, the active step must span the full width AND become its own flex
   row so half/third-width fields inside it lay out correctly. */
.zicform-multistep .zicform-step.zicform-step-active {
	display: flex;
	flex-wrap: wrap;
	gap: 0 16px;
	width: 100%;
	flex: 0 0 100%;
}

/* Progress bar */
.zicform-step-progress {
	position: relative;
	height: 6px;
	background: #e5e7eb;
	border-radius: 999px;
	margin: 0 0 8px;
	overflow: hidden;
}
.zicform-step-progress-bar {
	position: absolute;
	left: 0; top: 0; bottom: 0;
	width: 0;
	background: #4f46e5;
	border-radius: 999px;
	transition: width .35s ease;
}

/* Step dots / labels */
.zicform-step-dots {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 18px;
	flex-wrap: wrap;
}
.zicform-step-dot {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
	min-width: 0;
	cursor: default;
	opacity: .55;
	transition: opacity .2s;
}
.zicform-step-dot.is-active,
.zicform-step-dot.is-done { opacity: 1; }
.zicform-step-dot.is-done { cursor: pointer; }
.zicform-step-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px; height: 28px;
	flex-shrink: 0;
	border-radius: 50%;
	background: #e5e7eb;
	color: #6b7280;
	font-size: 13px;
	font-weight: 700;
	transition: background .2s, color .2s;
}
.zicform-step-dot.is-active .zicform-step-num { background: #4f46e5; color: #fff; }
.zicform-step-dot.is-done .zicform-step-num { background: #10b981; color: #fff; }
.zicform-step-label {
	font-size: 13px;
	font-weight: 600;
	color: #374151;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Navigation buttons */
.zicform-step-nav {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 18px;
}
.zicform-step-btn {
	padding: 10px 22px;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background .2s, transform .1s;
}
.zicform-step-back {
	background: #f3f4f6;
	color: #374151;
}
.zicform-step-back:hover { background: #e5e7eb; }
.zicform-step-next {
	background: #4f46e5;
	color: #fff;
	margin-left: auto;
}
.zicform-step-next:hover { background: #4338ca; }
.zicform-step-btn:active { transform: translateY(1px); }

/* Validation error highlight */
.zicform-step-error input,
.zicform-step-error select,
.zicform-step-error textarea {
	border-color: #dc2626 !important;
	box-shadow: 0 0 0 1px #dc2626;
}

@media (max-width: 600px) {
	.zicform-step-label { display: none; }
	.zicform-step-dots { justify-content: center; gap: 16px; }
	.zicform-step-dot { flex: 0 0 auto; }
}
