/**
 * ClasiFly - Formularios táctiles y editores.
 * Se carga después de style.css para normalizar formularios de WordPress y plugins.
 */

:root {
	--cf-control-height: 52px;
	--cf-control-border: #d5dbe8;
	--cf-focus-ring: 0 0 0 4px rgba(36, 87, 245, .12);
}

.clasifly-theme form {
	max-width: 100%;
}

.clasifly-theme fieldset {
	min-width: 0;
	margin: 0 0 24px;
	padding: clamp(16px, 3vw, 26px);
	background: #fff;
	border: 1px solid var(--cf-line);
	border-radius: var(--cf-radius);
}

.clasifly-theme legend {
	padding-inline: 8px;
	color: var(--cf-ink);
	font-size: 1.05rem;
	font-weight: 800;
}

.clasifly-theme label {
	display: inline-block;
	margin-bottom: 7px;
	color: var(--cf-ink);
	font-size: .94rem;
	line-height: 1.35;
}

.clasifly-theme input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.clasifly-theme select,
.clasifly-theme textarea {
	width: 100%;
	max-width: 100%;
	min-height: var(--cf-control-height);
	padding: 12px 14px;
	color: var(--cf-ink);
	background-color: #fff;
	border: 1px solid var(--cf-control-border);
	border-radius: 11px;
	font-size: 16px;
	line-height: 1.45;
	transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.clasifly-theme select {
	padding-right: 42px;
	background-image:
		linear-gradient(45deg, transparent 50%, #667085 50%),
		linear-gradient(135deg, #667085 50%, transparent 50%);
	background-position:
		calc(100% - 20px) 50%,
		calc(100% - 15px) 50%;
	background-repeat: no-repeat;
	background-size: 5px 5px, 5px 5px;
	appearance: none;
}

.clasifly-theme textarea {
	min-height: 170px;
	resize: vertical;
}

.clasifly-theme input:focus,
.clasifly-theme select:focus,
.clasifly-theme textarea:focus,
.clasifly-theme [contenteditable="true"]:focus {
	outline: 0;
	border-color: var(--cf-primary);
	box-shadow: var(--cf-focus-ring);
}

.clasifly-theme input::placeholder,
.clasifly-theme textarea::placeholder {
	color: #8a94a6;
	opacity: 1;
}

.clasifly-theme input[disabled],
.clasifly-theme select[disabled],
.clasifly-theme textarea[disabled] {
	color: #8a94a6;
	background: #f1f3f7;
	cursor: not-allowed;
}

.clasifly-theme input[type="checkbox"],
.clasifly-theme input[type="radio"] {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	margin: 0 8px 0 0;
	vertical-align: middle;
	accent-color: var(--cf-primary);
}

.clasifly-theme input[type="file"] {
	display: block;
	width: 100%;
	min-height: 58px;
	padding: 8px;
	color: var(--cf-muted);
	background: #f8faff;
	border: 2px dashed #b7c2d9;
	border-radius: 12px;
	font-size: .92rem;
}

.clasifly-theme input[type="file"]::file-selector-button {
	min-height: 38px;
	margin-right: 12px;
	padding: 8px 14px;
	color: #fff;
	background: var(--cf-primary);
	border: 0;
	border-radius: 8px;
	font-weight: 750;
}

.clasifly-theme button,
.clasifly-theme input[type="submit"],
.clasifly-theme input[type="button"],
.clasifly-theme .button,
.clasifly-theme .btn {
	min-height: 48px;
	border-radius: 10px;
	touch-action: manipulation;
}

.clasifly-theme .form-row,
.clasifly-theme .form-group,
.clasifly-theme .wp-block-group {
	min-width: 0;
}

/* Editor clásico/TinyMCE y editor frontal de los plugins. */
.clasifly-theme .wp-editor-wrap,
.clasifly-theme .wp-editor-container,
.clasifly-theme .mce-tinymce,
.clasifly-theme .mce-container,
.clasifly-theme .mce-container-body,
.clasifly-theme .quicktags-toolbar {
	width: 100% !important;
	max-width: 100% !important;
}

.clasifly-theme .wp-editor-wrap {
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--cf-control-border);
	border-radius: 12px;
}

.clasifly-theme .wp-editor-container {
	border: 0;
}

.clasifly-theme .quicktags-toolbar,
.clasifly-theme .mce-toolbar-grp {
	padding: 7px !important;
	background: #f5f7fb !important;
	border-bottom: 1px solid var(--cf-line) !important;
}

.clasifly-theme .mce-toolbar .mce-btn {
	min-width: 36px;
	min-height: 36px;
	margin: 2px;
	border-radius: 7px;
}

.clasifly-theme .wp-editor-area {
	min-height: 210px;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}

/* Previsualizaciones de imágenes uniformes. */
.clasifly-theme .media-frame,
.clasifly-theme .media-modal,
.clasifly-theme .media-modal-content {
	max-width: 100vw;
}

.clasifly-theme .attachment-preview,
.clasifly-theme .image-preview,
.clasifly-theme .upload-preview {
	overflow: hidden;
	background: #edf1f7;
	border-radius: 10px;
}

.clasifly-theme .attachment-preview img,
.clasifly-theme .image-preview img,
.clasifly-theme .upload-preview img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.clasifly-theme .required,
.clasifly-theme abbr.required {
	color: #d92d20;
	text-decoration: none;
}

.clasifly-theme .description,
.clasifly-theme .form-text,
.clasifly-theme .field-description {
	display: block;
	margin-top: 6px;
	color: var(--cf-muted);
	font-size: .84rem;
	line-height: 1.45;
}

.clasifly-theme .notice,
.clasifly-theme .alert,
.clasifly-theme .directorist-alert {
	padding: 15px 17px;
	border: 1px solid #cfd7e7;
	border-left-width: 4px;
	border-radius: 11px;
}

@media (max-width: 782px) {
	.clasifly-theme input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
	.clasifly-theme select,
	.clasifly-theme textarea {
		font-size: 16px !important; /* Evita zoom automático de iOS. */
	}

	.clasifly-theme fieldset {
		padding: 16px;
	}

	.clasifly-theme .form-row,
	.clasifly-theme .form-group,
	.clasifly-theme .row {
		min-width: 0;
	}

	.clasifly-theme .mce-toolbar-grp {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.clasifly-theme .mce-toolbar {
		min-width: max-content;
	}

	.clasifly-theme .media-modal {
		inset: 12px;
		width: auto;
		height: auto;
	}
}

@media (max-width: 480px) {
	.clasifly-theme button,
	.clasifly-theme input[type="submit"],
	.clasifly-theme input[type="button"],
	.clasifly-theme .button:not(.media-modal-close),
	.clasifly-theme .btn:not(.btn-sm) {
		min-height: 50px;
	}

	.clasifly-theme input[type="file"]::file-selector-button {
		display: block;
		margin: 0 0 7px;
	}
}
