/**
 * Mr. Kleen Order System — Frontend Styles
 * Mobile-first, theme-agnostic (works alongside Hello Elementor / Elementor Pro)
 */

:root {
	--mkos-primary: #CC1111;
	--mkos-primary-dark: #8B0000;
	--mkos-dark: #111111;
	--mkos-gray: #666666;
	--mkos-light-gray: #f0f0f0;
	--mkos-border: #e2e2e2;
	--mkos-whatsapp: #25D366;
	--mkos-radius: 10px;
	--mkos-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

/* ---------------------------------------------------------------------
   GENERAL BUTTONS
--------------------------------------------------------------------- */
.mkos-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 20px;
	border-radius: var(--mkos-radius);
	border: none;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
	width: 100%;
}
.mkos-btn:active { transform: scale(0.98); }
.mkos-btn-primary { background: var(--mkos-primary); color: #fff; }
.mkos-btn-primary:hover { background: var(--mkos-primary-dark); }
.mkos-btn-outline { background: transparent; border: 1.5px solid var(--mkos-primary); color: var(--mkos-primary); }
.mkos-btn-whatsapp { background: var(--mkos-whatsapp); color: #fff; }
.mkos-btn-whatsapp:hover { background: #1ebc59; }
.mkos-btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ---------------------------------------------------------------------
   ADD TO CART BUTTON (used inside Elementor Loop Grid items)
--------------------------------------------------------------------- */
.mkos-add-to-cart {
	position: relative;
	overflow: hidden;
}
.mkos-add-to-cart.mkos-loading {
	pointer-events: none;
}
.mkos-add-to-cart.mkos-loading .mkos-btn-label { opacity: 0; }
.mkos-add-to-cart .mkos-spinner {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
}
.mkos-add-to-cart.mkos-loading .mkos-spinner { display: flex; }
.mkos-spinner::after {
	content: "";
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255,255,255,0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: mkos-spin 0.6s linear infinite;
}
@keyframes mkos-spin { to { transform: rotate(360deg); } }

.mkos-add-to-cart.mkos-success {
	background: #2e9e3f !important;
}

/* ---------------------------------------------------------------------
   QUANTITY STEPPER
--------------------------------------------------------------------- */
.mkos-qty-stepper {
	display: inline-flex !important;
	align-items: center !important;
	border: 1.5px solid var(--mkos-border) !important;
	border-radius: 8px !important;
	overflow: hidden !important;
	margin-top: 6px !important;
	width: fit-content;
}
.mkos-qty-stepper button {
	background: var(--mkos-light-gray) !important;
	border: none !important;
	width: 30px !important;
	height: 30px !important;
	min-width: 30px !important;
	padding: 0 !important;
	margin: 0 !important;
	font-size: 16px !important;
	font-weight: 600;
	cursor: pointer !important;
	line-height: 1 !important;
	box-shadow: none !important;
	color: var(--mkos-dark) !important;
	box-sizing: border-box;
}
.mkos-qty-stepper button:hover { background: #e0e0e0 !important; }
.mkos-qty-input {
	width: 38px !important;
	height: 30px !important;
	border: none !important;
	border-left: 1px solid var(--mkos-border) !important;
	border-right: 1px solid var(--mkos-border) !important;
	text-align: center !important;
	font-size: 14px !important;
	padding: 0 !important;
	margin: 0 !important;
	box-shadow: none !important;
	-moz-appearance: textfield;
}
.mkos-qty-input::-webkit-outer-spin-button,
.mkos-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------------------------------------------------------------------
   VARIATION OPTIONS (Phase 2 — e.g. 200ml / 400ml / 1L)
--------------------------------------------------------------------- */
.mkos-variations {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 10px 0;
}
.mkos-variation-option {
	padding: 7px 16px;
	border: 1.5px solid var(--mkos-border);
	border-radius: 999px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	background: #fff;
	color: var(--mkos-dark);
	transition: all .15s ease;
}
.mkos-variation-option:hover { border-color: var(--mkos-primary); }
.mkos-variation-option.mkos-selected {
	background: var(--mkos-primary);
	border-color: var(--mkos-primary);
	color: #fff;
}
.mkos-variation-option.mkos-unavailable {
	opacity: 0.4;
	cursor: not-allowed;
	text-decoration: line-through;
}
.mkos-variation-error {
	color: var(--mkos-primary);
	font-size: 12px;
	margin-top: 4px;
	display: none;
}
.mkos-variation-error.mkos-show { display: block; }

/* ---------------------------------------------------------------------
   FLOATING CART ICON
--------------------------------------------------------------------- */
.mkos-floating-cart-icon {
	position: fixed;
	bottom: 24px;
	z-index: 9998;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: var(--mkos-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--mkos-shadow);
	cursor: pointer;
	transition: transform .2s ease;
}
.mkos-floating-cart-icon:hover { transform: scale(1.06); }
.mkos-floating-cart-icon.mkos-bump { animation: mkos-bump-anim .4s ease; }
@keyframes mkos-bump-anim {
	0% { transform: scale(1); }
	40% { transform: scale(1.18); }
	100% { transform: scale(1); }
}
.mkos-floating-cart-icon.mkos-pos-right { right: 20px; }
.mkos-floating-cart-icon.mkos-pos-left { left: 20px; }
.mkos-cart-count {
	position: absolute;
	top: -4px;
	right: -4px;
	background: var(--mkos-dark);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	min-width: 20px;
	height: 20px;
	border-radius: 999px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
}
.mkos-cart-count.mkos-zero { display: none; }

/* ---------------------------------------------------------------------
   SLIDE-OUT CART PANEL
--------------------------------------------------------------------- */
.mkos-cart-overlay,
.mkos-popup-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.45);
	z-index: 9999;
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease;
}
.mkos-cart-overlay.mkos-active,
.mkos-popup-overlay.mkos-active {
	opacity: 1;
	visibility: visible;
}

.mkos-cart-panel {
	position: fixed;
	top: 0;
	bottom: 0;
	width: min(400px, 92vw);
	background: #fff;
	z-index: 10000;
	box-shadow: var(--mkos-shadow);
	display: flex;
	flex-direction: column;
	transition: transform .3s ease;
}
.mkos-cart-panel.mkos-pos-right { right: 0; transform: translateX(100%); }
.mkos-cart-panel.mkos-pos-left { left: 0; transform: translateX(-100%); }
.mkos-cart-panel.mkos-open { transform: translateX(0); }

.mkos-cart-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid var(--mkos-border);
}
.mkos-cart-panel__header h3 { margin: 0; font-size: 18px; }
.mkos-cart-panel__close,
.mkos-checkout-popup__close {
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: var(--mkos-gray);
}
.mkos-cart-panel__body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 20px;
}

.mkos-cart-empty { text-align: center; padding: 40px 10px; color: var(--mkos-gray); }
.mkos-cart-empty .mkos-btn { margin-top: 14px; width: auto; padding: 10px 22px; }

.mkos-cart-item {
	display: flex;
	gap: 12px;
	padding: 14px 0;
	border-bottom: 1px solid var(--mkos-border);
	position: relative;
}
.mkos-cart-item__image img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.mkos-cart-item__details { flex: 1; }
.mkos-cart-item__name { font-size: 14px; font-weight: 600; margin-bottom: 4px; padding-right: 20px; }
.mkos-cart-item__price { font-size: 13px; color: var(--mkos-primary); font-weight: 600; margin-bottom: 4px; }
.mkos-cart-item__remove {
	position: absolute;
	top: 14px;
	right: 0;
	background: none;
	border: none;
	font-size: 20px;
	color: var(--mkos-gray);
	cursor: pointer;
}

.mkos-cart-summary {
	border-top: 1px solid var(--mkos-border);
	padding: 16px 20px;
}
.mkos-cart-subtotal {
	display: flex;
	justify-content: space-between;
	font-size: 15px;
	margin-bottom: 12px;
}

/* ---------------------------------------------------------------------
   CHECKOUT POPUP (Phase 4)
--------------------------------------------------------------------- */
.mkos-checkout-popup {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -48%) scale(0.96);
	width: min(460px, 92vw);
	max-height: 88vh;
	overflow-y: auto;
	background: #fff;
	border-radius: 16px;
	z-index: 10001;
	box-shadow: var(--mkos-shadow);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, transform .25s ease;
}
.mkos-checkout-popup.mkos-open {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, -50%) scale(1);
}
.mkos-checkout-popup__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 24px;
	border-bottom: 1px solid var(--mkos-border);
	position: sticky;
	top: 0;
	background: #fff;
}
.mkos-checkout-popup__header h3 { margin: 0; font-size: 18px; }
.mkos-checkout-popup__body { padding: 20px 24px 28px; }

.mkos-checkout-form .mkos-field { margin-bottom: 16px; }
.mkos-checkout-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--mkos-dark); }
.mkos-required { color: var(--mkos-primary); }
.mkos-checkout-form input[type="text"],
.mkos-checkout-form input[type="tel"],
.mkos-checkout-form textarea {
	width: 100%;
	padding: 11px 13px;
	border: 1.5px solid var(--mkos-border);
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
}
.mkos-checkout-form input:focus,
.mkos-checkout-form textarea:focus {
	outline: none;
	border-color: var(--mkos-primary);
}
.mkos-checkout-form input.mkos-error,
.mkos-checkout-form textarea.mkos-error {
	border-color: var(--mkos-primary);
}
.mkos-field-error {
	display: block;
	color: var(--mkos-primary);
	font-size: 12px;
	margin-top: 4px;
	min-height: 14px;
}

.mkos-checkout-order-summary {
	background: var(--mkos-light-gray);
	border-radius: 10px;
	padding: 14px 16px;
	margin: 18px 0;
}
.mkos-order-summary-list { list-style: none; margin: 0 0 10px; padding: 0; }
.mkos-order-summary-list li {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	padding: 4px 0;
}
.mkos-summary-total {
	display: flex;
	justify-content: space-between;
	font-weight: 700;
	font-size: 14px;
	padding-top: 8px;
	border-top: 1px solid #ddd;
}
.mkos-empty-summary { font-size: 13px; color: var(--mkos-gray); margin: 0; }

.mkos-checkout-disclaimer {
	font-size: 12px;
	color: var(--mkos-gray);
	text-align: center;
	margin-top: 12px;
	line-height: 1.5;
}

/* Toast notification */
.mkos-toast {
	position: fixed;
	bottom: 100px;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	background: var(--mkos-dark);
	color: #fff;
	padding: 12px 20px;
	border-radius: 999px;
	font-size: 14px;
	z-index: 10002;
	opacity: 0;
	transition: opacity .25s ease, transform .25s ease;
	pointer-events: none;
	white-space: nowrap;
}
.mkos-toast.mkos-show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}
.mkos-toast.mkos-toast-error { background: var(--mkos-primary); }

/* ---------------------------------------------------------------------
   RESPONSIVE
--------------------------------------------------------------------- */
@media (max-width: 480px) {
	.mkos-floating-cart-icon { width: 52px; height: 52px; bottom: 16px; }
	.mkos-checkout-popup { width: 94vw; }
}

/* ---------------------------------------------------------------------
   v2 ADDITIONS — product grid, swatches vs radio fallback, cart item
   variation label, admin toggle switch
--------------------------------------------------------------------- */
.mkos-product-grid {
	display: grid;
	grid-template-columns: repeat(var(--mkos-columns, 4), 1fr);
	gap: 20px;
}
@media (max-width: 900px) { .mkos-product-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .mkos-product-grid { grid-template-columns: 1fr; } }

.mkos-product {
	border: 1px solid var(--mkos-border);
	border-radius: 14px;
	padding: 16px;
	background: #fff;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.mkos-product__image img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 10px; }
.mkos-product__title { font-size: 15px; font-weight: 600; margin: 4px 0 0; }
.mkos-product__excerpt { font-size: 12.5px; color: var(--mkos-gray); margin: 0; line-height: 1.5; }
.mkos-product-price { font-size: 16px; font-weight: 700; color: var(--mkos-primary); }

.mkos-variations.mkos-uses-radio .mkos-variation-option { border-radius: 8px; }

.mkos-cart-item__variation { font-size: 11.5px; color: var(--mkos-gray); margin-bottom: 4px; }

.mkos-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.mkos-toggle input[type="checkbox"] { width: 16px; height: 16px; }

.mkos-inline-cart { max-width: 480px; }

/* Payment method select + bank details box */
.mkos-checkout-form select {
	width: 100%;
	padding: 11px 13px;
	border: 1.5px solid var(--mkos-border);
	border-radius: 8px;
	font-size: 14px;
	font-family: inherit;
	background: #fff;
}
.mkos-bank-details {
	background: #FFF8E6;
	border: 1px solid #F0D98C;
	border-radius: 10px;
	padding: 14px 16px;
	margin: -4px 0 16px;
	font-size: 13px;
}
.mkos-bank-details strong { display: block; margin-bottom: 8px; font-size: 13px; }
.mkos-bank-row { display: flex; justify-content: space-between; padding: 3px 0; }
.mkos-bank-note { margin: 10px 0 0; font-size: 12px; color: #8a6d1d; }
