/**
 * Cart sidebar drawer + header cart icon
 * Theme colors: primary brown / cream accents
 *
 * @package skinfinity_2026
 */

/* —— Header cart icon —— */
.header-cart {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	flex-shrink: 0;
	line-height: 1;
	appearance: none;
	-webkit-appearance: none;
}

.header-cart__icon {
	display: flex;
	align-items: center;
	justify-content: center;
}

.header-cart__icon img {
	display: block;
	width: 22px;
	height: 22px;
}

.header-cart__count {
	position: absolute;
	top: 2px;
	right: 0;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--primary-color, #3d2415);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	pointer-events: none;
}

.header-cart--desktop {
	display: none;
	margin-left: 16px;
}

.header-mobile-actions {
	display: none;
	align-items: center;
	gap: 10px;
	margin-left: auto;
	flex-shrink: 0;
}

.header-cart--mobile {
	display: inline-flex;
}

@media (min-width: 992px) {
	.header-cart--desktop {
		display: inline-flex;
		vertical-align: middle;
	}

	.header-mobile-actions {
		display: none !important;
	}

	.main-menu .header-btn {
		display: flex;
		align-items: center;
		gap: 0;
	}
}

@media (max-width: 991.98px) {
	.header-cart--desktop {
		display: none !important;
	}

	.header-mobile-actions {
		display: flex;
	}

	.navbar .container {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
	}

	.navbar-toggle {
		position: relative;
		margin: 0;
	}
}

/* —— Overlay —— */
.sf-cart-overlay {
	position: fixed;
	inset: 0;
	z-index: 10080;
	background: rgba(61, 36, 21, 0.45);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sf-cart-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

.sf-cart-overlay[hidden] {
	display: none;
}

.sf-cart-overlay.is-open[hidden] {
	display: block;
}

/* —— Sidebar panel —— */
.sf-cart-sidebar {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 10090;
	display: flex;
	flex-direction: column;
	width: min(420px, 100%);
	height: 100%;
	height: 100vh;
	height: 100dvh;
	max-height: 100%;
	max-height: 100vh;
	max-height: 100dvh;
	padding:
		env(safe-area-inset-top, 0)
		env(safe-area-inset-right, 0)
		env(safe-area-inset-bottom, 0)
		0;
	box-sizing: border-box;
	background: var(--white-color, #fffaf3);
	box-shadow: -8px 0 32px rgba(61, 36, 21, 0.18);
	transform: translateX(105%);
	transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	visibility: hidden;
}

.sf-cart-sidebar.is-open {
	transform: translateX(0);
	visibility: visible;
}

.sf-cart-sidebar__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-shrink: 0;
	padding: 18px 20px;
	background: var(--primary-color, #3d2415);
	color: #fff;
}

.sf-cart-sidebar__title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.2;
	color: #fff;
}

.sf-cart-sidebar__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.sf-cart-sidebar__close:hover,
.sf-cart-sidebar__close:focus {
	background: rgba(255, 255, 255, 0.12);
	outline: none;
}

.sf-cart-sidebar__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 16px;
	-webkit-overflow-scrolling: touch;
}

.sf-cart-sidebar__empty {
	margin: 32px 8px;
	text-align: center;
	color: var(--text-color, #6b5344);
	font-size: 1rem;
}

/* —— Cart item card —— */
.sf-cart-item {
	display: grid;
	grid-template-columns: 72px 1fr auto;
	gap: 12px;
	align-items: start;
	padding: 14px;
	margin-bottom: 12px;
	border-radius: 12px;
	background: var(--accent-secondary-color, #f6e8d4);
}

.sf-cart-item__image {
	width: 72px;
	height: 72px;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

.sf-cart-item__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sf-cart-item__info {
	min-width: 0;
}

.sf-cart-item__name {
	display: block;
	margin: 0 0 4px;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--primary-color, #3d2415);
	text-decoration: none;
	word-break: break-word;
}

.sf-cart-item__name:hover {
	color: var(--accent-color, #b8956c);
}

.sf-cart-item__price {
	display: block;
	margin-bottom: 10px;
	font-size: 0.9rem;
	color: var(--text-color, #6b5344);
}

.sf-cart-item__qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--divider-color, #3d241524);
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}

.sf-cart-item__qty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--primary-color, #3d2415);
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	line-height: 1;
}

.sf-cart-item__qty-btn:hover:not(:disabled) {
	background: var(--secondary-color, #f0dcc0);
}

.sf-cart-item__qty-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.sf-cart-item__qty-val {
	min-width: 28px;
	padding: 0 2px;
	text-align: center;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--primary-color, #3d2415);
	border: none;
	background: transparent;
	-moz-appearance: textfield;
}

.sf-cart-item__qty-val::-webkit-outer-spin-button,
.sf-cart-item__qty-val::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.sf-cart-item__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: var(--secondary-color, #f0dcc0);
	color: var(--primary-color, #3d2415);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.sf-cart-item__remove:hover,
.sf-cart-item__remove:focus {
	background: var(--primary-color, #3d2415);
	color: #fff;
	outline: none;
}

.sf-cart-item__remove i,
.sf-cart-item__remove svg {
	font-size: 14px;
	pointer-events: none;
}

/* —— Footer summary —— */
.sf-cart-sidebar__footer {
	flex-shrink: 0;
	padding: 16px 16px 20px;
	border-top: 1px dashed var(--divider-color, #3d241524);
	background: var(--white-color, #fffaf3);
}

.sf-cart-sidebar__footer[hidden] {
	display: none;
}

.sf-cart-sidebar__summary {
	padding: 14px 16px;
	margin-bottom: 14px;
	border-radius: 12px;
	background: var(--accent-secondary-color, #f6e8d4);
}

.sf-cart-sidebar__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
	font-size: 0.95rem;
	color: var(--primary-color, #3d2415);
}

.sf-cart-sidebar__row:last-child {
	margin-bottom: 0;
}

.sf-cart-sidebar__row--saved {
	color: var(--accent-color, #b8956c);
	font-weight: 600;
}

.sf-cart-sidebar__row--shipping {
	color: var(--text-color, #6b5344);
}

.sf-cart-sidebar__row--shipping[hidden] {
	display: none;
}

.sf-cart-sidebar__row--total {
	padding-top: 10px;
	margin-top: 4px;
	border-top: 1px solid var(--divider-color, #3d241524);
	font-weight: 700;
	font-size: 1.05rem;
}

.sf-cart-sidebar__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.sf-cart-sidebar__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 12px 10px;
	border-radius: 10px;
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	word-break: break-word;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.sf-cart-sidebar__btn--secondary {
	border: 1px solid var(--primary-color, #3d2415);
	background: #fff;
	color: var(--primary-color, #3d2415);
}

.sf-cart-sidebar__btn--secondary:hover {
	background: var(--secondary-color, #f0dcc0);
	color: var(--primary-color, #3d2415);
}

.sf-cart-sidebar__btn--primary {
	border: 1px solid var(--primary-color, #3d2415);
	background: var(--primary-color, #3d2415);
	color: #fff;
}

.sf-cart-sidebar__btn--primary:hover {
	background: var(--brand-mid, #5c4033);
	border-color: var(--brand-mid, #5c4033);
	color: #fff;
}

body.sf-cart-open {
	overflow: hidden;
}

/* Hide Woo “added to cart” notice on product pages (belt & suspenders) */
.shop-details-page .woocommerce-message a.button.wc-forward,
.single-product .woocommerce-message a.button.wc-forward {
	display: none !important;
}

.shop-details-page .woocommerce-message:has(a.wc-forward),
.single-product .woocommerce-message:has(a.wc-forward) {
	display: none !important;
}

/* —— Responsive —— */

/* Large desktop */
@media (min-width: 1400px) {
	.sf-cart-sidebar {
		width: 460px;
	}
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
	.sf-cart-sidebar {
		width: 440px;
	}
}

/* Laptop / mid desktop: keep side drawer, slightly tighter */
@media (min-width: 992px) and (max-width: 1199.98px) {
	.sf-cart-sidebar {
		width: min(400px, 42vw);
	}

	.header-cart--desktop {
		width: 40px;
		height: 40px;
		margin-left: 10px;
	}

	.sf-cart-sidebar__btn {
		font-size: 0.8rem;
		padding: 11px 8px;
	}
}

/* Tablet & below: full-screen drawer */
@media (max-width: 991.98px) {
	.sf-cart-sidebar {
		width: 100%;
		max-width: 100%;
		left: 0;
		right: 0;
	}

	.header-cart--mobile {
		width: 42px;
		height: 42px;
	}

	.header-mobile-actions {
		gap: 8px;
	}

	.sf-cart-sidebar__body {
		padding: 14px 16px;
	}

	.sf-cart-sidebar__footer {
		padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
	}
}

/* Tablet portrait: stack CTAs when space is tight */
@media (max-width: 767.98px) {
	.sf-cart-sidebar__actions {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.sf-cart-sidebar__btn {
		padding: 13px 12px;
		font-size: 0.9rem;
	}

	.sf-cart-item {
		grid-template-columns: 68px 1fr auto;
		gap: 10px;
		padding: 12px;
	}

	.sf-cart-item__image {
		width: 68px;
		height: 68px;
	}

	.sf-cart-sidebar__title {
		font-size: 1.15rem;
	}
}

/* Phones */
@media (max-width: 575.98px) {
	.header-cart--mobile {
		width: 40px;
		height: 40px;
	}

	.header-cart__icon img {
		width: 20px;
		height: 20px;
	}

	.header-cart__count {
		min-width: 16px;
		height: 16px;
		font-size: 10px;
		line-height: 16px;
		top: 1px;
		right: -1px;
	}

	.sf-cart-sidebar__header {
		padding: 14px 14px 14px 16px;
	}

	.sf-cart-sidebar__title {
		font-size: 1.1rem;
	}

	.sf-cart-sidebar__close {
		width: 40px;
		height: 40px;
		font-size: 26px;
	}

	.sf-cart-sidebar__body {
		padding: 12px;
	}

	.sf-cart-item {
		grid-template-columns: 60px minmax(0, 1fr) 34px;
		padding: 10px;
		gap: 8px;
		margin-bottom: 10px;
		border-radius: 10px;
	}

	.sf-cart-item__image {
		width: 60px;
		height: 60px;
	}

	.sf-cart-item__name {
		font-size: 0.9rem;
	}

	.sf-cart-item__price {
		font-size: 0.85rem;
		margin-bottom: 8px;
	}

	.sf-cart-item__qty-btn {
		width: 30px;
		height: 30px;
	}

	.sf-cart-item__remove {
		width: 34px;
		height: 34px;
	}

	.sf-cart-sidebar__summary {
		padding: 12px 14px;
		margin-bottom: 12px;
	}

	.sf-cart-sidebar__row {
		font-size: 0.9rem;
	}

	.sf-cart-sidebar__row--total {
		font-size: 1rem;
	}

	.sf-cart-sidebar__footer {
		padding: 12px 12px calc(14px + env(safe-area-inset-bottom, 0px));
	}

	.sf-cart-sidebar__actions {
		grid-template-columns: 1fr;
	}

	.sf-cart-sidebar__btn {
		padding: 14px 12px;
		font-size: 0.9rem;
	}
}

/* Very small phones */
@media (max-width: 379.98px) {
	.sf-cart-item {
		grid-template-columns: 52px minmax(0, 1fr) 32px;
	}

	.sf-cart-item__image {
		width: 52px;
		height: 52px;
	}

	.sf-cart-item__name {
		font-size: 0.85rem;
	}

	.sf-cart-sidebar__btn {
		font-size: 0.85rem;
		padding: 12px 10px;
	}
}

/* Short / landscape viewports: keep footer usable */
@media (max-height: 560px) {
	.sf-cart-sidebar__header {
		padding-top: 12px;
		padding-bottom: 12px;
	}

	.sf-cart-sidebar__body {
		padding-top: 10px;
		padding-bottom: 10px;
	}

	.sf-cart-sidebar__footer {
		padding-top: 10px;
		padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	}

	.sf-cart-sidebar__summary {
		padding: 10px 12px;
		margin-bottom: 10px;
	}

	.sf-cart-item {
		padding: 10px;
		margin-bottom: 8px;
	}
}

/* Loading state */
.sf-cart-sidebar.is-loading .sf-cart-sidebar__body {
	opacity: 0.55;
	pointer-events: none;
}
