/**
 * GiraForms - Editor Styles
 */

/* CSS Custom Properties */
.editor-styles-wrapper .wp-block-giraforms-form-container,
.editor-styles-wrapper [data-type="giraforms/form-container"] {
	--giraforms-font-family: inherit;
	--giraforms-font-size: 1rem;
	--giraforms-font-weight: inherit;
	--giraforms-primary-color: #385aea;
	--giraforms-text-color: inherit;
	--giraforms-background-color: transparent;
	--giraforms-border-color: #ddd;
	--giraforms-button-bg: #385aea;
	--giraforms-button-color: #ffffff;
	--giraforms-border-radius: 4px;
	--giraforms-input-bg-color: #fff;
	--giraforms-accent-color: inherit;
}

/* Block Editor Styles */
.wp-block-giraforms-text-field,
.wp-block-giraforms-textarea-field,
.wp-block-giraforms-email-field,
.wp-block-giraforms-phone-field,
.wp-block-giraforms-select-field,
.wp-block-giraforms-checkbox-field,
.wp-block-giraforms-radio-field,
.wp-block-giraforms-date-field,
.wp-block-giraforms-time-field,
.wp-block-giraforms-file-upload-field,
.wp-block-giraforms-captcha-field,
.wp-block-giraforms-rating-field,
.wp-block-giraforms-calendar-field,
.wp-block-giraforms-booking-field {
	margin-bottom: 1.5rem;
}

/* Form Fields */
.giraforms-field {
	font-family: var(--giraforms-font-family, inherit);
	font-weight: var(--giraforms-font-weight, inherit);
	color: var(--giraforms-text-color);
}

/* Labels */
.giraforms-field label {
	display: block;
	margin-bottom: var(--giraforms-label-spacing, 0.5rem);
	line-height: 1;
	font-weight: var(--giraforms-label-font-weight, 600);
	color: var(--giraforms-text-color);
}

.giraforms-field label.required::after {
	content: " *";
	color: var(--giraforms-required-color, #dc3232);
}

/* Inputs */
.giraforms-field input[type="text"],
.giraforms-field input[type="email"],
.giraforms-field input[type="tel"],
.giraforms-field input[type="url"],
.giraforms-field input[type="number"],
.giraforms-field input[type="date"],
.giraforms-field input[type="time"],
.giraforms-field input[type="password"],
.giraforms-field select,
.giraforms-field textarea {
	width: 100%;
	padding: 0.75rem;
	border: 1px solid var(--giraforms-border-color, #ddd);
	border-radius: var(--giraforms-border-radius, 4px);
	font-size: var(--giraforms-font-size, 1rem);
	font-family: var(--giraforms-font-family, inherit);
	line-height: 1.5;
	color: var(--giraforms-text-color, #1e1e1e);
	background-color: var(--giraforms-input-bg-color, #fff);
	transition: border-color 0.2s;
	box-sizing: border-box;
}

.giraforms-field input:focus,
.giraforms-field select:focus,
.giraforms-field textarea:focus {
	outline: none;
	border-color: #385aea;
	box-shadow: 0 0 0 1px #385aea;
}

.giraforms-field textarea {
	min-height: 120px;
	resize: vertical;
}

/* Field Description */
.giraforms-field .giraforms-field-description {
	margin-top: 0.25rem;
	font-size: 0.875rem;
	color: #757575;
}

/* Checkboxes and Radio Buttons */
.giraforms-field .giraforms-field-checkbox,
.giraforms-field .giraforms-field-radio {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.giraforms-field .giraforms-checkbox-option,
.giraforms-field .giraforms-radio-option {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.giraforms-field .giraforms-checkbox-option input[type="checkbox"],
.giraforms-field .giraforms-radio-option input[type="radio"] {
	width: auto;
	margin: 0;
	padding: 0;
}

/* Options Wrapper */
.giraforms-field .giraforms-options-wrapper {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* Button Style for Radio/Checkbox - Editor */
.giraforms-style-buttons .giraforms-options-wrapper {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.giraforms-style-buttons .giraforms-radio-option,
.giraforms-style-buttons .giraforms-checkbox-option {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0;
	padding: 0.75rem;
	border: 1px solid #e0e0e0;
	border-radius: var(--giraforms-border-radius, 4px);
	cursor: pointer;
	transition: all 0.2s;
	background: #fff;
}

.giraforms-style-buttons .giraforms-radio-option:hover,
.giraforms-style-buttons .giraforms-checkbox-option:hover {
	border-color: var(--giraforms-accent-color, #2271b1);
	background: #f8fafc;
}

.giraforms-style-buttons .giraforms-radio-option input,
.giraforms-style-buttons .giraforms-checkbox-option input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

.giraforms-style-buttons .giraforms-radio-option label,
.giraforms-style-buttons .giraforms-checkbox-option label {
	cursor: pointer;
	font-weight: 500;
	color: var(--giraforms-text-color);
	user-select: none;
}

/* Submit Button - Width */
.wp-block-giraforms-submit-button .wp-block-button.has-custom-width {
	display: inline-block;
}

.wp-block-giraforms-submit-button .wp-block-button.has-custom-width .wp-block-button__link {
	display: block;
	width: 100%;
}

.wp-block-giraforms-submit-button .wp-block-button.wp-block-button__width-25 {
	width: 25%;
}

.wp-block-giraforms-submit-button .wp-block-button.wp-block-button__width-50 {
	width: 50%;
}

.wp-block-giraforms-submit-button .wp-block-button.wp-block-button__width-75 {
	width: 75%;
}

.wp-block-giraforms-submit-button .wp-block-button.wp-block-button__width-100 {
	width: 100%;
}

/* Submit Button - inherit typography from block wrapper (overrides :root :where(.wp-element-button)) */
.wp-block-giraforms-submit-button .wp-block-button__link {
	font-size: inherit;
	font-family: inherit;
	font-weight: inherit;
	line-height: inherit;
	letter-spacing: inherit;
}

/* Submit Button */
.giraforms-field .giraforms-submit-button,
.wp-block-giraforms-submit-button .giraforms-submit-button {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	background-color: var(--giraforms-button-bg, #385aea);
	color: var(--giraforms-button-color, #fff);
	border: none;
	border-radius: var(--giraforms-border-radius, 4px);
	font-size: var(--giraforms-font-size, 1rem);
	font-family: var(--giraforms-font-family, inherit);
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s;
}

.giraforms-field .giraforms-submit-button:hover,
.wp-block-giraforms-submit-button .giraforms-submit-button:hover {
	filter: brightness(0.9);
}



/* ========================================
   Pro Features Upsell Panel
   ======================================== */

.giraforms-pro-panel .giraforms-pro-features-list {
	list-style: none;
	margin: 0 0 8px;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.giraforms-pro-panel .giraforms-pro-feature-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #1e1e1e;
}

.giraforms-pro-panel .giraforms-pro-feature-item .dashicon {
	color: #757575;
	flex-shrink: 0;
}

.giraforms-pro-panel .giraforms-pro-upgrade-btn {
	width: 100%;
	justify-content: center;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
	border: none !important;
	border-radius: 4px !important;
	font-weight: 600 !important;
	text-decoration: none !important;
}

/* ========================================
   Template Placeholder
   ======================================== */

.giraforms-template-placeholder {
	min-height: 280px;
}

.giraforms-template-picker {
	width: 100%;
}

.giraforms-quick-templates {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
	margin-bottom: 16px;
}

.giraforms-quick-template-btn {
	display: flex !important;
	align-items: center;
	gap: 10px;
	padding: 14px 16px !important;
	background: #fff !important;
	border: 1px solid #ddd !important;
	border-radius: 8px !important;
	cursor: pointer;
	transition: border-color 0.2s, box-shadow 0.2s;
	height: auto !important;
	justify-content: flex-start !important;
}

.giraforms-quick-template-btn:hover {
	border-color: #385aea !important;
	box-shadow: 0 0 0 1px #385aea;
}

.giraforms-quick-template-btn svg {
	fill: #385aea;
	flex-shrink: 0;
	width: 24px;
	height: 24px;
}

.giraforms-quick-template-label {
	font-size: 13px;
	font-weight: 600;
	color: #1e1e1e;
}

.giraforms-template-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
}

/* ========================================
   PRO badge on premium block icons in inserter
   ======================================== */

.editor-block-list-item-giraforms-file-upload-field .block-editor-block-types-list__item-icon,
.editor-block-list-item-giraforms-rating-field .block-editor-block-types-list__item-icon,
.editor-block-list-item-giraforms-calendar-field .block-editor-block-types-list__item-icon,
.editor-block-list-item-giraforms-booking-field .block-editor-block-types-list__item-icon,
.editor-block-list-item-giraforms-phone-advanced-field .block-editor-block-types-list__item-icon,
.editor-block-list-item-giraforms-signature-field .block-editor-block-types-list__item-icon,
.editor-block-list-item-giraforms-currency-field .block-editor-block-types-list__item-icon,
.editor-block-list-item-giraforms-geolocation-field .block-editor-block-types-list__item-icon,
.editor-block-list-item-giraforms-stripe-payment-field .block-editor-block-types-list__item-icon {
	position: relative;
}

.editor-block-list-item-giraforms-file-upload-field .block-editor-block-types-list__item-icon::after,
.editor-block-list-item-giraforms-rating-field .block-editor-block-types-list__item-icon::after,
.editor-block-list-item-giraforms-calendar-field .block-editor-block-types-list__item-icon::after,
.editor-block-list-item-giraforms-booking-field .block-editor-block-types-list__item-icon::after,
.editor-block-list-item-giraforms-phone-advanced-field .block-editor-block-types-list__item-icon::after,
.editor-block-list-item-giraforms-signature-field .block-editor-block-types-list__item-icon::after,
.editor-block-list-item-giraforms-currency-field .block-editor-block-types-list__item-icon::after,
.editor-block-list-item-giraforms-geolocation-field .block-editor-block-types-list__item-icon::after,
.editor-block-list-item-giraforms-stripe-payment-field .block-editor-block-types-list__item-icon::after {
	content: "PRO";
	position: absolute;
	top: 0;
	right: 0;
	background: #3858e9;
	color: #fff;
	font-size: 8px;
	font-weight: 700;
	line-height: 1;
	padding: 2px 4px;
	border-radius: 3px;
	letter-spacing: 0.5px;
	pointer-events: none;
}

/* Consent Field - unified with frontend */
.giraforms-consent-field .giraforms-checkbox-wrapper {
	display: flex;
	align-items: flex-start;
	gap: 10px;
}

.giraforms-consent-field .giraforms-consent-checkbox {
	width: auto;
	margin: 6px 0 0 0;
	flex-shrink: 0;
	cursor: not-allowed;
}

.giraforms-consent-field .giraforms-consent-label {
	margin: 0;
	user-select: none;
	color: var(--giraforms-text-color, inherit);
	font-family: var(--giraforms-font-family, inherit);
	line-height: 1.5;
}

.giraforms-consent-field .giraforms-consent-label a {
	color: var(--giraforms-accent-color, #3858e9);
	text-decoration: underline;
	font-weight: 600;
}

.giraforms-consent-field .giraforms-consent-label .required {
	color: var(--giraforms-required-color, #dc3232);
	margin-left: 4px;
	font-weight: 700;
}

/* ========================================
   Preview Mode
   ======================================== */
/* Hide form header in preview mode */
.giraforms-preview-mode .giraforms-form-header {
	display: none !important;
}
