/*!
 * Storzen — Floating Cart
 * User-tunable values (bg, icon color) come from inline CSS variables.
 */

/* ════════════════════════════════════════════════════════════════════════
 * Container & positioning
 * ════════════════════════════════════════════════════════════════════════ */
.storzen-fc {
	position: fixed;
	z-index: 9990; /* High but below WP admin bar + most modals */
	pointer-events: none; /* The container itself is invisible; only the button + drawer accept clicks */
}
.storzen-fc > * { pointer-events: auto; }

.storzen-fc--bottom-right { bottom: 24px; right: 24px; }
.storzen-fc--bottom-left  { bottom: 24px; left:  24px; }
.storzen-fc--middle-right { top: 50%; right: 24px; transform: translateY(-50%); }
.storzen-fc--middle-left  { top: 50%; left:  24px; transform: translateY(-50%); }

/* Device toggles */
@media (max-width: 768px) {
	.storzen-fc--hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
	.storzen-fc--hide-desktop { display: none !important; }
}

/* Hide-when-empty (cart count is 0) */
.storzen-fc.storzen-fc--empty .storzen-fc__btn {
	opacity: 0;
	transform: scale(.8);
	pointer-events: none;
}

/* ════════════════════════════════════════════════════════════════════════
 * The button itself
 * ════════════════════════════════════════════════════════════════════════ */
.storzen-fc__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 56px;
	min-height: 56px;
	padding: 0 14px;
	border: 0;
	border-radius: 999px;
	background: var(--storzen-fc-bg, #FF3636);
	color: var(--storzen-fc-icon, #fff);
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	text-decoration: none;
	transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .2px;
	-webkit-tap-highlight-color: transparent;
}
.storzen-fc__btn:hover {
	transform: scale(1.06);
	box-shadow: 0 8px 26px rgba(0, 0, 0, .25);
}
.storzen-fc__btn:focus-visible {
	outline: 3px solid var(--storzen-fc-bg, #FF3636);
	outline-offset: 3px;
}
.storzen-fc__btn:active { transform: scale(.97); }

/* Icon — sizes itself to button via SVG width */
.storzen-fc__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	color: var(--storzen-fc-icon, #fff);
}
.storzen-fc__icon svg { width: 100%; height: 100%; }

/* Cart count badge */
.storzen-fc__count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
	pointer-events: none;
	transition: transform .2s ease;
	font-variant-numeric: tabular-nums;
}
.storzen-fc__count[data-empty="1"] {
	display: none;
}

/* Optional total label inside button (only when icon-only would be lonely) */
.storzen-fc__total {
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	color: var(--storzen-fc-icon, #fff);
}
.storzen-fc__total[data-empty="1"] {
	opacity: .65;
}
.storzen-fc__total .amount {
	color: inherit;
}

/* The button needs position:relative for the absolute badge */
.storzen-fc__btn { position: relative; }

/* ════════════════════════════════════════════════════════════════════════
 * Animations on add-to-cart
 * ════════════════════════════════════════════════════════════════════════ */
@keyframes storzen-fc-bounce {
	0%, 100% { transform: scale(1); }
	30%      { transform: scale(1.18); }
	60%      { transform: scale(.92); }
}
@keyframes storzen-fc-shake {
	0%, 100%   { transform: translateX(0); }
	20%, 60%   { transform: translateX(-4px); }
	40%, 80%   { transform: translateX(4px); }
}
@keyframes storzen-fc-pulse {
	0%   { box-shadow: 0 6px 20px rgba(0, 0, 0, .18), 0 0 0 0 rgba(124, 58, 237, .55); }
	70%  { box-shadow: 0 6px 20px rgba(0, 0, 0, .18), 0 0 0 14px rgba(124, 58, 237, 0); }
	100% { box-shadow: 0 6px 20px rgba(0, 0, 0, .18), 0 0 0 0 rgba(124, 58, 237, 0); }
}
.storzen-fc--anim-bounce.is-added .storzen-fc__btn { animation: storzen-fc-bounce .55s ease; }
.storzen-fc--anim-shake.is-added  .storzen-fc__btn { animation: storzen-fc-shake  .5s ease; }
.storzen-fc--anim-pulse.is-added  .storzen-fc__btn { animation: storzen-fc-pulse  .7s ease; }
.storzen-fc--anim-none.is-added   .storzen-fc__btn { animation: none; }

/* Count badge gets its own little kick on update */
.storzen-fc.is-added .storzen-fc__count {
	animation: storzen-fc-bounce .4s ease;
}

/* ════════════════════════════════════════════════════════════════════════
 * Mini cart drawer
 * ════════════════════════════════════════════════════════════════════════ */
.storzen-fc__drawer {
	position: fixed;
	inset: 0;
	z-index: 9995;
	pointer-events: none;
	visibility: hidden;
}
.storzen-fc__drawer.is-open {
	pointer-events: auto;
	visibility: visible;
}

.storzen-fc__drawer-overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, .5);
	opacity: 0;
	transition: opacity .25s ease;
}
.storzen-fc__drawer.is-open .storzen-fc__drawer-overlay { opacity: 1; }

.storzen-fc__drawer-panel {
	position: absolute;
	top: 0;
	right: 0;
	width: 380px;
	max-width: 90vw;
	height: 100%;
	background: #fff;
	box-shadow: -8px 0 32px rgba(0, 0, 0, .15);
	transform: translateX(100%);
	transition: transform .3s cubic-bezier(.16, 1, .3, 1);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.storzen-fc__drawer.is-open .storzen-fc__drawer-panel {
	transform: translateX(0);
}

/* Bottom-LEFT / middle-LEFT positions → drawer slides from the left */
.storzen-fc--bottom-left .storzen-fc__drawer-panel,
.storzen-fc--middle-left .storzen-fc__drawer-panel {
	right: auto;
	left: 0;
	box-shadow: 8px 0 32px rgba(0, 0, 0, .15);
	transform: translateX(-100%);
}
.storzen-fc--bottom-left .storzen-fc__drawer.is-open .storzen-fc__drawer-panel,
.storzen-fc--middle-left .storzen-fc__drawer.is-open .storzen-fc__drawer-panel {
	transform: translateX(0);
}

.storzen-fc__drawer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	border-bottom: 1px solid #e5e7eb;
	flex-shrink: 0;
}
.storzen-fc__drawer-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: #111827;
}
.storzen-fc__drawer-close {
	background: transparent;
	border: 0;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	color: #6b7280;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s ease, color .15s ease;
}
.storzen-fc__drawer-close:hover  { background: #f3f4f6; color: #111827; }
.storzen-fc__drawer-close:focus-visible {
	outline: 2px solid var(--storzen-fc-bg, #FF3636);
	outline-offset: 2px;
}

.storzen-fc__drawer-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 20px 20px;
}

/* Override some WooCommerce mini-cart styles for a tighter drawer look */
.storzen-fc__drawer-body ul.woocommerce-mini-cart {
	padding: 0;
	margin: 0;
}
.storzen-fc__drawer-body ul.woocommerce-mini-cart li {
	padding: 12px 0;
	border-bottom: 1px solid #f3f4f6;
}
.storzen-fc__drawer-body .woocommerce-mini-cart__total {
	padding: 14px 0;
	border-top: 2px solid #111827;
	margin-top: 6px;
	font-size: 15px;
}
.storzen-fc__drawer-body .woocommerce-mini-cart__buttons {
	display: flex;
	gap: 8px;
	margin-top: 12px;
}
.storzen-fc__drawer-body .woocommerce-mini-cart__buttons .button {
	flex: 1;
	text-align: center;
}
.storzen-fc__drawer-body .woocommerce-mini-cart__buttons .checkout {
	background: var(--storzen-fc-bg, #FF3636);
	color: #fff;
}
.storzen-fc__drawer-body .woocommerce-mini-cart__empty-message {
	color: #6b7280;
	text-align: center;
	padding: 40px 12px;
	font-size: 14px;
}

/* ════════════════════════════════════════════════════════════════════════
 * Hover preview (compact popover)
 * ════════════════════════════════════════════════════════════════════════ */
.storzen-fc__preview {
	position: absolute;
	width: 320px;
	max-width: 90vw;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
	padding: 14px;
	opacity: 0;
	pointer-events: none;
	transform: translateY(8px);
	transition: opacity .2s ease, transform .2s ease;
	font-size: 13px;
}
.storzen-fc--bottom-right .storzen-fc__preview,
.storzen-fc--middle-right .storzen-fc__preview {
	bottom: calc(100% + 12px);
	right: 0;
}
.storzen-fc--bottom-left .storzen-fc__preview,
.storzen-fc--middle-left .storzen-fc__preview {
	bottom: calc(100% + 12px);
	left: 0;
}
.storzen-fc--reveal-preview:hover .storzen-fc__preview,
.storzen-fc--reveal-preview:focus-within .storzen-fc__preview,
.storzen-fc__preview.is-open {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
}

.storzen-fc__preview ul.woocommerce-mini-cart {
	max-height: 240px;
	overflow-y: auto;
	margin: 0 0 10px;
	padding: 0;
}

/* ════════════════════════════════════════════════════════════════════════
 * Mobile — drawer becomes full-screen
 * ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
	.storzen-fc--bottom-right { bottom: 16px; right: 16px; }
	.storzen-fc--bottom-left  { bottom: 16px; left:  16px; }
	.storzen-fc--middle-right { right: 16px; }
	.storzen-fc--middle-left  { left:  16px; }

	.storzen-fc__btn          { min-width: 52px; min-height: 52px; padding: 0 12px; }
	.storzen-fc__icon         { width: 22px; height: 22px; }
	.storzen-fc__total        { font-size: 13px; }

	.storzen-fc__drawer-panel { width: 100vw; max-width: 100vw; }
	.storzen-fc__preview      { width: calc(100vw - 32px); }
}

/* ════════════════════════════════════════════════════════════════════════
 * Body scroll lock when drawer is open (via JS-added body class)
 * ════════════════════════════════════════════════════════════════════════ */
body.storzen-fc-drawer-open {
	overflow: hidden;
}

/* ════════════════════════════════════════════════════════════════════════
 * Respect users who prefer reduced motion
 * ════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
	.storzen-fc__btn,
	.storzen-fc__count,
	.storzen-fc__drawer-overlay,
	.storzen-fc__drawer-panel,
	.storzen-fc__preview {
		transition: none !important;
		animation: none !important;
	}
}
