/**
 * MeatMaster Quick View — styles
 * --------------------------------------------------------------------------
 * Uses the theme's existing custom properties (--base, --contrast, --accent)
 * so the modal inherits the live site's palette. Falls back to neutral values
 * if those vars aren't defined on a given page.
 *
 * Loaded via wp_enqueue_style('mm-quickview', ...).
 */

/* ---- Trigger button: over-image hover overlay ----------------------- */
/* Give the product card a positioning context so the button can overlay
   the thumbnail. Standard WooCommerce archive cards are li.product. */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.related-product,
.related-product .product-image {
	position: relative;
}

.mm-quickview-trigger {
	position: absolute;
	bottom: 10px;
	inset-inline-start: 10px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 5px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1;
	color: var(--contrast, #1a1a1a);
	background: var(--base, #fff);
	border: 0px solid #ffffff;
	border-radius: 50px;
	cursor: pointer;
	opacity: 0;
	transform: translateY(-4px);
	pointer-events: none;
	transition: opacity .2s ease, transform .2s ease,
	            background .2s ease, color .2s ease, border-color .2s ease;
}

.mm-quickview-trigger .mm-qv-shape svg {
	width: 9px;
	height: 9px;
}

/* Reveal when the card is hovered or anything inside it is focused. */
.woocommerce ul.products li.product:hover .mm-quickview-trigger,
.woocommerce ul.products li.product:focus-within .mm-quickview-trigger,
.woocommerce-page ul.products li.product:hover .mm-quickview-trigger,
.woocommerce-page ul.products li.product:focus-within .mm-quickview-trigger,
.related-product:hover .mm-quickview-trigger,
.related-product:focus-within .mm-quickview-trigger {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.mm-quickview-trigger:hover,
.mm-quickview-trigger:focus-visible {
	color: var(--base, #fff);
	background: var(--accent, #8a1f1f);
	border-color: var(--accent, #8a1f1f);
}

.mm-quickview-trigger:focus-visible {
	outline: 2px solid var(--accent, #8a1f1f);
	outline-offset: 2px;
	/* Always show when keyboard-focused, even if the parent hover rule
	   hasn't fired. */
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.mm-quickview-trigger .mm-qv-shape {
	flex: 0 0 auto;
	display: inline-flex;
	line-height: 0;
}

/* Touch devices can't hover, so a hover-only overlay would be unreachable.
   Keep the button visible on coarse pointers. */
@media (hover: none), (pointer: coarse) {
	.mm-quickview-trigger {
		opacity: 1;
		transform: none;
		pointer-events: auto;
	}
}

/* ---- Modal shell ---------------------------------------------------- */
.mm-qv-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.mm-qv-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	cursor: pointer;
}

.mm-qv-box {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 880px;
	max-height: 90vh;
	overflow-y: auto;
	background: var(--base, #fff);
	color: var(--contrast, #1a1a1a);
	box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
	-webkit-overflow-scrolling: touch;
	border-radius: 6px;
}

.mm-qv-close {
    position: absolute;
    top: 10px;
    inset-inline-end: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    font-size: 26px;
    line-height: 1;
    color: var(--contrast, #1a1a1a);
    background: transparent;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mm-qv-close:focus-visible {
	outline: 2px solid var(--accent, #8a1f1f);
	outline-offset: 2px;
}

/* ---- Status / loading ---------------------------------------------- */
.mm-qv-status {
	padding: 60px 24px;
	text-align: center;
	font-size: 15px;
	color: var(--contrast, #1a1a1a);
}

.mm-qv-status.is-error {
	color: var(--accent, #8a1f1f);
}

/* ---- Content layout ------------------------------------------------- */
.mm-qv-inner {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 2rem;
	padding: 28px;
}


.mm-qv-media .mm-qv-image, .mm-qv-media img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    border-radius: 14px;
}

.mm-qv-title {
	margin-top: 10px;
	font-size: 1.2rem;
	line-height: 1.2;
	font-weight: 600;
}

@media (min-width: 768px) {
    .mm-qv-title {
        font-size: 1.5rem;
    }
}

.mm-qv-price {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 20px;
    line-height: 1.2;
}

.mm-qv-price del {
	opacity: .6;
	font-weight: 400;
	margin-inline-end: 6px;
}

.mm-qv-excerpt {
	display: none;
}

/* Let the WooCommerce form + Acowebs fields inherit theme spacing.
   Only minimal layout help here so we don't fight existing styles. */
.mm-qv-form .quantity {
	margin-inline-end: 10px;
}

.mm-qv-form .single_add_to_cart_button.loading {
	opacity: .6;
	pointer-events: none;
}

.mm-qv-fulllink {
	display: inline-block;
	margin-top: 16px;
	font-size: 13px;
	text-decoration: underline;
	color: var(--contrast, #1a1a1a);
}

/* ---- In-modal add-to-cart feedback --------------------------------- */
.mm-qv-feedback {
	margin-top: 12px;
	font-size: 14px;
}

.mm-qv-feedback.is-success {
	color: #1a7f37;
}

.mm-qv-feedback.is-error {
	color: var(--accent, #8a1f1f);
}

/* ---- Responsive ---------------------------------------------------- */
@media (max-width: 700px) {
	.mm-qv-inner {
		grid-template-columns: 1fr;
		gap: 18px;
		padding: 20px;
	}

	.mm-qv-box {
		max-height: 94vh;
	}
}

/* ---- Buy Now button (shared: archives + related) ------------------- */
.mm-buy-now {
	cursor: pointer;
}

.mm-buy-now.loading {
	opacity: .6;
	pointer-events: none;
}

.mm-buy-now.is-added {
	background: #1a7f37;
	border-color: #1a7f37;
	color: #fff;
}

.mm-buy-now[disabled] {
	opacity: .5;
	cursor: not-allowed;
}

/* ---- Reduced motion ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
	.mm-quickview-trigger {
		transition: opacity .01ms, color .01ms, background .01ms, border-color .01ms;
		transform: none;
	}
	.woocommerce ul.products li.product:hover .mm-quickview-trigger,
	.woocommerce ul.products li.product:focus-within .mm-quickview-trigger,
	.related-product:hover .mm-quickview-trigger,
	.related-product:focus-within .mm-quickview-trigger {
		transform: none;
	}
}

.mm-qv-modal .wcpa_wrap .wcpa_group_field label {
	width:100%;
}

.mm-qv-modal .wcpa_wrap .wcpa_grp_items label {
    display: grid;
	grid-template-columns:auto 1fr auto;
}

.mm-qv-modal .wcpa_wrap .wcpa_group_field, .product .wcpa_wrap .wcpa_grp_items {
    display: flex;
    gap: 20px;
    align-items: flex-start;
	flex-wrap:wrap;
}

.mm-qv-modal .wcpa_wrap .wcpa_group_field label {
    color: var(--contrast);
    font-size: 18px;
}

.mm-qv-modal .wcpa_wrap .wcpa_radio .wcpa_radio_custom {
    width: 1em;
    height: 1em;
    flex: 0 0 var(--wcpacheckwidth);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 2px solid #ccc;
	border-radius: 4px;
    background-color: #ffffff;
    margin: 0 5px 0 0;
}

.rtl .mm-qv-modal .wcpa_wrap .wcpa_radio .wcpa_radio_custom {
	margin: 0 0 0 5px;
}

.mm-qv-modal .wcpa_wrap .wcpa_radio .wcpa_radio_custom::after {
    content: "";
    position: absolute;
    transform: scale(0);
    transition: all ease-in-out .2s;
	  background-color: var(--accent);
    border-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 9.5L3 7l-1.5 1.5L5.5 12 14 3.5 12.5 2l-7 7.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.65em;
	border-radius:0;
	width: 1em;
	height: 1em;
}
.mm-qv-modal .wcpa_wrap .wcpa_radio input:checked~.wcpa_radio_custom {
    background-color: rgba(0,0,0,0);
    border-color: var(--accent);
}

.woocommerce-variation-add-to-cart {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
}

.quantity.buttons-added {
    float: unset;
    margin: 0 0 20px 0;
    width: 100%;
    justify-content: flex-start;
	display: flex;
    align-items: center;
}

.mm-qv-modal .wcpa_form_outer {
    margin: 0;
}

.mm-qv-modal  table {
	border: none;
}

.woocommerce .mm-qv-modal .quantity.buttons-added .minus, .woocommerce .mm-qv-modal form .quantity.buttons-added .plus, .woocommerce .mm-qv-modal  form .quantity.buttons-added .qty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2em;
    height: 2em;
    background-color: var(--base-2);
    border: none;
    font-size: 1em;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: var(--contrast);
    min-height: 0;
}
/* ---- On-page "Added to cart" confirmation toast -------------------- */
/* Shown after the Quick View auto-closes on a successful add. Deliberately
   a light, self-dismissing toast; distinct from the centred
   .woocommerce-message modal used on single product pages. Bottom-centre so
   it reads the same in LTR and RTL. */
.mm-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 100000; /* above the modal shell (99999) in case of overlap */
    display: flex;
    flex-direction: row;
    align-content: center;
    align-items: center;
    justify-content: center;
    gap: .5em;
	text-align: center;
	max-width: calc(100vw - 32px);
	width: 100%;
	padding: 12px 18px;
	font-size: 18px;
	font-weight: 500;
	line-height: 1.2;
	color: #fff;
	background: var(--contrast-2); /* same success green as .mm-qv-feedback.is-success */
	border-radius: 6px;
	box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
	opacity: 0;
	transform: translateX(-50%) translateY(12px);
	transition: opacity .25s ease, transform .25s ease;
	pointer-events: none;
}

@media (min-width: 768px) {
	.mm-toast {
		width: 60%;
		max-width: 500px;
	}
}

.mm-toast.is-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.mm-toast__icon {
	display: inline-flex;
	line-height: 0;
}

@media (prefers-reduced-motion: reduce) {
	.mm-toast {
		transition: opacity .01ms;
		transform: translateX(-50%);
	}
	.mm-toast.is-visible {
		transform: translateX(-50%);
	}
}

/* ---------------------------------------------------------------------------
   Added-to-cart confirmation (Quick View / Buy Now) — centered card with the
   animated tick, matching the phone-verification success tick. Auto-closes
   after ~5s; also has a manual close. Brand palette only.
--------------------------------------------------------------------------- */
.mm-atc-confirm {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity .25s ease;
}
.mm-atc-confirm.is-visible { opacity: 1; }
.mm-atc-confirm__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
}
.mm-atc-confirm__box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 360px;
    background: var(--base);
    border-radius: 12px;
    padding: 34px 24px 28px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
    transform: translateY(10px) scale(.98);
    transition: transform .25s ease;
}
.mm-atc-confirm.is-visible .mm-atc-confirm__box { transform: none; }
.mm-atc-confirm__close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: 0;
    font-size: 26px;
    line-height: 1;
    color: var(--mm-muted);
    cursor: pointer;
}
.mm-atc-confirm__check {
    color: var(--accent);
    width: 88px;
    height: 88px;
    margin: 0 auto 16px;
}
.mm-atc-confirm__check svg { display: block; }
.mm-atc-confirm__check-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: mm-atc-draw-circle 500ms 100ms ease-out forwards;
}
.mm-atc-confirm__check-mark {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: mm-atc-draw-mark 400ms 600ms ease-out forwards;
}
.mm-atc-confirm__text {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
}
@keyframes mm-atc-draw-circle { to { stroke-dashoffset: 0; } }
@keyframes mm-atc-draw-mark   { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
    .mm-atc-confirm,
    .mm-atc-confirm__box,
    .mm-atc-confirm__check-circle,
    .mm-atc-confirm__check-mark { animation: none !important; transition: none !important; }
    .mm-atc-confirm__check-circle { stroke-dashoffset: 0; }
    .mm-atc-confirm__check-mark   { stroke-dashoffset: 0; }
}
