/* ==========================================================
   RP · Cotizaciones
   ==========================================================

   PARAMETRIZACIÓN

   Todo el componente referencia variables --rp-cot-*, nunca los
   tokens del tema directamente. Cada una toma su valor de theme.json
   y cae a un literal si el token no existiera. Así el plugin funciona
   en cualquier tema y se puede reajustar desde rp.css redefiniendo
   una sola variable.

   MODO OSCURO

   No hace falta bloque propio: rp.css redefine los tokens de
   theme.json dentro de @media (prefers-color-scheme: dark), y estas
   variables heredan el cambio. Las únicas excepciones están al final,
   donde un token se usa como FONDO en vez de como texto.
   ========================================================== */

.rp-cot-accion,
.rp-cot-flotante,
.rp-cot-pagina {
	--rp-cot-lienzo:     var(--wp--preset--color--lienzo, #EDF0F6);
	--rp-cot-superficie: var(--wp--preset--color--superficie, #FFFFFF);
	--rp-cot-linea:      var(--wp--preset--color--linea, #CDD5E5);
	--rp-cot-tenue:      var(--wp--preset--color--tenue, #5D6785);
	--rp-cot-primario:   var(--wp--preset--color--primario, #0F1E52);
	--rp-cot-accion:     var(--wp--preset--color--accion, #1F3BD6);

	--rp-cot-radio:      2px;
	--rp-cot-hueco:      var(--wp--preset--spacing--2, 0.75rem);
	--rp-cot-hueco-alto: var(--wp--preset--spacing--3, 1.25rem);
}

/* ==========================================================
   Botón en la ficha de producto
   ========================================================== */

.rp-cot-accion {
	display: flex;
	align-items: center;
	gap: var(--rp-cot-hueco);
	flex-wrap: wrap;
	margin: var(--rp-cot-hueco-alto) 0;
	/* WooCommerce dispone el formulario de variación con float; sin
	   esto el bloque se monta sobre el botón de carrito. */
	clear: both;
}

.rp-cot-cantidad {
	margin: 0;
}

.rp-cot-cantidad input {
	width: 5rem;
	padding: 0.5rem;
	border: 1px solid var(--rp-cot-linea);
	border-radius: var(--rp-cot-radio);
	font-family: var(--wp--preset--font-family--codigo, monospace);
	text-align: center;
}

.rp-cot-boton {
	background-color: var(--rp-cot-accion);
	color: #FFFFFF;
	border: 1px solid var(--rp-cot-accion);
	border-radius: var(--rp-cot-radio);
	padding: 0.7rem var(--rp-cot-hueco-alto);
	font-family: var(--wp--preset--font-family--cuerpo, sans-serif);
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.rp-cot-boton:hover:not(:disabled),
.rp-cot-boton:focus-visible:not(:disabled) {
	background-color: var(--rp-cot-primario);
	border-color: var(--rp-cot-primario);
}

/* Deshabilitado mientras no haya variación resuelta. Se marca con
   opacidad Y con cursor: solo el color no basta para quien no
   distingue contrastes. */
.rp-cot-boton:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.rp-cot-aviso {
	flex-basis: 100%;
	margin: 0;
	min-height: 1.4em;
	font-size: var(--wp--preset--font-size--pequeno, 0.875rem);
	color: var(--rp-cot-tenue);
}

.rp-cot-aviso--error {
	color: #B3261E;
	font-weight: 600;
}

/* ==========================================================
   Indicador flotante
   ========================================================== */

.rp-cot-flotante {
	position: fixed;
	right: var(--rp-cot-hueco-alto);
	bottom: var(--rp-cot-hueco-alto);
	z-index: 90;

	display: inline-flex;
	align-items: center;
	gap: 0.5rem;

	background-color: var(--rp-cot-accion);
	color: #FFFFFF;
	text-decoration: none;

	padding: 0.7rem 1.1rem;
	border-radius: var(--rp-cot-radio);
	box-shadow: 0 2px 12px rgba(15, 30, 82, 0.28);

	font-family: var(--wp--preset--font-family--cuerpo, sans-serif);
	font-size: var(--wp--preset--font-size--pequeno, 0.875rem);
	font-weight: 600;
}

.rp-cot-flotante:hover,
.rp-cot-flotante:focus-visible {
	background-color: var(--rp-cot-primario);
	color: #FFFFFF;
	text-decoration: none;
}

.rp-cot-flotante[hidden] {
	display: none;
}

.rp-cot-flotante__cuenta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.5rem;
	height: 1.5rem;
	padding: 0 0.35rem;
	background-color: #FFFFFF;
	color: var(--rp-cot-accion);
	border-radius: 999px;
	font-family: var(--wp--preset--font-family--codigo, monospace);
	font-size: 0.8125rem;
}

@media (max-width: 781px) {
	.rp-cot-flotante {
		right: var(--rp-cot-hueco);
		bottom: var(--rp-cot-hueco);
	}

	/* En pantallas chicas el texto sobra: basta el contador. */
	.rp-cot-flotante__texto {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
}

/* ==========================================================
   Página de lista de cotización
   ========================================================== */

.rp-cot-pagina {
	max-width: 48rem;
}

/* ----- Tabla de productos ----- */

.rp-cot-tabla {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: var(--rp-cot-hueco-alto);
}

.rp-cot-tabla th,
.rp-cot-tabla td {
	padding: 0.7rem var(--rp-cot-hueco);
	text-align: left;
	border-bottom: 1px solid var(--rp-cot-linea);
	vertical-align: middle;
}

.rp-cot-tabla thead th {
	font-size: var(--wp--preset--font-size--pequeno, 0.875rem);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--rp-cot-tenue);
	border-bottom-width: 2px;
}

/* La referencia es un número de parte: monoespaciada, como en la
   ficha de producto. */
.rp-cot-tabla code {
	font-family: var(--wp--preset--font-family--codigo, monospace);
	font-size: 0.9375rem;
	background: none;
	padding: 0;
}

.rp-cot-tabla em {
	color: var(--rp-cot-tenue);
	font-size: var(--wp--preset--font-size--pequeno, 0.875rem);
}

.rp-cot-cantidad-linea {
	width: 5rem;
	padding: 0.4rem;
	border: 1px solid var(--rp-cot-linea);
	border-radius: var(--rp-cot-radio);
	font-family: var(--wp--preset--font-family--codigo, monospace);
	text-align: center;
}

.rp-cot-quitar {
	background: none;
	border: 1px solid var(--rp-cot-linea);
	border-radius: var(--rp-cot-radio);
	color: var(--rp-cot-tenue);
	padding: 0.35rem 0.75rem;
	font-family: var(--wp--preset--font-family--cuerpo, sans-serif);
	font-size: var(--wp--preset--font-size--pequeno, 0.875rem);
	cursor: pointer;
}

.rp-cot-quitar:hover,
.rp-cot-quitar:focus-visible {
	border-color: #B3261E;
	color: #B3261E;
}

/* ----- Tabla en móvil -----
   Con cuatro columnas la tabla no cabe. Cada fila pasa a ser un
   bloque con la referencia arriba y los controles debajo. */

@media (max-width: 781px) {
	.rp-cot-tabla thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	.rp-cot-tabla,
	.rp-cot-tabla tbody,
	.rp-cot-tabla tr,
	.rp-cot-tabla td {
		display: block;
		width: 100%;
	}

	.rp-cot-tabla tr {
		padding: var(--rp-cot-hueco) 0;
		border-bottom: 1px solid var(--rp-cot-linea);
	}

	.rp-cot-tabla td {
		border: none;
		padding: 0.15rem 0;
	}

	.rp-cot-tabla tr td:nth-child(3),
	.rp-cot-tabla tr td:nth-child(4) {
		display: inline-block;
		width: auto;
		margin-top: 0.5rem;
		margin-right: var(--rp-cot-hueco);
	}
}

/* ----- Anuncio y navegación ----- */

.rp-cot-anuncio {
	min-height: 1.4em;
	margin: 0 0 var(--rp-cot-hueco) 0;
	font-size: var(--wp--preset--font-size--pequeno, 0.875rem);
	color: var(--rp-cot-tenue);
}

/* "Seguir seleccionando" es acción secundaria: contorno, no relleno,
   para que no compita con "Enviar solicitud". */
.rp-cot-acciones {
	margin: 0 0 var(--rp-cot-hueco-alto) 0;
}

.rp-cot-acciones a.wp-element-button {
	background-color: transparent;
	color: var(--rp-cot-accion);
	border: 1px solid var(--rp-cot-accion);
	border-radius: var(--rp-cot-radio);
	padding: 0.6rem var(--rp-cot-hueco-alto);
	font-weight: 600;
	text-decoration: none;
}

.rp-cot-acciones a.wp-element-button:hover,
.rp-cot-acciones a.wp-element-button:focus-visible {
	background-color: var(--rp-cot-accion);
	color: #FFFFFF;
}

.rp-cot-nota {
	color: var(--rp-cot-tenue);
	font-size: var(--wp--preset--font-size--pequeno, 0.875rem);
	margin-bottom: var(--rp-cot-hueco-alto);
}

/* ----- Formulario ----- */

.rp-cot-formulario {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: var(--rp-cot-hueco) var(--rp-cot-hueco-alto);
	align-items: start;
}

.rp-cot-campo {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.rp-cot-campo--ancho,
.rp-cot-envio,
.rp-cot-error {
	grid-column: 1 / -1;
}

.rp-cot-campo label {
	font-size: var(--wp--preset--font-size--pequeno, 0.875rem);
	font-weight: 600;
	color: var(--rp-cot-tenue);
}

.rp-cot-opcional {
	font-weight: 400;
	text-transform: none;
}

.rp-cot-campo input,
.rp-cot-campo textarea {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--rp-cot-linea);
	border-radius: var(--rp-cot-radio);
	font-family: var(--wp--preset--font-family--cuerpo, sans-serif);
	font-size: var(--wp--preset--font-size--base, 1rem);
}

.rp-cot-campo input:focus-visible,
.rp-cot-campo textarea:focus-visible {
	outline: 2px solid var(--rp-cot-accion);
	outline-offset: 1px;
}

.rp-cot-campo textarea {
	resize: vertical;
	min-height: 6rem;
}

@media (max-width: 781px) {
	.rp-cot-formulario {
		grid-template-columns: 1fr;
	}
}

/* ----- Honeypot -----
   Oculto a la vista pero presente en el DOM. No se usa display:none
   ni visibility:hidden porque algunos robots los detectan y omiten
   el campo; así queda fuera de pantalla y sigue siendo rellenable
   por un autómata que procese el formulario. aria-hidden y
   tabindex=-1 (en el marcado) lo apartan de lectores y teclado. */
.rp-cot-trampa {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ----- Envío ----- */

.rp-cot-envio {
	margin: var(--rp-cot-hueco) 0 0 0;
}

.rp-cot-envio button {
	background-color: var(--rp-cot-accion);
	color: #FFFFFF;
	border: 1px solid var(--rp-cot-accion);
	border-radius: var(--rp-cot-radio);
	padding: 0.8rem var(--wp--preset--spacing--4, 2rem);
	font-family: var(--wp--preset--font-family--cuerpo, sans-serif);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--base, 1rem);
	cursor: pointer;
}

.rp-cot-envio button:hover:not(:disabled),
.rp-cot-envio button:focus-visible:not(:disabled) {
	background-color: var(--rp-cot-primario);
	border-color: var(--rp-cot-primario);
}

.rp-cot-envio button:disabled {
	opacity: 0.6;
	cursor: progress;
}

.rp-cot-error {
	margin: var(--rp-cot-hueco) 0 0 0;
	padding: 0.75rem var(--rp-cot-hueco);
	border-left: 3px solid #B3261E;
	background-color: rgba(179, 38, 30, 0.08);
	color: #B3261E;
	font-weight: 600;
}

.rp-cot-error[hidden] {
	display: none;
}

/* ----- Lista vacía ----- */

.rp-cot-vacia[hidden],
.rp-cot-contenido[hidden] {
	display: none;
}

/* ==========================================================
   Modo oscuro — solo excepciones
   ==========================================================
   Los tokens se invierten en rp.css, así que casi todo se adapta
   solo. Aquí van los casos donde un color se usa como FONDO: al
   invertir la escala, 'accion' pasa de azul intenso a azul claro y
   el texto blanco encima deja de leerse. */

@media (prefers-color-scheme: dark) {
	.rp-cot-boton,
	.rp-cot-flotante,
	.rp-cot-envio button {
		color: #0F1524;
	}

	.rp-cot-boton:hover:not(:disabled),
	.rp-cot-envio button:hover:not(:disabled),
	.rp-cot-flotante:hover {
		background-color: #A8BEFF;
		border-color: #A8BEFF;
		color: #0F1524;
	}

	.rp-cot-flotante__cuenta {
		background-color: #0F1524;
		color: #7C9AFF;
	}

	.rp-cot-acciones a.wp-element-button:hover,
	.rp-cot-acciones a.wp-element-button:focus-visible {
		color: #0F1524;
	}

	.rp-cot-aviso--error,
	.rp-cot-error {
		color: #FF8A80;
		border-left-color: #FF8A80;
	}

	.rp-cot-quitar:hover,
	.rp-cot-quitar:focus-visible {
		border-color: #FF8A80;
		color: #FF8A80;
	}
}

/* ==========================================================
   Desbordamiento en móvil
   ==========================================================
   El tema no declara box-sizing global, así que los campos con
   width:100% sumaban padding y borde por fuera y desbordaban el
   contenedor en pantallas angostas. Se acota al componente en vez
   de tocar el reset del tema. */

.rp-cot-pagina,
.rp-cot-pagina *,
.rp-cot-accion,
.rp-cot-accion * {
	box-sizing: border-box;
}

.rp-cot-pagina {
	overflow-x: hidden;
}

@media (max-width: 781px) {
	/* La tabla en modo bloque puede heredar anchos de la versión de
	   escritorio; se fuerza a no exceder el ancho disponible. */
	.rp-cot-tabla,
	.rp-cot-tabla tr,
	.rp-cot-tabla td {
		max-width: 100%;
	}

	.rp-cot-cantidad-linea {
		max-width: 5rem;
	}
}

/* ==========================================================
   Acciones sobre la lista
   ==========================================================
   "Seguir seleccionando" y "Vaciar la lista" comparten fila, pero
   no jerarquía: la primera es navegación, la segunda es destructiva
   y se marca en tono de advertencia sin gritar. */

.rp-cot-acciones {
	display: flex;
	flex-wrap: wrap;
	gap: var(--rp-cot-hueco);
	align-items: center;
}

.rp-cot-vaciar {
	background: none;
	border: 1px solid var(--rp-cot-linea);
	border-radius: var(--rp-cot-radio);
	color: var(--rp-cot-tenue);
	padding: 0.6rem var(--rp-cot-hueco-alto);
	font-family: var(--wp--preset--font-family--cuerpo, sans-serif);
	font-size: var(--wp--preset--font-size--pequeno, 0.875rem);
	font-weight: 600;
	cursor: pointer;
}

.rp-cot-vaciar:hover,
.rp-cot-vaciar:focus-visible {
	border-color: #B3261E;
	color: #B3261E;
}

@media (max-width: 781px) {
	.rp-cot-acciones {
		flex-direction: column;
		align-items: stretch;
	}

	.rp-cot-acciones a.wp-element-button,
	.rp-cot-vaciar {
		text-align: center;
	}
}

@media (prefers-color-scheme: dark) {
	.rp-cot-vaciar:hover,
	.rp-cot-vaciar:focus-visible {
		border-color: #FF8A80;
		color: #FF8A80;
	}
}
