/* ═══════════════════════════════════════════════
   Bookinest — El mapa de los sentimientos — Estilos
   Prefijo: bk- (framework compartido con el resto de los
   plugins de libro) / bkms- (propio de este producto).
   ═══════════════════════════════════════════════ */

:root {
	--bkms-blue: #3e7dd4;
	--bkms-blue-dark: #000;
	--bkms-navy: #163a66;
	--bkms-blue-light: #c5d8f0;
	--bkms-bg: #f7faff;
	--bkms-text: #2b4a7a;
	--bkms-muted: #7b8c9c;
}

/* ── Carrito: fila (x) quitar + ✎ Editar ─────────────────────────────────── */
.bkbn-cart-actions {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 0;
}
@media (min-width: 769px) {
	.bkbn-cart-actions {
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 6px;
	}
}
.bkbn-cart-edit-btn {
	padding: 7px 10px !important;
	border: 1px solid #bababc !important;
	border-radius: 999px !important;
	background: #fff !important;
	color: #b3b3b4 !important;
	font-family: 'Nunito', sans-serif !important;
	font-size: 0.68rem !important;
	font-weight: 700 !important;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
@media (min-width: 769px) {
	.bkbn-cart-edit-btn { margin-top: 15px; }
}
.bkbn-cart-edit-btn:hover { border-color: #000 !important; color: #000 !important; }

/* ── Trigger: 2 tarjetas de tapa + botón ─────────────────────────────────── */
.bk-btn-wrap {
	display: block;
	margin-top: 12px;
	text-align: left;
}

.bkms-tapa-panel {
	margin-top: 8px;
}

/* Este producto no tiene elección de tapa: un solo botón "Personalizar" abre
   el formulario directo en el paso 1. En mobile, el mismo botón se vuelve
   flotante — ver el bloque responsive. */
.bkms-tapa-trigger {
	display: block;
	width: 100%;
	padding: 16px 10px !important;
	border-radius: 999px !important;
	border: none !important;
	font-family: 'Nunito', sans-serif !important;
	font-weight: 700;
	font-size: 0.95rem;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: #fff !important;
	background: var(--bkms-blue) !important;
	cursor: pointer;
	transition: background 0.2s ease;
}
.bkms-tapa-trigger:hover {
	background: var(--bkms-blue-dark) !important;
	color: #fff !important;
}

/* ── Overlay / popup (compartido) ────────────────────────────────────────── */
.bk-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
}
.bk-overlay.bk-overlay--open { display: flex; }

.bk-overlay-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	backdrop-filter: blur(3px);
}

.bk-overlay-inner {
	position: relative;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.32);
	max-width: 560px;
	width: 92vw;
	max-height: 90vh;
	padding: 40px 44px 44px;
	overflow-y: auto;
	overflow-x: hidden;
}

.bk-overlay-close {
	position: fixed !important;
	top: 16px !important;
	right: 20px !important;
	background: none !important;
	border: none !important;
	box-shadow: none !important;
	font-size: 2.6rem !important;
	line-height: 1 !important;
	cursor: pointer !important;
	color: #fff !important;
	padding: 0 !important;
	z-index: 1000000;
}
.bk-overlay-close:hover {
	background: none !important;
	color: rgba(255, 255, 255, 0.7) !important;
}

.bk-step { display: none; }
.bk-step.active { display: block; }

.bk-card { width: 100%; }

.bk-card-title {
	font-family: 'Nunito', sans-serif;
	font-weight: 800;
	font-size: 1.4rem;
	color: var(--bkms-text);
	text-align: center;
	margin-bottom: 4px;
}
.bk-card-sub {
	text-align: center;
	color: var(--bkms-muted);
	font-size: 0.9rem;
	margin-bottom: 20px;
	font-family: 'Nunito', sans-serif;
}

.bk-label {
	display: block;
	font-weight: 700;
	font-size: 0.88rem;
	color: var(--bkms-text);
	margin: 16px 0 8px;
	font-family: 'Nunito', sans-serif;
}
.bk-optional { font-weight: 400; color: var(--bkms-muted); }

.bk-input,
.bk-textarea {
	width: 100%;
	padding: 12px 14px;
	border: 1.5px solid var(--bkms-blue-light);
	border-radius: 10px;
	font-family: 'Nunito', sans-serif;
	font-size: 1rem;
	background: var(--bkms-bg);
	outline: none;
	transition: border 0.2s;
	box-sizing: border-box;
}
.bk-input:focus, .bk-textarea:focus { border-color: var(--bkms-blue); }
.bk-textarea { height: 70px; resize: vertical; }

select.bk-input { cursor: pointer; }

.bk-btn-main {
	width: 100%;
	padding: 14px !important;
	background: var(--bkms-blue) !important;
	color: #fff !important;
	border: none !important;
	border-radius: 999px !important;
	font-family: 'Nunito', sans-serif;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.2s;
}
.bk-btn-main:hover { background: var(--bkms-blue-dark) !important; color: #fff !important; }
.bk-btn-main:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Pasos (1/2/3): contador y botón "Volver" ────────────────────────────── */
.bkms-step-count {
	text-align: center;
	color: var(--bkms-muted);
	font-family: 'Nunito', sans-serif;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	margin-bottom: 20px;
}

.bkms-back-btn {
	display: inline-block;
	margin-bottom: 12px;
	color: var(--bkms-blue);
	font-family: 'Nunito', sans-serif;
	font-weight: 700;
	font-size: 0.9rem;
	cursor: pointer;
}
.bkms-back-btn:hover { color: var(--bkms-blue-dark); }

.bk-error {
	margin-top: 10px;
	padding: 10px 14px;
	background: #fdecea;
	border-radius: 8px;
	color: #c0392b;
	font-size: 0.88rem;
	display: none;
}

/* ── Paso 4: upsell de formato (físico / físico+eBook) ───────────────────── */
.bkms-upsell-sub {
	text-align: center;
	color: var(--bkms-muted);
	font-size: 0.82rem;
	margin: 0 0 2px;
	font-family: 'Nunito', sans-serif;
}
.bkms-upsell-title {
	font-family: 'Nunito', sans-serif;
	font-weight: 800;
	font-size: 1.4rem;
	color: var(--bkms-text);
	text-align: center;
	line-height: 1.15;
	margin: 0 0 6px;
}
.bkms-upsell-desc {
	text-align: center;
	color: var(--bkms-muted);
	font-size: 0.9rem;
	font-family: 'Nunito', sans-serif;
	margin: 0 0 22px;
}
.bkms-upsell-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
}
.bkms-upsell-card {
	position: relative;
	border: 2.5px solid var(--bkms-blue-light);
	border-radius: 14px;
	padding: 20px 14px 18px;
	text-align: center;
	cursor: pointer;
	transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.bkms-upsell-card:hover {
	border-color: var(--bkms-navy) !important;
	background: var(--bkms-navy) !important;
	color: #fff !important;
}
.bkms-upsell-card:hover .bkms-upsell-name,
.bkms-upsell-card:hover .bkms-upsell-price { color: #fff; }
.bkms-upsell-card.recommended {
	border-color: var(--bkms-blue);
	background: var(--bkms-bg);
}
.bkms-upsell-card.pending { pointer-events: none; opacity: 0.6; }
.bkms-upsell-badge {
	position: absolute;
	top: -12px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--bkms-blue);
	color: #fff;
	font-family: 'Nunito', sans-serif;
	font-size: 0.62rem;
	font-weight: 800;
	letter-spacing: 0.03em;
	white-space: nowrap;
	padding: 4px 10px;
	border-radius: 999px;
}
.bkms-upsell-card.recommended:hover .bkms-upsell-badge {
	background: #fff;
	color: var(--bkms-blue);
}
.bkms-upsell-icon { font-size: 2rem; margin-bottom: 8px; }
.bkms-upsell-name {
	font-family: 'Nunito', sans-serif;
	font-weight: 800;
	font-size: 1rem;
	color: var(--bkms-text);
	display: block;
	margin-bottom: 6px;
}
.bkms-upsell-price {
	font-family: 'Nunito', sans-serif;
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--bkms-blue);
	display: block;
	transition: color 0.18s;
}

/* El emoji de WordPress (📦, 📱) se auto-convierte en <img class="emoji">;
   sin esto queda gigante y desalineado. */
.bkms-upsell-icon img.emoji {
	width: 1.8rem !important;
	height: 1.8rem !important;
	max-width: 1.8rem !important;
	max-height: 1.8rem !important;
	margin: 0 2px !important;
	vertical-align: middle !important;
}

/* El paso 4 (formato) se ve como un popup propio, más chico, no como "un
   paso más" del formulario: tiene su propio padding y el overlay entero se
   achica a su contenido en vez de mantener el ancho grande de los otros
   pasos — mismo truco que usa bookinest-buenas-noches. */
#bkms-s4 {
	margin: 0;
	padding: 32px;
	width: 100%;
	box-sizing: border-box;
}
.bk-overlay-inner:has(#bkms-s4.active) {
	width: unset !important;
	padding: 0 !important;
}

/* ── Grupos de imagen (piel/pelo/ojos/extras) ────────────────────────────── */
.bkms-group { margin-top: 4px; }

.bkms-swatch-grid {
	align-items: stretch;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
	gap: 8px;
	margin-top: 4px;
}

.bkms-swatch {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 8px 4px 10px;
	border: 1.5px solid var(--bkms-blue-light);
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
	text-align: center;
	transition: border-color 0.15s ease, background 0.15s ease;
}
.bkms-swatch.sel {
	border-color: var(--bkms-blue);
	background: #eef4fb;
	box-shadow: 0 0 0 1px var(--bkms-blue) inset;
}
.bkms-swatch img {
	width: 46px;
	height: 46px;
	object-fit: contain;
	border-radius: 50%;
	background: var(--bkms-bg);
}
.bkms-swatch span {
	margin: 0 !important;
	font-family: 'Nunito', sans-serif;
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--bkms-text);
	line-height: 1.15;
}

/* ── Foto de referencia (reusa .bkms-upload-* del módulo de subida) ──────── */
.bkms-upload-field { margin: 16px 0 0; }
.bkms-upload-label {
	display: block;
	margin-bottom: 8px;
	font-weight: 700;
	font-family: 'Nunito', sans-serif;
	color: var(--bkms-text);
	font-size: 0.88rem;
}
.bkms-upload-box {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 110px;
	padding: 16px;
	background: var(--bkms-bg);
	border: 2px dashed var(--bkms-blue-light);
	border-radius: 14px;
}
/* El JS oculta/muestra estas piezas con el atributo "hidden", pero varias de
   ellas también fijan su propio "display" (flex) para cuando SÍ se muestran.
   Esa regla le empata en especificidad a la de "hidden" del navegador y a
   veces gana, dejando visibles a la vez el ícono vacío y la vista previa.
   Esta regla lo fuerza siempre, sin importar el orden de las demás. */
.bkms-upload-box [hidden] { display: none !important; }

.bkms-file-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	z-index: 2;
}
.bkms-upload-box[data-state="done"] .bkms-file-input,
.bkms-upload-box[data-state="uploading"] .bkms-file-input { pointer-events: none; }

.bkms-upload-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	color: var(--bkms-blue);
	font-weight: 600;
	font-family: 'Nunito', sans-serif;
	text-align: center;
}
.bkms-upload-empty svg { width: 26px; height: 26px; }

.bkms-upload-preview { position: relative; display: flex; align-items: center; justify-content: center; }
.bkms-upload-preview img { max-width: 100%; max-height: 160px; border-radius: 10px; object-fit: contain; }

/* Al editar un ítem del carrito que ya tiene foto: no hay una URL pública
   para mostrarla (a propósito, ver el módulo de subida), así que se muestra
   este aviso en vez de una imagen. */
.bkms-upload-existing {
	display: none;
	color: var(--bkms-blue);
	font-family: 'Nunito', sans-serif;
	font-weight: 700;
	font-size: 0.85rem;
}

.bkms-remove {
	position: absolute;
	top: -10px;
	right: -10px;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	background: #000;
	border: 2px solid #fff;
	border-radius: 999px;
	color: #fff;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}

.bkms-upload-progress {
	position: absolute;
	right: 16px;
	bottom: 10px;
	left: 16px;
	height: 6px;
	overflow: hidden;
	background: var(--bkms-blue-light);
	border-radius: 999px;
}
.bkms-upload-bar { height: 100%; background: var(--bkms-blue); transition: width 0.15s ease; }

.bkms-upload-error {
	position: absolute;
	right: 16px;
	bottom: 10px;
	left: 16px;
	color: #c0392b;
	font-size: 12px;
	text-align: center;
}

.bkms-upload-hint {
	margin: 8px 0 0;
	color: var(--bkms-muted);
	font-size: 0.78rem;
	font-family: 'Nunito', sans-serif;
}

/* ── Responsive: en mobile el formulario se inserta en la página, en el
   mismo lugar del botón "Personalizar", y lo reemplaza — no se abre como
   popup flotante. Mismo criterio que bookinest-buenas-noches. El JS mueve
   el overlay dentro de .bkms-tapa-panel y le agrega la clase
   "bkms-showing-form"; estas reglas lo hacen ver como parte de la página en
   vez de como un modal (sin fondo oscuro, sin position:fixed). ─────────── */
@media (max-width: 768px) {
	.bkms-tapa-panel .bk-overlay {
		position: static;
		inset: auto;
		z-index: auto;
		display: none;
	}
	.bkms-tapa-panel .bk-overlay.bk-overlay--open { display: block; }

	.bkms-tapa-panel .bk-overlay-backdrop { display: none; }
	.bkms-tapa-panel .bk-overlay-close { display: none; }

	.bkms-tapa-panel .bk-overlay-inner {
		width: 100%;
		max-width: 100%;
		overflow: visible;
		/* Misma "tarjeta" que usa el formulario inline de los otros plugins:
		   no vive dentro de ningún popup modal, así que necesita su propio
		   fondo/sombra en vez de heredar el estilo de overlay. */
		background: #fff;
		border-radius: 14px;
		box-shadow: 0 4px 24px rgba( 0, 0, 0, 0.12 );
		/* El sitio tiene una regla global que fuerza ".bk-overlay-inner" a
		   padding:16px !important en mobile (pensada para el popup modal de
		   los otros plugins); acá hace falta pisarla. */
		padding: 28px 32px 32px !important;
	}

	.bkms-tapa-panel #bkms-s4 { padding: 24px 0; }

	/* Botón flotante "Personalizar": mismo criterio que el resto de los
	   plugins — mientras no se eligió tapa, funciona como acceso directo
	   fijo abajo de la pantalla para volver a las tarjetas; se atenúa
	   cuando esa zona ya está a la vista y desaparece apenas el formulario
	   reemplaza a las tarjetas (ver arriba). */
	.bkms-tapa-trigger {
		position: fixed !important;
		bottom: 50px !important;
		left: 50% !important;
		transform: translateX( -50% ) !important;
		z-index: 99999 !important;
		width: calc( 100% - 40px ) !important;
		max-width: 360px !important;
		white-space: nowrap !important;
		box-shadow: 0 4px 24px rgba( 0, 0, 0, 0.3 ) !important;
		transition: opacity 0.25s ease !important;
	}
	.bkms-tapa-trigger.bk-float-hidden {
		opacity: 0 !important;
		pointer-events: none !important;
	}
}

/* ── ≤600px: opciones con fotito (piel, pelo, ojos, extras) en 2 por fila ── */
@media (max-width: 600px) {
	.bkms-swatch-grid {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 8px;
	}
	.bkms-swatch {
		flex: 0 0 36%;
		max-width: 140px;
	}
	.bkms-swatch img {
		width: 52px;
		height: 52px;
	}
}


/* ── Mobile: el contenedor de Astra (.ast-container) en la página del producto
   mantiene el ancho del sitio (80%, máx. 1200px) pero sin el padding lateral
   que Astra activa y desactiva según el breakpoint (544px, 768px, 921px),
   que hacía que el formulario saltara y quedara más angosto de lo necesario. ── */
@media (max-width: 768px) {
  .single-product #content > .ast-container {
    width: 80% !important;
    max-width: 1200px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box;
  }
}

/* ── Mobile: el formulario abre a PANTALLA COMPLETA (como un popup) con una X
   arriba a la derecha para salir; al salir se reinicia. ─────────────────── */
html.bk-fs-lock,
html.bk-fs-lock body { overflow: hidden !important; }

.bkms-tapa-panel .bk-fs-close { display: none; }

@media (max-width: 768px) {
  .bkms-tapa-panel.bkms-showing-form .bk-fs-close {
    display: flex;
    position: fixed;
    top: 10px;
    right: 12px;
    z-index: 1000004;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    font-size: 2.3rem;
    line-height: 1;
    color: #154589;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .bkms-tapa-panel.bkms-showing-form .bk-overlay.bk-overlay--open {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1000003 !important;
    margin: 0 !important;
    padding: 60px 16px 28px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    display: flex !important;
    flex-direction: column;
  }

  /* Sin la "tarjeta" interna: ya es una pantalla entera. Si el paso es corto
     queda centrado en vertical; si es largo, scrollea. */
  .bkms-tapa-panel.bkms-showing-form .bk-overlay-inner {
    margin: auto 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    flex-shrink: 0;
  }
  .bkms-tapa-panel.bkms-showing-form .bk-overlay-inner .bk-step.active {
    padding: 0 !important;
    overflow: visible !important;
    max-height: none !important;
    width: 100% !important;
  }
  .bkms-tapa-panel.bkms-showing-form .bk-overlay-inner .bk-card {
    padding: 0 !important;
    max-width: none !important;
  }
}

/* Pantalla completa — upsell de formato: el tema pone display:flex (en fila) a
   cualquier .bk-step.active del overlay y el paso 4 del popup achica el overlay
   con :has(); acá va a ancho completo y en columna. */
@media (max-width: 768px) {
  .bkms-tapa-panel.bkms-showing-form .bk-overlay-inner:has(#bkms-s4.active) {
    width: 100% !important;
    padding: 0 !important;
  }
  .bkms-tapa-panel.bkms-showing-form .bk-overlay-inner .bk-step.active {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .bkms-tapa-panel.bkms-showing-form #bkms-s4 {
    padding: 8px 0 !important;
    width: 100% !important;
  }
}

/* ── Carrito mobile: popup de edición a pantalla completa ── */
@media (max-width: 768px) {
  /* El tema trae CSS viejo que fuerza .bk-overlay inline y visible: en el carrito
     el popup tiene que ser un popup (oculto hasta tocar "Editar"). */
  body.woocommerce-cart #bookinest-bkms-overlay {
    display: none !important;
  }
  body.woocommerce-cart #bookinest-bkms-overlay.bk-overlay--open {
    display: flex !important;
    flex-direction: column;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1000003 !important;
    margin: 0 !important;
    padding: 60px 16px 28px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  body.woocommerce-cart #bookinest-bkms-overlay .bk-overlay-backdrop { display: none !important; }
  body.woocommerce-cart #bookinest-bkms-overlay .bk-overlay-close {
    display: flex !important;
    position: fixed !important;
    top: 10px !important;
    right: 12px !important;
    left: auto !important;
    z-index: 1000004 !important;
    width: 44px !important;
    height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 2.3rem !important;
    line-height: 1 !important;
    padding: 0 !important;
    color: #154589 !important;
    background: #ffffff !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
    cursor: pointer !important;
  }
  body.woocommerce-cart #bookinest-bkms-overlay .bk-overlay-inner {
    position: static !important;
    margin: auto 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    animation: none !important;
    transform: none !important;
    flex-shrink: 0;
  }
  body.woocommerce-cart #bookinest-bkms-overlay .bk-step.active {
    flex: 0 0 auto !important;
    flex-direction: column !important;
    align-items: stretch !important;
    overflow: visible !important;
    max-height: none !important;
    padding: 0 !important;
    width: 100% !important;
  }
  body.woocommerce-cart #bookinest-bkms-overlay .bk-card {
    padding: 0 !important;
    max-width: none !important;
  }
}
