/**
 * Mini Cart — common widget CSS.
 *
 * Structural layout only (toggle, badge, dropdown vs. drawer positioning, panel
 * scaffolding, free-shipping bar, overlay + animations). Colours / typography are
 * driven by Elementor controls and the per-style sheets.
 *
 * @package captain-widgets-kit
 * @since   1.3.0
 */

.captwiki-mini-cart {
	display: flex;
	position: relative;
	align-items: center;
}

/* ---------------------------------------------------------------- Toggle */
.captwiki-mini-cart__toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	position: relative;
	cursor: pointer;
	text-decoration: none;
	line-height: 1;
	color: inherit;
	transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.captwiki-mini-cart__toggle:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.captwiki-mini-cart__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	line-height: 1;
}

.captwiki-mini-cart__icon svg {
	width: 24px;
	height: 24px;
	display: block;
}

.captwiki-mini-cart__label {
	font-weight: 600;
}

.captwiki-mini-cart__amount {
	font-weight: 600;
	white-space: nowrap;
}

/* ----------------------------------------------------------- Count badge */
.captwiki-mini-cart__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: #e02b2b;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

/* Hide the badge when the cart is empty (opt-in via wrapper class). */
.captwiki-mini-cart--hide-empty .captwiki-mini-cart__count.is-empty {
	display: none;
}

/* ----------------------------------------------------------- Overlay */
.captwiki-mini-cart__overlay {
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, 0.5 );
	opacity: 0;
	visibility: hidden;
	z-index: 99998;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* ----------------------------------------------------------- Panel base */
.captwiki-mini-cart__panel {
	background: #fff;
	color: #1f2937;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.18 );
	z-index: 99999;
}

.captwiki-mini-cart__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.captwiki-mini-cart__title {
	font-size: 18px;
	font-weight: 700;
}

.captwiki-mini-cart__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.captwiki-mini-cart__close:hover {
	background: rgba( 0, 0, 0, 0.07 );
}

.captwiki-mini-cart__body {
	display: flex;
	flex-direction: column;
}

/* ----------------------------------------------- Dropdown layout */
.captwiki-mini-cart[data-layout="dropdown"] {
	position: relative;
}

.captwiki-mini-cart[data-layout="dropdown"] .captwiki-mini-cart__overlay {
	display: none;
}

.captwiki-mini-cart[data-layout="dropdown"] .captwiki-mini-cart__panel {
	position: absolute;
	top: calc( 100% + 12px );
	right: 0;
	width: 360px;
	max-width: 92vw;
	padding: 20px;
	border-radius: 12px;
	opacity: 0;
	visibility: hidden;
	transform: translateY( -10px );
	transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.captwiki-mini-cart[data-layout="dropdown"].is-open .captwiki-mini-cart__panel {
	opacity: 1;
	visibility: visible;
	transform: translateY( 0 );
}

/* Little caret on the dropdown. */
.captwiki-mini-cart[data-layout="dropdown"] .captwiki-mini-cart__panel::before {
	content: "";
	position: absolute;
	top: -7px;
	right: 24px;
	width: 14px;
	height: 14px;
	background: inherit;
	transform: rotate( 45deg );
	box-shadow: -2px -2px 6px rgba( 0, 0, 0, 0.05 );
}

/* ----------------------------------------------- Off-canvas drawer layout */
.captwiki-mini-cart[data-layout^="offcanvas"] .captwiki-mini-cart__panel {
	position: fixed;
	top: 0;
	bottom: 0;
	width: 400px;
	max-width: 90vw;
	height: 100%;
	padding: 26px;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	transition: transform 0.35s cubic-bezier( 0.22, 1, 0.36, 1 );
}

.captwiki-mini-cart[data-layout="offcanvas-right"] .captwiki-mini-cart__panel {
	right: 0;
	transform: translateX( 100% );
}

.captwiki-mini-cart[data-layout="offcanvas-left"] .captwiki-mini-cart__panel {
	left: 0;
	transform: translateX( -100% );
}

.captwiki-mini-cart[data-layout^="offcanvas"].is-open .captwiki-mini-cart__panel {
	transform: translateX( 0 );
}

.captwiki-mini-cart[data-layout^="offcanvas"].is-open .captwiki-mini-cart__overlay {
	opacity: 1;
	visibility: visible;
}

.captwiki-mini-cart[data-layout^="offcanvas"] .captwiki-mini-cart__body {
	flex: 1;
}

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

/* ----------------------------------------------- Free shipping bar */
.captwiki-mini-cart__fs {
	margin-bottom: 16px;
}

.captwiki-mini-cart__fs-msg {
	margin: 0 0 8px;
	font-size: 13px;
	line-height: 1.4;
}

.captwiki-mini-cart__fs-track {
	position: relative;
	width: 100%;
	height: 8px;
	border-radius: 999px;
	background: #e5e7eb;
	overflow: hidden;
}

.captwiki-mini-cart__fs-fill {
	position: absolute;
	inset: 0 auto 0 0;
	height: 100%;
	width: 0;
	border-radius: 999px;
	background: #16a34a;
	transition: width 0.4s ease;
}

/* ----------------------------------------------- WooCommerce mini cart list */
.captwiki-mini-cart__panel .woocommerce-mini-cart {
	list-style: none;
	margin: 0;
	padding: 0;
}

.captwiki-mini-cart__panel ul.woocommerce-mini-cart li {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 12px;
	padding: 14px 0 14px 64px;
	border-bottom: 1px solid #eef0f2;
}

.captwiki-mini-cart__panel ul.woocommerce-mini-cart li > a:not(.remove) {
	font-weight: 600;
	text-decoration: none;
	flex: 1;
}

.captwiki-mini-cart__panel ul.woocommerce-mini-cart li img {
	position: absolute;
	left: 0;
	top: 14px;
	width: 50px;
	height: auto;
	border-radius: 6px;
}

.captwiki-mini-cart__panel ul.woocommerce-mini-cart li .quantity {
	width: 100%;
	font-size: 13px;
	opacity: 0.85;
}

.captwiki-mini-cart__panel a.remove {
	position: absolute;
	right: 0;
	top: 14px;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	font-size: 16px !important;
	line-height: 18px;
	text-align: center;
	color: #9ca3af;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.captwiki-mini-cart__panel a.remove:hover {
	background: #fdecec;
	color: #e02b2b !important;
}

.captwiki-mini-cart__panel .woocommerce-mini-cart__total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 16px 0;
	padding-top: 14px;
	border-top: 2px solid #eef0f2;
	font-size: 16px;
}

.captwiki-mini-cart__panel .woocommerce-mini-cart__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
}

.captwiki-mini-cart__panel .woocommerce-mini-cart__buttons a.button {
	flex: 1;
	text-align: center;
	margin: 0;
}

.captwiki-mini-cart__panel .woocommerce-mini-cart__empty-message {
	margin: 24px 0;
	text-align: center;
	opacity: 0.75;
}

/* ----------------------------------------------- Editor notice */
.captwiki-mini-cart--notice {
	display: block;
	padding: 16px 18px;
	border: 1px dashed #c3c4c7;
	border-radius: 6px;
	background: #f6f7f7;
	color: #50575e;
	text-align: center;
	font-size: 13px;
}

.captwiki-mini-cart--notice p {
	margin: 0;
}

@media ( max-width: 480px ) {
	.captwiki-mini-cart[data-layout^="offcanvas"] .captwiki-mini-cart__panel {
		width: 100%;
		max-width: 100%;
	}
}
