/* CGJ Núcleo — formulario, barra de contacto y avisos. Usa los tokens del tema si existen. */
.cgj-form-envoltura {
	--n-carbon: var(--wp--preset--color--carbon, #0E1113);
	--n-piedra: var(--wp--preset--color--piedra, #5F656B);
	--n-linea: var(--wp--preset--color--linea, #E4E2DC);
	--n-niebla: var(--wp--preset--color--niebla, #F4F3EF);
	--n-acento: var(--wp--preset--color--acento, #FFC81F);
	--n-acento-suave: var(--wp--preset--color--acento-suave, #FFF4CC);
	--n-ease: cubic-bezier(.2,.7,.2,1);
	scroll-margin-top: 110px;
}
.cgj-form { display: grid; gap: 1.5rem; margin: 0; }
.cgj-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 1.35rem; }
.cgj-paso__titulo { font-family: var(--wp--preset--font-family--display, inherit); font-size: 1.35rem; font-weight: 700; letter-spacing: -.015em; padding: 0; margin-bottom: .25rem; }
.cgj-fila { display: grid; gap: 1.35rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.cgj-campo { display: grid; gap: .5rem; min-width: 0; }
.cgj-etiqueta { font-size: .875rem; font-weight: 600; color: var(--n-carbon); }
.cgj-req { color: #B4530A; }
.cgj-form input[type=text], .cgj-form input[type=tel], .cgj-form input[type=email], .cgj-form select, .cgj-form textarea {
	width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; color: var(--n-carbon);
	background: #fff; border: 1.5px solid var(--n-linea); border-radius: 12px; padding: .85rem 1rem; min-height: 52px;
	transition: border-color .2s, box-shadow .2s; appearance: none; -webkit-appearance: none;
}
.cgj-form select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E1113' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; background-size: 18px; padding-right: 2.75rem; }
.cgj-form textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.cgj-form input:hover, .cgj-form select:hover, .cgj-form textarea:hover { border-color: #C9C6BD; }
.cgj-form input:focus, .cgj-form select:focus, .cgj-form textarea:focus { outline: none; border-color: var(--n-carbon); box-shadow: 0 0 0 4px var(--n-acento-suave); }
.cgj-form .es-invalido, .cgj-form [aria-invalid=true] { border-color: #C2410C !important; box-shadow: 0 0 0 4px #FFEDD5 !important; }
.cgj-form ::placeholder { color: #9A9C9E; }

/* Opciones tipo tarjeta / píldora */
.cgj-opciones { display: flex; flex-wrap: wrap; gap: .5rem; }
.cgj-opciones--tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11.5rem), 1fr)); }
.cgj-opcion { position: relative; cursor: pointer; }
.cgj-opcion input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.cgj-opcion span {
	display: flex; align-items: center; min-height: 48px; box-sizing: border-box; padding: .7rem 1rem; border: 1.5px solid var(--n-linea);
	border-radius: 12px; font-size: .94rem; font-weight: 500; background: #fff; transition: border-color .2s, background-color .2s;
}
.cgj-opciones--pildoras .cgj-opcion span { border-radius: 999px; min-height: 44px; padding: .55rem 1.1rem; }
.cgj-opcion:hover span { border-color: #BDB9AF; }
.cgj-opcion input:checked + span { border-color: var(--n-carbon); background: var(--n-acento-suave); font-weight: 600; box-shadow: inset 0 0 0 1px var(--n-carbon); }
.cgj-opcion input:focus-visible + span { outline: 2px solid var(--n-carbon); outline-offset: 2px; }
.cgj-opciones--tarjetas .cgj-opcion span::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #BDB9AF; margin-right: .65rem; flex: none; transition: all .2s; }
.cgj-opciones--tarjetas .cgj-opcion input:checked + span::before { border: 5px solid var(--n-carbon); background: var(--n-acento); }

/* Subida de fotos */
.cgj-subida { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; text-align: center; padding: 1.5rem 1rem; border: 1.5px dashed #C9C6BD; border-radius: 14px; background: var(--n-niebla); cursor: pointer; transition: border-color .2s, background-color .2s; position: relative; }
.cgj-subida:hover, .cgj-subida.arrastrando { border-color: var(--n-carbon); background: var(--n-acento-suave); }
.cgj-subida input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.cgj-subida::before { content: ""; width: 28px; height: 28px; background: var(--n-carbon); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z'/%3E%3Ccircle cx='12' cy='13' r='4'/%3E%3C/svg%3E") center / contain no-repeat; }
.cgj-subida__texto { font-size: .9rem; color: var(--n-piedra); }
.js .cgj-form .cgj-ayuda[id$=fotos-ayuda] { display: none; }
.cgj-ayuda { font-size: .82rem; color: var(--n-piedra); margin: 0; }
.cgj-miniaturas { display: flex; flex-wrap: wrap; gap: .6rem; }
.cgj-miniaturas:empty { display: none; }
.cgj-miniatura { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--n-niebla); }
.cgj-miniatura img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cgj-miniatura button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(14,17,19,.8); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }

.cgj-campo--check label { display: flex; gap: .7rem; align-items: flex-start; font-size: .9rem; line-height: 1.5; cursor: pointer; }
.cgj-campo--check input { width: 20px; height: 20px; margin: .1rem 0 0; accent-color: var(--n-carbon); flex: none; }
.cgj-rgpd { font-size: .78rem; color: var(--n-piedra); line-height: 1.5; margin: 0; }
.cgj-trampa { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* Botones */
.cgj-acciones { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cgj-boton { font: inherit; font-weight: 500; font-size: .9375rem; border: 0; border-radius: 14px; padding: .75rem 1.4rem; line-height: 1; min-height: 48px; box-sizing: border-box; cursor: pointer; transition: background-color .2s, border-color .2s; display: inline-flex; align-items: center; gap: .6rem; }
.cgj-boton--enviar, .cgj-boton--siguiente { background: var(--n-acento); color: var(--n-carbon); margin-left: auto; }
.cgj-boton--enviar:hover, .cgj-boton--siguiente:hover { background: #F5BC0F; }
.cgj-boton--enviar::after, .cgj-boton--siguiente::after { content: "→"; font-size: 1.1em; transition: transform .25s var(--n-ease); }
.cgj-boton--enviar:hover::after, .cgj-boton--siguiente:hover::after { transform: translateX(2px); }
.cgj-boton--atras { background: transparent; color: var(--n-carbon); border: 1.5px solid var(--n-linea); }
.cgj-boton--atras:hover { border-color: var(--n-carbon); }
.cgj-boton:focus-visible { outline: 2px solid var(--n-carbon); outline-offset: 3px; }
.cgj-boton[disabled] { opacity: .7; cursor: progress; }

/* Pasos (solo con JS) */
.cgj-progreso { display: grid; gap: .6rem; }
.cgj-progreso__texto { font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--n-piedra); }
.cgj-progreso__barra { height: 4px; background: var(--n-linea); border-radius: 99px; overflow: hidden; }
.cgj-progreso__barra span { display: block; height: 100%; background: var(--n-carbon); border-radius: inherit; transition: width .45s var(--n-ease); }
.cgj-form.con-pasos .cgj-paso:not(.activo) { display: none; }
.cgj-form.con-pasos .cgj-paso.activo { animation: cgj-entra .4s var(--n-ease); }
@keyframes cgj-entra { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cgj-form.con-pasos .cgj-paso.activo { animation: none; } }

/* Avisos */
.cgj-aviso { border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 1.5rem; font-size: .95rem; }
.cgj-aviso ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.cgj-aviso--error { background: #FFF1E6; border: 1px solid #F5C59F; color: #7C2D12; }
.cgj-aviso--ok { background: #ECFDF3; border: 1px solid #A6E9C3; color: #14532D; font-weight: 600; }

/* ---------- Barra de contacto móvil y burbuja de WhatsApp ---------- */
.cgj-barra-movil { display: none; }
@media (max-width: 781px) {
	body.cgj-con-barra { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
	.cgj-barra-movil {
		display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 70;
		background: rgba(14,17,19,.92); -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
		border-radius: 18px; padding: 6px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.45);
		transform: translateY(0); transition: transform .4s cubic-bezier(.2,.7,.2,1);
	}
	.cgj-barra-movil.oculta { transform: translateY(140%); }
	.cgj-barra-movil__btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; border-radius: 13px; color: #fff; text-decoration: none; font-size: .75rem; font-weight: 600; }
	.cgj-barra-movil__btn svg { width: 20px; height: 20px; }
	.cgj-barra-movil__btn:active { background: rgba(255,255,255,.1); }
	.cgj-barra-movil__btn--principal { background: var(--wp--preset--color--acento, #FFC81F); color: #0E1113; }
	.cgj-burbuja-wa { display: none !important; }
}
.cgj-burbuja-wa {
	position: fixed; right: 22px; bottom: 22px; z-index: 70; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
	background: #1FAF5A; color: #fff; box-shadow: 0 6px 18px -6px rgba(0,0,0,.35); transition: background-color .2s;
}
.cgj-burbuja-wa svg { width: 28px; height: 28px; }
.cgj-burbuja-wa:hover { background: #1A9A4F; }

.cgj-toast {
	position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); z-index: 1000; max-width: min(92vw, 440px);
	background: #0E1113; color: #fff; padding: .9rem 1.2rem; border-radius: 14px; font-size: .9rem; line-height: 1.45; box-shadow: 0 20px 50px -16px rgba(0,0,0,.6);
	border-left: 4px solid var(--wp--preset--color--acento, #FFC81F);
}
.cgj-toast[hidden] { display: none; }
.cgj-boton[hidden] { display: none !important; }
.cgj-fila { align-items: start; }

/* ---------- Selector de idioma ---------- */
.cgj-idiomas { position: relative; font-size: .875rem; }
.cgj-idiomas summary { list-style: none; display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; padding: .45rem .55rem; border-radius: 8px; color: #fff; font-weight: 500; user-select: none; transition: background-color .2s; }
.cgj-idiomas summary::-webkit-details-marker { display: none; }
.cgj-idiomas summary:hover, .cgj-idiomas[open] summary { background: rgba(255,255,255,.1); }
.cgj-idiomas__flecha { width: 12px; height: 12px; opacity: .7; transition: transform .2s; }
.cgj-idiomas[open] .cgj-idiomas__flecha { transform: rotate(180deg); }
.cgj-idiomas__lista { position: absolute; right: 0; top: calc(100% + 8px); z-index: 80; list-style: none; margin: 0; padding: 6px; min-width: 168px; background: #fff; border-radius: 10px; box-shadow: 0 12px 32px -8px rgba(14,17,19,.35), 0 0 0 1px rgba(14,17,19,.06); }
.cgj-idiomas__lista a { display: flex; align-items: center; gap: .6rem; padding: .55rem .65rem; border-radius: 6px; color: #0E1113; text-decoration: none; font-weight: 500; }
.cgj-idiomas__lista a:hover { background: #F4F3EF; }
.cgj-idiomas__lista a[aria-current]::after { content: ""; margin-left: auto; width: 14px; height: 14px; background: #0E1113; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.cgj-bandera { width: 20px; height: 14px; border-radius: 2px; flex: none; background-size: cover; background-position: center; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.cgj-bandera--es { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Crect width='3' height='2' fill='%23AA151B'/%3E%3Crect y='.5' width='3' height='1' fill='%23F1BF00'/%3E%3C/svg%3E"); }
.cgj-bandera--en { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='a'%3E%3Cpath d='M30 15h30v15zv15H0zH0V0zV0h30z'/%3E%3C/clipPath%3E%3Cpath d='M0 0v30h60V0z' fill='%23012169'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' stroke='%23fff' stroke-width='6'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' clip-path='url(%23a)' stroke='%23C8102E' stroke-width='4'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23C8102E' stroke-width='6'/%3E%3C/svg%3E"); }
@media (max-width: 440px) { .cgj-idiomas__codigo { display: none; } }
