/* SW Formulario de Contacto — estilos del formulario público.
   Personalizable desde el tema con variables CSS:
   .sw-cf { --sw-cf-primary: #c00; --sw-cf-radius: 0; } */
.sw-cf {
	--sw-cf-primary: #2563eb;
	--sw-cf-primary-text: #ffffff;
	--sw-cf-text: #1f2937;
	--sw-cf-muted: #6b7280;
	--sw-cf-border: #d1d5db;
	--sw-cf-bg: #ffffff;
	--sw-cf-radius: 8px;
	--sw-cf-gap: 18px;
	--sw-cf-error: #b91c1c;
	--sw-cf-ok-bg: #ecfdf5;
	--sw-cf-ok-text: #065f46;
	--sw-cf-ok-border: #a7f3d0;
	--sw-cf-error-bg: #fef2f2;
	--sw-cf-error-text: #991b1b;
	--sw-cf-error-border: #fecaca;
	box-sizing: border-box;
	color: var(--sw-cf-text);
	line-height: 1.5;
}
.sw-cf *, .sw-cf *::before, .sw-cf *::after { box-sizing: inherit; }
.sw-cf--clasico { --sw-cf-radius: 2px; --sw-cf-gap: 12px; }

/* ---------- rejilla ---------- */
.sw-cf-grid { display: flex; flex-wrap: wrap; gap: var(--sw-cf-gap) 16px; margin: 0; }
.sw-cf-field { flex: 0 0 100%; max-width: 100%; min-width: 0; margin: 0; }
.sw-cf-w100 { flex-basis: 100%; max-width: 100%; }
.sw-cf-w75  { flex-basis: calc(75% - 4px);  max-width: calc(75% - 4px); }
.sw-cf-w66  { flex-basis: calc(66.666% - 6px); max-width: calc(66.666% - 6px); }
.sw-cf-w50  { flex-basis: calc(50% - 8px);  max-width: calc(50% - 8px); }
.sw-cf-w33  { flex-basis: calc(33.333% - 11px); max-width: calc(33.333% - 11px); }
.sw-cf-w25  { flex-basis: calc(25% - 12px); max-width: calc(25% - 12px); }
@media (max-width: 640px) {
	.sw-cf-w75, .sw-cf-w66, .sw-cf-w50, .sw-cf-w33, .sw-cf-w25 { flex-basis: 100%; max-width: 100%; }
}

/* ---------- etiquetas y textos ---------- */
.sw-cf-label { display: block; font-weight: 600; font-size: .95em; margin: 0 0 6px; color: var(--sw-cf-text); }
.sw-cf-field--sin-etiqueta .sw-cf-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sw-cf-req { color: var(--sw-cf-error); font-weight: 700; }
.sw-cf-desc { font-size: .85em; color: var(--sw-cf-muted); margin-top: 6px; }
.sw-cf-desc p { margin: 0; }
.sw-cf-heading { margin: 8px 0 0; font-weight: 700; line-height: 1.25; }
h2.sw-cf-heading { font-size: 1.5em; } h3.sw-cf-heading { font-size: 1.25em; } h4.sw-cf-heading { font-size: 1.05em; }
.sw-cf-heading + .sw-cf-desc { margin-top: 4px; }
.sw-cf-hr { border: 0; border-top: 1px solid var(--sw-cf-border); margin: 6px 0; width: 100%; }
.sw-cf-html > :first-child { margin-top: 0; } .sw-cf-html > :last-child { margin-bottom: 0; }

/* ---------- controles ---------- */
.sw-cf:not(.sw-cf--tema) .sw-cf-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.sw-cf:not(.sw-cf--tema) .sw-cf-field select,
.sw-cf:not(.sw-cf--tema) .sw-cf-field textarea {
	display: block; width: 100%; margin: 0;
	padding: 11px 14px;
	border: 1px solid var(--sw-cf-border);
	border-radius: var(--sw-cf-radius);
	background: var(--sw-cf-bg);
	color: var(--sw-cf-text);
	font: inherit; line-height: 1.4; min-height: 46px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
	transition: border-color .15s, box-shadow .15s;
	-webkit-appearance: none; appearance: none;
}
.sw-cf--clasico .sw-cf-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.sw-cf--clasico .sw-cf-field select, .sw-cf--clasico .sw-cf-field textarea { padding: 8px 10px; min-height: 38px; box-shadow: none; }
.sw-cf:not(.sw-cf--tema) .sw-cf-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='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px;
}
.sw-cf:not(.sw-cf--tema) .sw-cf-field input:focus,
.sw-cf:not(.sw-cf--tema) .sw-cf-field select:focus,
.sw-cf:not(.sw-cf--tema) .sw-cf-field textarea:focus {
	outline: none; border-color: var(--sw-cf-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--sw-cf-primary) 20%, transparent);
}
@supports not (color: color-mix(in srgb, red 50%, blue)) {
	.sw-cf:not(.sw-cf--tema) .sw-cf-field input:focus,
	.sw-cf:not(.sw-cf--tema) .sw-cf-field select:focus,
	.sw-cf:not(.sw-cf--tema) .sw-cf-field textarea:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, .2); }
}
.sw-cf-field textarea { resize: vertical; min-height: 120px; }
.sw-cf-field ::placeholder { color: #9ca3af; opacity: 1; }
.sw-cf-field.has-error input, .sw-cf-field.has-error select, .sw-cf-field.has-error textarea { border-color: var(--sw-cf-error) !important; }

.sw-cf-nombre-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .sw-cf-nombre-grid { grid-template-columns: 1fr; } }

/* opciones (radio / checkbox) */
.sw-cf-choices { display: flex; flex-direction: column; gap: 8px; }
.sw-cf-choices--horizontal { flex-direction: row; flex-wrap: wrap; gap: 8px 20px; }
.sw-cf-choice { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-weight: 400; margin: 0; }
.sw-cf-choice input { margin: 4px 0 0; width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--sw-cf-primary); cursor: pointer; }
.sw-cf-consent { font-size: .92em; }
.sw-cf-consent a { color: var(--sw-cf-primary); }

/* valoración con estrellas */
.sw-cf-rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.sw-cf-rating input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw-cf-rating label { cursor: pointer; margin: 0; line-height: 0; }
.sw-cf-rating svg { width: 30px; height: 30px; fill: #d1d5db; transition: fill .12s, transform .12s; }
.sw-cf-rating label:hover svg, .sw-cf-rating label:hover ~ label svg,
.sw-cf-rating input:checked ~ label svg { fill: #f59e0b; }
.sw-cf-rating label:hover svg { transform: scale(1.15); }
.sw-cf-rating input:focus-visible + label svg { outline: 2px solid var(--sw-cf-primary); outline-offset: 2px; border-radius: 4px; }

/* archivo */
.sw-cf-file input[type="file"] {
	display: block; width: 100%; padding: 10px; border: 1px dashed var(--sw-cf-border); border-radius: var(--sw-cf-radius);
	background: #fafafa; font: inherit; color: var(--sw-cf-muted); cursor: pointer;
}
.sw-cf-file input[type="file"]::file-selector-button {
	margin-right: 12px; padding: 7px 14px; border: 0; border-radius: calc(var(--sw-cf-radius) - 2px);
	background: var(--sw-cf-primary); color: var(--sw-cf-primary-text); font: inherit; font-weight: 600; cursor: pointer;
}
.sw-cf-file-hint { display: block; font-size: .8em; color: var(--sw-cf-muted); margin-top: 5px; }

/* ---------- botón ---------- */
.sw-cf-actions { margin-top: 22px; }
.sw-cf-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 13px 30px; min-width: 180px;
	border: 0; border-radius: var(--sw-cf-radius);
	background: var(--sw-cf-primary); color: var(--sw-cf-primary-text);
	font: inherit; font-weight: 600; font-size: 1em; line-height: 1.2; cursor: pointer;
	box-shadow: 0 2px 6px rgba(16, 24, 40, .12);
	transition: filter .15s, transform .1s, box-shadow .15s;
}
.sw-cf-btn:hover { filter: brightness(1.08); box-shadow: 0 4px 12px rgba(16, 24, 40, .18); transform: translateY(-1px); }
.sw-cf-btn:active { transform: translateY(0); }
.sw-cf-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--sw-cf-primary) 40%, transparent); outline-offset: 2px; }
.sw-cf-btn:disabled, .sw-cf-btn.is-loading { opacity: .65; cursor: progress; transform: none; }
.sw-cf-btn.is-loading::before {
	content: ""; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%;
	animation: sw-cf-spin .7s linear infinite;
}
@keyframes sw-cf-spin { to { transform: rotate(360deg); } }

/* ---------- errores y mensajes ---------- */
.sw-cf-error { display: block; color: var(--sw-cf-error); font-size: .85em; margin-top: 5px; font-weight: 500; }
.sw-cf-error:empty { display: none; }

.sw-cf-msg {
	margin: 18px 0 0; padding: 14px 18px; border-radius: var(--sw-cf-radius); border: 1px solid transparent; font-weight: 500;
	display: flex; align-items: flex-start; gap: 10px;
}
.sw-cf-msg::before { content: ""; flex: 0 0 20px; width: 20px; height: 20px; margin-top: 1px; background-repeat: no-repeat; background-size: contain; }
.sw-cf-msg--ok { background: var(--sw-cf-ok-bg); color: var(--sw-cf-ok-text); border-color: var(--sw-cf-ok-border); }
.sw-cf-msg--ok::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23065f46' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M8 12.5l2.5 2.5L16 9.5'/%3E%3C/svg%3E"); }
.sw-cf-msg--error { background: var(--sw-cf-error-bg); color: var(--sw-cf-error-text); border-color: var(--sw-cf-error-border); }
.sw-cf-msg--error::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23991b1b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E"); }
.sw-cf > .sw-cf-msg { margin: 0 0 18px; }

/* ---------- honeypot ---------- */
.sw-cf-hp { position: absolute !important; left: -9999px !important; top: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- tras enviar ---------- */
.sw-cf-form.is-sent .sw-cf-grid, .sw-cf-form.is-sent .sw-cf-actions { display: none; }
.sw-cf-form.is-sent .sw-cf-msg { margin-top: 0; padding: 26px 22px; font-size: 1.05em; }
.sw-cf-again { margin-top: 14px; }
.sw-cf-again button { background: none; border: 0; color: var(--sw-cf-primary); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
