/*
Theme Name:   Hypro Child
Description:  Child theme for custom homepage, WooCommerce, and templates.
Author:       Hypro
Template:     twentytwentyfive
Version:      1.0.0
Text Domain:  hypro-child
*/

/* Parent styles load via functions.php. Add overrides below. */

/*
 * Edge-to-edge layout: large images / grid children must be allowed to shrink
 * (min-width: 0) or the document grows wider than the viewport (white strip + scrollbar).
 */
body.hypro-custom-header {
	box-sizing: border-box;
}

body.hypro-custom-header .hypro-site-header {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

body.hypro-custom-header .site-main {
	min-width: 0;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

body.hypro-custom-header .entry-content {
	min-width: 0;
}

/* Remove underlines from all links and buttons inside the site header */
.hypro-site-header a,
.hypro-site-header button {
	text-decoration: none !important;
}

/* Reset theme button chrome on all header buttons (cart toggle, hamburger) */
.hypro-site-header button {
	border: none;
	background: none;
	box-shadow: none;
	outline-offset: 2px;
}

/* Cart quantity badge */
.hypro-header-cart-badge {
	position: absolute;
	top: 2px;
	right: 2px;
	transform: translate(40%, -20%);
	min-width: 0.7rem;
	height: 0.7rem;
	padding: 0 0.15rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	background: #fff;
	color: #00118d;
	font-size: 0.45rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0;
	box-shadow: 0 0 0 1.5px #00118d;
	pointer-events: none;
}
.hypro-header-cart-badge.hidden {
	display: none;
}

/* Hide default Site Editor header so the Hypro bar is the only top nav. */
body.hypro-custom-header .wp-site-blocks > .wp-block-template-part:first-child,
body.hypro-custom-header .wp-site-blocks > header:first-of-type {
	display: none !important;
}

/* Sticky bar clears the WP admin bar. */
.admin-bar .hypro-site-header {
	top: 32px;
}
@media screen and (max-width: 782px) {
	.admin-bar .hypro-site-header {
		top: 46px;
	}
}

/* ─── Cart side drawer ──────────────────────────────────── */

/* Backdrop */
.hypro-mini-cart-backdrop {
	position: fixed;
	inset: 0;
	z-index: 59;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}
.hypro-mini-cart-backdrop.is-open {
	opacity: 1;
	pointer-events: auto;
}

/* Panel */
.hypro-mini-cart-panel {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 60;
	width: 100%;
	max-width: 24rem;
	background: #fff;
	box-shadow: -4px 0 32px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s;
	visibility: hidden;
}
.hypro-mini-cart-panel.is-open {
	transform: translateX(0);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
	visibility: visible;
}

/* Full-screen on mobile */
@media (max-width: 479px) {
	.hypro-mini-cart-panel {
		max-width: 100%;
	}
}

/* Account for WP admin bar */
.admin-bar .hypro-mini-cart-panel {
	top: 32px;
}
@media screen and (max-width: 782px) {
	.admin-bar .hypro-mini-cart-panel {
		top: 46px;
	}
}

/* Panel header */
.hypro-mini-cart-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.875rem 1rem;
	border-bottom: 1px solid #e5e7eb;
	flex-shrink: 0;
}
.hypro-mini-cart-panel__title {
	font-size: 1rem;
	font-weight: 600;
	color: #111827;
}
.hypro-mini-cart-panel__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.375rem;
	border: none;
	background: transparent;
	color: #6b7280;
	cursor: pointer;
	border-radius: 0.375rem;
	line-height: 1;
	transition: color 0.15s ease, background 0.15s ease;
}
.hypro-mini-cart-panel__close:hover {
	color: #111827;
	background: #f3f4f6;
}

/* Scrollable body */
.hypro-mini-cart-panel__body {
	flex: 1 1 auto;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 0.75rem;
}

/* ─── WooCommerce content inside panel ──────────────────── */

/* Product list reset */
.hypro-mini-cart-panel ul.woocommerce-mini-cart {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Each cart item */
.hypro-mini-cart-panel .woocommerce-mini-cart-item {
	position: relative;
	display: block;
	padding: 0.875rem 0;
	border-bottom: 1px solid #f0f0f0;
}

/* Row: image + details side by side */
.hypro-mini-cart-panel .hypro-cart-row {
	display: flex !important;
	flex-direction: row !important;
	align-items: flex-start !important;
	gap: 0.75rem;
	padding-right: 1.5rem;
}

/* Right column: name + quantity stacked */
.hypro-mini-cart-panel .hypro-cart-details {
	display: flex !important;
	flex-direction: column !important;
	gap: 0.2rem;
	min-width: 0;
	flex: 1 !important;
}

.hypro-mini-cart-panel .hypro-cart-name-link {
	display: block !important;
	text-decoration: none !important;
	color: #111827 !important;
	font-weight: 500;
	font-size: 0.875rem;
	line-height: 1.4;
}
.hypro-mini-cart-panel .hypro-cart-name-link:hover {
	color: #00118d !important;
}

/* Product image — fixed 60×60 square */
.hypro-mini-cart-panel .hypro-cart-thumb-link {
	display: block !important;
	flex-shrink: 0 !important;
	width: 60px !important;
	height: 60px !important;
	overflow: hidden !important;
	border-radius: 0.375rem;
	background: #f5f5f5;
}
.hypro-mini-cart-panel .hypro-cart-thumb {
	display: block !important;
	width: 60px !important;
	height: 60px !important;
	overflow: hidden !important;
	border-radius: 0.375rem;
	background: #f5f5f5;
}
.hypro-mini-cart-panel .hypro-cart-thumb img,
.hypro-mini-cart-panel .hypro-cart-thumb-link img {
	display: block !important;
	float: none !important;
	width: 60px !important;
	height: 60px !important;
	max-width: 60px !important;
	max-height: 60px !important;
	min-width: unset !important;
	min-height: unset !important;
	object-fit: contain !important;
	margin: 0 !important;
	padding: 0 !important;
	box-shadow: none !important;
}

/* Quantity × price */
.hypro-mini-cart-panel .woocommerce-mini-cart-item .quantity {
	display: block;
	font-size: 0.8rem;
	color: #6b7280;
}

/* Variation data */
.hypro-mini-cart-panel .woocommerce-mini-cart-item .variation {
	padding-left: 0.5rem;
	border-left: 2px solid #e5e7eb;
	font-size: 0.75rem;
	color: #9ca3af;
}
.hypro-mini-cart-panel .woocommerce-mini-cart-item .variation dt,
.hypro-mini-cart-panel .woocommerce-mini-cart-item .variation dd {
	display: inline;
	margin: 0;
	float: none;
}
.hypro-mini-cart-panel .woocommerce-mini-cart-item .variation dt::after {
	content: ': ';
}
.hypro-mini-cart-panel .woocommerce-mini-cart-item .variation dd::after {
	content: ' · ';
}
.hypro-mini-cart-panel .woocommerce-mini-cart-item .variation dd:last-of-type::after {
	content: '';
}

/* Remove (×) button */
.hypro-mini-cart-panel .woocommerce-mini-cart-item .remove_from_cart_button {
	position: absolute;
	top: 0.875rem;
	right: 0;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 1.25rem;
	height: 1.25rem;
	font-size: 1rem;
	line-height: 1;
	color: #9ca3af;
	text-decoration: none !important;
	font-weight: 400;
}
.hypro-mini-cart-panel .woocommerce-mini-cart-item .remove_from_cart_button:hover {
	color: #ef4444;
}

/* Subtotal row */
.hypro-mini-cart-panel .woocommerce-mini-cart__total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.875rem 0;
	margin: 0;
	font-size: 0.9rem;
	font-weight: 600;
	color: #111827;
	border-top: 1px solid #e5e7eb;
	border-bottom: none;
}
.hypro-mini-cart-panel .woocommerce-mini-cart__total strong {
	min-width: auto;
	font-weight: 600;
}

/* Buttons */
.hypro-mini-cart-panel .woocommerce-mini-cart__buttons {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 0;
	margin: 0;
}
.hypro-mini-cart-panel .woocommerce-mini-cart__buttons .button {
	display: block !important;
	width: 100% !important;
	box-sizing: border-box;
	text-align: center;
	padding: 0.625rem 1rem !important;
	font-size: 0.875rem !important;
	font-weight: 600;
	line-height: 1.25 !important;
	border-radius: 0.375rem;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	/* Reset large theme button sizing */
	min-height: 0 !important;
	letter-spacing: 0;
}

/* "Ver carrito" — outline */
.hypro-mini-cart-panel .woocommerce-mini-cart__buttons .button.wc-forward:not(.checkout) {
	background: transparent;
	color: #00118d;
	border: 1.5px solid #00118d;
}
.hypro-mini-cart-panel .woocommerce-mini-cart__buttons .button.wc-forward:not(.checkout):hover {
	background: #00118d;
	color: #fff;
}

/* "Tramitar pedido" — solid primary */
.hypro-mini-cart-panel .woocommerce-mini-cart__buttons .button.checkout {
	background: #00118d;
	color: #fff !important;
	border: 1.5px solid #00118d;
}
.hypro-mini-cart-panel .woocommerce-mini-cart__buttons .button.checkout:hover {
	background: #000e6a;
	border-color: #000e6a;
}

/* Empty cart message */
.hypro-mini-cart-panel .woocommerce-mini-cart__empty-message {
	text-align: center;
	color: #9ca3af;
	padding: 2.5rem 1rem;
	margin: 0;
	font-size: 0.9rem;
}

/* Prevent background scroll when drawer is open */
body.hypro-cart-open {
	overflow: hidden;
}

/*
 * Homepage: force two products in one row.
 * WooCommerce uses floats/% widths; block themes often stack list items — override with grid.
 */
.hypro-home-products .woocommerce.hypro-home-products-loop {
	min-width: 0;
}

.hypro-home-products-loop .woocommerce.columns-2 ul.products,
.hypro-home-products-loop ul.products {
	display: grid !important;
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	gap: 1.25rem 1.5rem !important;
	align-items: start !important;
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	width: 100% !important;
	min-width: 0 !important;
	clear: both !important;
}

.hypro-home-products-loop ul.products::before,
.hypro-home-products-loop ul.products::after {
	display: none !important;
	content: none !important;
}

.hypro-home-products-loop ul.products li.product {
	width: 100% !important;
	min-width: 0 !important;
	max-width: none !important;
	float: none !important;
	clear: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	flex: initial !important;
}

/*
 * Homepage: product images — fit natural aspect ratio (no hard crop, no clipping).
 * Thumbnail size is switched to `large` in home-products.php; CSS keeps layout contained.
 */
.hypro-home-products-loop li.product,
.hypro-home-products-loop li.product .woocommerce-loop-product__link {
	overflow: visible !important;
}

.hypro-home-products-loop li.product .woocommerce-loop-product__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.5rem;
	padding-top: 0.5rem;
}

.hypro-home-products-loop li.product .woocommerce-loop-product__link img,
.hypro-home-products-loop li.product img {
	width: auto !important;
	max-width: 100% !important;
	height: auto !important;
	max-height: min(50vh, 320px) !important;
	object-fit: contain !important;
	object-position: center !important;
	aspect-ratio: auto !important;
	display: block !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

@media (min-width: 480px) {
	.hypro-home-products-loop li.product .woocommerce-loop-product__link img,
	.hypro-home-products-loop li.product img {
		max-height: min(55vh, 360px) !important;
	}
}

@media (min-width: 768px) {
	.hypro-home-products-loop li.product .woocommerce-loop-product__link img,
	.hypro-home-products-loop li.product img {
		max-height: min(60vh, 400px) !important;
	}
}

/* Single column on very small screens only */
@media (max-width: 479px) {
	.hypro-home-products-loop ul.products {
		grid-template-columns: 1fr !important;
	}
}
