/* ==========================================================================
   Cuban Places for WooCommerce — Ventana de destino
   El color principal llega en --cpwc-accent desde los ajustes.
   ========================================================================== */

.cpwc-loc-open,
.cpwc-loc-open body {
	overflow: hidden;
}

.cpwc-loc[hidden] {
	display: none !important;
}

.cpwc-loc {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-size: 15px;
	line-height: 1.45;
}

.cpwc-loc__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .55);
}

.cpwc-loc__dialog {
	position: relative;
	width: 100%;
	max-width: 400px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	padding: 24px;
	background: #fff;
	color: #222;
	border-radius: 22px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
	animation: cpwc-loc-in .18s ease-out;
}

.cpwc-loc__dialog:focus {
	outline: none;
}

@keyframes cpwc-loc-in {
	from {
		opacity: 0;
		transform: translateY(12px) scale(.98);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cpwc-loc__dialog {
		animation: none;
	}
}

/*
 * Botones aislados del tema: algunos temas (p. ej. WoodMart) dan estilos
 * globales a button (relleno, altura mínima, posición). all: unset los anula
 * y después se aplica solo el diseño propio.
 */
.cpwc-loc .cpwc-loc__dialog .cpwc-loc__close {
	all: unset;
	position: absolute;
	top: 16px;
	right: 16px;
	left: auto;
	bottom: auto;
	z-index: 1;
	display: block;
	box-sizing: border-box;
	width: 22px;
	height: 22px;
	border-radius: 3px;
	background: #ddd;
	color: #555;
	font: 400 14px/22px sans-serif;
	text-align: center;
	cursor: pointer;
}

.cpwc-loc .cpwc-loc__dialog .cpwc-loc__close:hover,
.cpwc-loc .cpwc-loc__dialog .cpwc-loc__close:focus-visible {
	background: #ccc;
	color: #111;
}

.cpwc-loc .cpwc-loc__dialog .cpwc-loc__close:focus-visible {
	outline: 2px solid #222;
	outline-offset: 2px;
}

.cpwc-loc .cpwc-loc__title {
	margin: 0 32px 18px 0;
	padding: 0;
	font-size: 22px;
	font-weight: 600;
	line-height: 1.2;
	color: #222;
}

.cpwc-loc__message {
	padding: 12px 14px;
	border-radius: 14px;
	background: var(--cpwc-accent, #e31b23);
	color: #fff;
	font-size: 14px;
}

.cpwc-loc__form {
	margin: 20px 0 0;
	padding-top: 20px;
	border-top: 1px solid #e5e5e5;
}

.cpwc-loc .cpwc-loc__select {
	display: block;
	width: 100%;
	height: 48px;
	margin: 0 0 18px;
	padding: 0 44px 0 16px;
	border: 2px solid #e2e2e2;
	border-radius: 999px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23999' stroke-width='1.5' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 18px center;
	color: #444;
	font-size: 15px;
	line-height: 44px;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: none;
}

.cpwc-loc .cpwc-loc__select:focus {
	border-color: var(--cpwc-accent, #e31b23);
	outline: none;
}

.cpwc-loc .cpwc-loc__select:disabled {
	opacity: .6;
	cursor: not-allowed;
}

.cpwc-loc .cpwc-loc__select[hidden] {
	display: none;
}

.cpwc-loc__error {
	margin: -8px 0 14px;
	color: #b3141b;
	font-size: 13px;
}

.cpwc-loc .cpwc-loc__dialog .cpwc-loc__submit {
	all: unset;
	box-sizing: border-box;
	display: block;
	font-family: inherit;
	line-height: 1.3;
	text-align: center;
	min-width: 60%;
	margin: 6px auto 0;
	padding: 13px 26px;
	border: 0;
	border-radius: 999px;
	background: var(--cpwc-accent, #e31b23);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: .02em;
	text-transform: uppercase;
	cursor: pointer;
	transition: filter .15s;
}

.cpwc-loc .cpwc-loc__dialog .cpwc-loc__submit:hover,
.cpwc-loc .cpwc-loc__dialog .cpwc-loc__submit:focus-visible {
	filter: brightness(.9);
}

.cpwc-loc .cpwc-loc__dialog .cpwc-loc__submit:focus-visible {
	outline: 2px solid #222;
	outline-offset: 2px;
}

/*
 * Botón flotante con el destino actual. La posición llega en variables desde
 * los ajustes (ordenador y móvil): --cpwc-badge-bottom/-left/-right y, para la
 * etiqueta de la burbuja, --cpwc-tip-left/-right/-shift.
 */
a.cpwc-loc-badge {
	all: unset;
	box-sizing: border-box;
	position: fixed;
	top: auto;
	bottom: calc(var(--cpwc-badge-bottom, 16px) + var(--cpwc-badge-lift, 0px));
	left: var(--cpwc-badge-left, 16px);
	right: var(--cpwc-badge-right, auto);
	z-index: 99990;
	display: inline-flex;
	cursor: pointer;
	font-family: inherit;
	align-items: center;
	gap: 6px;
	max-width: calc(100vw - 32px);
	padding: 9px 14px;
	border-radius: 999px;
	background: var(--cpwc-accent, #e31b23);
	color: #fff !important;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none !important;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
	transition: bottom .3s ease;
}

/*
 * WoodMart: el botón se eleva sobre las barras fijas inferiores del tema
 * (barra de herramientas móvil de 55 px y barra fija de "Añadir al carrito").
 */
body.wd-sticky-btn-on:has(.wd-sticky-btn.wd-sticky-btn-shown) a.cpwc-loc-badge {
	--cpwc-badge-lift: var(--wd-sticky-btn-height, 70px);
}

@media (max-width: 1024px) {
	body.sticky-toolbar-on a.cpwc-loc-badge {
		--cpwc-badge-lift: 55px;
	}

	body.sticky-toolbar-on.wd-sticky-btn-on:has(.wd-sticky-btn.wd-sticky-btn-shown) a.cpwc-loc-badge {
		--cpwc-badge-lift: calc(55px + var(--wd-sticky-btn-height, 70px));
	}
}

@media (max-width: 768.98px) {
	body.wd-sticky-btn-on:not(.wd-sticky-btn-on-mb):has(.wd-sticky-btn.wd-sticky-btn-shown) a.cpwc-loc-badge {
		--cpwc-badge-lift: 0px;
	}

	body.sticky-toolbar-on.wd-sticky-btn-on:not(.wd-sticky-btn-on-mb):has(.wd-sticky-btn.wd-sticky-btn-shown) a.cpwc-loc-badge {
		--cpwc-badge-lift: 55px;
	}
}

@media (prefers-reduced-motion: reduce) {
	a.cpwc-loc-badge {
		transition: none;
	}
}

.cpwc-loc-badge__label {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.cpwc-loc-badge:hover,
.cpwc-loc-badge:focus-visible {
	filter: brightness(.92);
}

.cpwc-loc-badge:focus-visible {
	outline: 2px solid #222;
	outline-offset: 2px;
}

/* Burbuja: solo icono; el destino aparece en una etiqueta al pasar el ratón o con el foco */
a.cpwc-loc-badge--bubble {
	justify-content: center;
	width: 52px;
	height: 52px;
	padding: 0;
}

.cpwc-loc-badge--bubble svg {
	width: 24px;
	height: 24px;
}

.cpwc-loc-badge--bubble .cpwc-loc-badge__label {
	position: absolute;
	left: var(--cpwc-tip-left, calc(100% + 10px));
	right: var(--cpwc-tip-right, auto);
	top: 50%;
	max-width: min(320px, calc(100vw - 100px));
	padding: 7px 12px;
	border: 1px solid rgba(0, 0, 0, .12);
	border-radius: 6px;
	background: #fff;
	color: #222;
	font-weight: 600;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
	opacity: 0;
	visibility: hidden;
	transform: translate(var(--cpwc-tip-shift, -4px), -50%);
	transition: opacity .15s, transform .15s, visibility .15s;
	pointer-events: none;
}

.cpwc-loc-badge--bubble:hover .cpwc-loc-badge__label,
.cpwc-loc-badge--bubble:focus-visible .cpwc-loc-badge__label {
	opacity: 1;
	visibility: visible;
	transform: translate(0, -50%);
}

@media (prefers-reduced-motion: reduce) {
	.cpwc-loc-badge--bubble .cpwc-loc-badge__label {
		transition: none;
	}
}

.cpwc-unavailable a {
	font-weight: 600;
}

/*
 * Shortcode [cpwc_location]: icono y destino en dos líneas (provincia pequeña
 * arriba, municipio debajo). Compacto para cabeceras y menús; el color del
 * texto se hereda del tema y el icono usa el color del plugin.
 */
a.cpwc-location-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
	max-width: 100%;
	color: inherit;
	line-height: 1.15;
	text-decoration: none !important;
	vertical-align: middle;
}

.cpwc-location-link__pin {
	position: relative;
	flex: none;
	display: inline-flex;
}

.cpwc-location-link__icon {
	width: 18px;
	height: 18px;
	color: var(--cpwc-accent, #e31b23);
}

.cpwc-location-link__text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	text-align: left;
}

.cpwc-location-link__state,
.cpwc-location-link__city {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.cpwc-location-link__state {
	font-size: .75em;
	opacity: .7;
}

.cpwc-location-link__city {
	font-size: .9em;
	font-weight: 600;
}

a.cpwc-location-link:hover .cpwc-location-link__city,
a.cpwc-location-link:focus-visible .cpwc-location-link__city {
	text-decoration: underline;
}

/* icon="no" con mobile="icon": sin icono en ordenador, solo icono en móvil. */
.cpwc-location-link--no-icon .cpwc-location-link__pin {
	display: none;
}

/*
 * Móvil: ancho máximo para que los municipios largos ("Santa Isabel de las
 * Lajas") se recorten con "…" en vez de empujar la cabecera. Se puede cambiar
 * con la variable --cpwc-location-max.
 */
@media (max-width: 767px) {
	a.cpwc-location-link {
		max-width: var(--cpwc-location-max, 45vw);
	}

	/* mobile="city": una sola línea con el municipio. */
	.cpwc-location-link--mobile-city .cpwc-location-link__state {
		display: none;
	}

	/* mobile="icon": solo el icono, con un punto si ya hay destino elegido. */
	.cpwc-location-link--mobile-icon .cpwc-location-link__text {
		display: none;
	}

	.cpwc-location-link--no-icon .cpwc-location-link__pin {
		display: inline-flex;
	}

	.cpwc-location-link--mobile-icon .cpwc-location-link__icon {
		width: 22px;
		height: 22px;
	}

	.cpwc-location-link--mobile-icon:not(.is-empty) .cpwc-location-link__pin::after {
		content: "";
		position: absolute;
		top: -1px;
		right: -2px;
		width: 8px;
		height: 8px;
		border: 2px solid #fff;
		border-radius: 50%;
		background: #2ea44f;
	}
}

/* Checkout: recuadro con el destino de envío bloqueado */
.cpwc-ship-to {
	margin: 0 0 20px;
	padding: 14px 16px;
	border: 2px solid var(--cpwc-accent, #e31b23);
	border-radius: 10px;
	background: #fff;
}

.woocommerce .cpwc-ship-to .cpwc-ship-to__title {
	margin: 0 0 8px;
	padding: 0;
	font-size: 1.15em;
}

.cpwc-ship-to__destination {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0 0 6px;
	font-size: 1.05em;
}

.cpwc-ship-to__destination svg {
	flex: none;
	margin-top: 2px;
	color: var(--cpwc-accent, #e31b23);
}

.cpwc-ship-to__help {
	margin: 0;
	font-size: .9em;
	opacity: .85;
}

.cpwc-ship-to__help a {
	font-weight: 600;
	white-space: nowrap;
}
