/*
 * JL PDP Mobile — Página de producto en móvil
 * Sticky ATC bar, galería con scroll-snap, layout optimizado.
 */

/* ─── Cinta destacada en producto: evitar recorte en tablet/móvil Oxygen ─── */
@media (max-width: 991px) {
	.woocommerce.single-product .single-product-wrapper .product-gallery {
		position: relative;
		overflow: visible !important;
	}

	.woocommerce.single-product .single-product-wrapper .product-gallery .sale_tag {
		position: relative !important;
		overflow: visible !important;
	}

	.woocommerce.single-product .single-product-wrapper .product-gallery .sale_tag .ribbon {
		top: -15px !important;
		left: 26px !important;
		z-index: 20 !important;
		position: absolute !important;
	}

	.woocommerce.single-product .single-product-wrapper .product-gallery .product-featured .ribbon .ribbon-content {
		padding-top: 7px !important;
		padding-bottom: 7px !important;
		font-size: 12px !important;
		line-height: 1 !important;
		min-width: 78px !important;
	}
}

/* ─── Cinta destacada en móvil: ajustes para pantallas pequeñas ────────────── */
@media (max-width: 480px) {
	.woocommerce.single-product .single-product-wrapper .product-gallery .sale_tag .ribbon {
		top: -12px !important;
		left: 16px !important;
	}

	.woocommerce.single-product .single-product-wrapper .product-gallery .product-featured .ribbon .ribbon-content {
		padding-top: 5px !important;
		padding-bottom: 5px !important;
		font-size: 11px !important;
		min-width: 70px !important;
	}
}

/* ─── Sticky ATC bar ─────────────────────────────────────────────────────── */
@media (max-width: 767px) {
	.jl-sticky-atc {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 999;
		background: #fff;
		border-top: 1px solid rgba(178, 146, 71, 0.22);
		box-shadow: 0 -4px 28px rgba(36, 31, 27, 0.10);
		padding: 11px 16px 10px;
		/* Respeta el área segura en iPhones con home indicator */
		padding-bottom: max(10px, calc(env(safe-area-inset-bottom) + 8px));
		transform: translateY(100%);
		transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
		will-change: transform;
	}

	.jl-sticky-atc.is-visible {
		transform: translateY(0);
	}

	.jl-sticky-atc__inner {
		display: flex;
		align-items: center;
		gap: 12px;
		width: 100%;
		max-width: 600px;
		margin: 0 auto;
	}

	.jl-sticky-atc__info {
		flex: 1 1 auto;
		min-width: 0;
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	.jl-sticky-atc__title {
		display: block;
		font-size: 11px;
		font-weight: 600;
		color: rgba(36, 31, 27, 0.76);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		letter-spacing: 0.01em;
	}

	.jl-sticky-atc__price {
		display: block;
		font-size: 17px;
		font-weight: 700;
		color: #9b7c39;
		letter-spacing: 0;
	}

	.jl-sticky-atc__price .woocommerce-Price-amount {
		color: inherit;
		font-size: inherit;
		font-weight: inherit;
	}

	.jl-sticky-atc__btn {
		flex: 0 0 auto;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 132px;
		min-height: 48px;
		padding: 0 17px;
		background: #1e1e23;
		color: #fff;
		font-size: 12px;
		font-weight: 700;
		letter-spacing: 0.04em;
		text-transform: uppercase;
		text-decoration: none;
		border: none;
		border-radius: 2px;
		transition: background 0.2s ease;
		cursor: pointer;
		white-space: nowrap;
		-webkit-tap-highlight-color: transparent;
		touch-action: manipulation;
	}

	.jl-sticky-atc__trust {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 9px;
		width: 100%;
		max-width: 600px;
		margin: 7px auto 0;
		color: rgba(36, 31, 27, 0.64);
		font-size: 10px;
		font-weight: 600;
		line-height: 1.2;
		letter-spacing: 0;
		white-space: nowrap;
	}

	.jl-sticky-atc__trust-item {
		position: relative;
		display: inline-flex;
		align-items: center;
		gap: 5px;
		min-width: 0;
	}

	.jl-sticky-atc__trust-item::before {
		content: "";
		display: block;
		width: 5px;
		height: 5px;
		border-radius: 50%;
		background: #b29247;
		flex: 0 0 5px;
	}

	.jl-sticky-atc__btn:hover,
	.jl-sticky-atc__btn:focus {
		background: #111;
		color: #fff;
		text-decoration: none;
	}

	.jl-sticky-atc__btn:focus-visible {
		outline: 2px solid #b29247;
		outline-offset: 3px;
	}

	/* Espacio en el fondo de la página para que el sticky bar no tape contenido */
	.single-product .site-content,
	.single-product #main-content,
	.single-product .page-container {
		padding-bottom: 108px !important;
	}

	.single-product .jl-cart-fab {
		bottom: max(122px, calc(env(safe-area-inset-bottom) + 110px)) !important;
	}
}

/* ─── Beneficios compactos bajo el botón real ───────────────────────────── */
@media (max-width: 767px) {
	.single-product div.product .summary,
	.single-product .summary {
		width: 100% !important;
		max-width: 100vw !important;
		padding-right: 15px !important;
		padding-left: 15px !important;
		box-sizing: border-box !important;
		overflow: hidden;
	}

	.single-product .single-product-wrapper {
		overflow-x: hidden;
	}

	.single-product .single-product-wrapper > .product_title,
	.single-product .single-product-wrapper > .posted_in,
	.single-product .single-product-wrapper > .woocommerce-product-details__short-description,
	.single-product .single-product-wrapper > .price,
	.single-product .single-product-wrapper > .jl-pdp-mobile-specs,
	.single-product .single-product-wrapper > form.cart,
	.single-product .single-product-wrapper > .jl-pdp-mobile-trust,
	.single-product .single-product-wrapper > .yith-wcwl-add-to-wishlist {
		width: min(calc(100vw - 60px), 430px) !important;
		max-width: calc(100vw - 60px) !important;
		margin-right: auto !important;
		margin-left: auto !important;
		box-sizing: border-box !important;
	}

	.single-product .single-product-wrapper > .product_title {
		margin-top: 22px !important;
		margin-bottom: 8px !important;
		color: #2a2726 !important;
		font-size: 27px !important;
		font-weight: 600 !important;
		line-height: 1.1 !important;
		letter-spacing: 0 !important;
		overflow-wrap: normal !important;
		word-break: normal !important;
	}

	.single-product .single-product-wrapper > .posted_in {
		display: block;
		margin-bottom: 22px !important;
		color: rgba(36, 31, 27, 0.58) !important;
		font-size: 13px !important;
		font-weight: 600 !important;
		line-height: 1.35 !important;
		letter-spacing: 0.02em !important;
		text-transform: none !important;
	}

	.single-product .single-product-wrapper > .posted_in a {
		color: #a88448 !important;
		text-decoration: none !important;
	}

	.single-product .summary .woocommerce-product-details__short-description,
	.single-product .summary .woocommerce-product-details__short-description p,
	.single-product .single-product-wrapper > .woocommerce-product-details__short-description,
	.single-product .single-product-wrapper > .woocommerce-product-details__short-description p {
		max-width: 100%;
		white-space: normal !important;
		overflow-wrap: normal !important;
		word-break: normal !important;
	}

	.single-product .single-product-wrapper > .woocommerce-product-details__short-description {
		width: calc(100vw - 84px) !important;
		max-width: 306px !important;
		margin-right: 30px !important;
		margin-left: 30px !important;
	}

	.single-product .single-product-wrapper > .woocommerce-product-details__short-description p {
		width: 100% !important;
		max-width: 306px !important;
		margin-right: 0 !important;
		margin-left: 0 !important;
	}

	.single-product .summary.entry-summary > .woocommerce-product-details__short-description,
	.single-product .summary.entry-summary > .woocommerce-product-details__short-description p {
		width: 100% !important;
		max-width: 306px !important;
	}

	.single-product .single-product-wrapper > .price {
		margin-top: 24px !important;
		margin-bottom: 14px !important;
		color: #a98b56 !important;
		font-size: 39px !important;
		font-weight: 500 !important;
		line-height: 1 !important;
		letter-spacing: 0 !important;
	}

	.single-product .single-product-wrapper > .price .amount,
	.single-product .single-product-wrapper > .price .woocommerce-Price-amount {
		color: inherit !important;
		font-size: inherit !important;
		font-weight: inherit !important;
		line-height: inherit !important;
	}

	.jl-pdp-mobile-specs {
		display: grid;
		grid-template-columns: 1fr;
		gap: 8px;
		width: min(calc(100vw - 60px), 430px) !important;
		max-width: calc(100vw - 60px) !important;
		margin-right: auto !important;
		margin-left: auto !important;
		margin-top: 0 !important;
		margin-bottom: 16px !important;
		box-sizing: border-box !important;
	}

	.jl-pdp-mobile-spec {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		justify-content: center;
		gap: 5px;
		min-width: 0;
		width: 100%;
		min-height: 56px;
		padding: 10px 12px;
		border: 1px solid rgba(178, 146, 71, 0.18);
		background: #fbfaf7;
		box-sizing: border-box;
	}

	.jl-pdp-mobile-spec__label {
		flex: 0 0 auto;
		color: #8e7850;
		font-size: 10px;
		font-weight: 700;
		line-height: 1.1;
		letter-spacing: 0.08em;
		text-transform: uppercase;
		white-space: nowrap;
	}

	.jl-pdp-mobile-spec__value {
		min-width: 0;
		max-width: 100%;
		color: #2a2726;
		font-size: 14px;
		font-weight: 700;
		line-height: 1.2;
		overflow-wrap: anywhere;
		text-align: left;
	}

	.single-product form.cart:not(.variations_form),
	.single-product form.cart .woocommerce-variation-add-to-cart {
		display: grid !important;
		grid-template-columns: 138px minmax(0, 1fr);
		gap: 10px;
		align-items: stretch;
		width: 100%;
	}

	.single-product form.cart .quantity {
		display: grid !important;
		grid-template-columns: 44px 50px 44px;
		align-items: stretch;
		width: 138px !important;
		min-width: 138px !important;
		margin: 0 !important;
		float: none !important;
	}

	.single-product form.cart .quantity .minus,
	.single-product form.cart .quantity .plus,
	.single-product form.cart .quantity .qty {
		width: 100% !important;
		min-width: 0 !important;
		height: 52px !important;
		min-height: 52px !important;
		margin: 0 !important;
		border-radius: 0 !important;
		float: none !important;
	}

	.single-product form.cart .quantity .minus,
	.single-product form.cart .quantity .plus {
		border: 0 !important;
		background: #b89d68 !important;
		color: #fff !important;
		font-size: 18px !important;
		font-weight: 600 !important;
	}

	.single-product form.cart .quantity .qty {
		border: 1px solid rgba(178, 146, 71, 0.34) !important;
		background: #fff !important;
		color: #241f1b !important;
		font-size: 16px !important;
		font-weight: 700 !important;
		text-align: center !important;
	}

	.single-product form.cart .single_add_to_cart_button {
		width: 100% !important;
		min-width: 0 !important;
		min-height: 52px !important;
		margin: 0 !important;
		padding: 0 14px !important;
		float: none !important;
	}

	.jl-pdp-mobile-trust {
		grid-column: 1 / -1;
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
		margin-top: 14px !important;
		margin-bottom: 18px !important;
		padding: 12px;
		border: 1px solid rgba(178, 146, 71, 0.18);
		background: rgba(250, 248, 244, 0.76);
	}

	.jl-pdp-mobile-trust__item {
		position: relative;
		display: flex;
		align-items: center;
		min-height: 30px;
		padding-left: 16px;
		color: rgba(36, 31, 27, 0.76);
		font-size: 12px;
		font-weight: 600;
		line-height: 1.25;
		letter-spacing: 0;
	}

	.jl-pdp-mobile-trust__item::before {
		content: "";
		position: absolute;
		left: 0;
		top: 50%;
		width: 6px;
		height: 6px;
		border-radius: 50%;
		background: #b29247;
		transform: translateY(-50%);
	}
}

@media (min-width: 768px) {
	.jl-pdp-mobile-specs,
	.jl-pdp-mobile-trust {
		display: none;
	}
}

@media (max-width: 374px) {
	.single-product .single-product-wrapper > .product_title,
	.single-product .single-product-wrapper > .posted_in,
	.single-product .single-product-wrapper > .woocommerce-product-details__short-description,
	.single-product .single-product-wrapper > .price,
	.single-product .single-product-wrapper > .jl-pdp-mobile-specs,
	.single-product .single-product-wrapper > form.cart,
	.single-product .single-product-wrapper > .jl-pdp-mobile-trust,
	.single-product .single-product-wrapper > .yith-wcwl-add-to-wishlist {
		width: calc(100vw - 36px) !important;
		max-width: calc(100vw - 36px) !important;
	}

	.jl-pdp-mobile-specs {
		width: calc(100vw - 36px) !important;
		max-width: calc(100vw - 36px) !important;
		grid-template-columns: 1fr;
	}

	.single-product form.cart:not(.variations_form),
	.single-product form.cart .woocommerce-variation-add-to-cart {
		grid-template-columns: 1fr;
	}

	.single-product form.cart .quantity {
		width: 100% !important;
	}
}

@media (max-width: 420px) {
	.jl-pdp-mobile-specs {
		grid-template-columns: 1fr;
	}
}

/* ─── Galería de producto: scroll-snap horizontal ───────────────────────── */
@media (max-width: 767px) {
	/* Eliminar el lightbox en móvil (Flexslider) y usar scroll nativo */
	.woocommerce-product-gallery {
		touch-action: pan-y;
	}

	.woocommerce-product-gallery .flex-viewport {
		overflow: hidden;
	}

	.woocommerce-product-gallery__wrapper {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		gap: 0;
	}

	.woocommerce-product-gallery__wrapper::-webkit-scrollbar {
		display: none;
	}

	.woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image {
		flex: 0 0 100%;
		scroll-snap-align: start;
		max-width: 100%;
	}

	/* Thumbnails: scroll horizontal táctil */
	.woocommerce-product-gallery .flex-control-nav.flex-control-thumbs {
		display: flex;
		overflow-x: auto;
		gap: 8px;
		padding: 10px 0 4px;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.woocommerce-product-gallery .flex-control-nav.flex-control-thumbs::-webkit-scrollbar {
		display: none;
	}

	.woocommerce-product-gallery .flex-control-nav.flex-control-thumbs li {
		flex: 0 0 64px;
		width: 64px;
		height: 64px;
		margin: 0;
	}

	.woocommerce-product-gallery .flex-control-nav.flex-control-thumbs li img {
		width: 64px;
		height: 64px;
		object-fit: cover;
	}
}
