/**
 * DailyXeDien UI Components CSS
 *
 * Mini-cart off-canvas drawer, mobile bottom nav, and category slide-up panel.
 * Enqueued alongside dxd-ui.js (no build step, browser-cacheable).
 */

/* ==========================================================================
   Mini-Cart Off-Canvas Drawer (Taodo/SPL style)
   ========================================================================== */

/* Overlay */
.dxd-cart-overlay {
	position: fixed;
	inset: 0;
	z-index: 99;
	background: rgba(15, 23, 42, 0.55);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s;
}

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

/* Drawer */
.dxd-cart-drawer {
	position: fixed;
	top: 0;
	right: 0;
	z-index: 100;
	width: 380px;
	max-width: 90vw;
	height: 100dvh;
	background: #fff;
	box-shadow: -8px 0 30px rgba(15, 23, 42, 0.12);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.dxd-cart-drawer.is-open {
	transform: translateX(0);
}

/* Drawer Header */
.dxd-cart-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid #f1f5f9;
	flex-shrink: 0;
}

.dxd-cart-drawer__eyebrow {
	font-size: 0.6875rem;
	font-weight: 500;
	color: #94a3b8;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	display: block;
	margin-bottom: 0.125rem;
}

.dxd-cart-drawer__header h2 {
	font-size: 1.125rem;
	font-weight: 800;
	color: #1e293b;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.dxd-cart-drawer__count {
	background: #10b981;
	color: #fff;
	font-size: 0.625rem;
	font-weight: 700;
	padding: 0.125rem 0.5rem;
	border-radius: 9999px;
	line-height: 1.4;
}

.dxd-cart-drawer__close {
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	background: #f1f5f9;
	border: none;
	color: #64748b;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
}

.dxd-cart-drawer__close:hover {
	background: #e2e8f0;
	color: #1e293b;
}

/* Cart content area */
.mini-cart-offcanvas__content {
	flex: 1;
	overflow-y: auto;
	padding: 0 1.5rem;
	min-height: 0;
}

/* Free shipping progress */
.mini-cart-offcanvas__shipping {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 0.5rem;
	padding: 0.75rem;
	margin: 1rem 0 0.75rem;
}

.mini-cart-offcanvas__shipping p {
	font-size: 0.75rem;
	color: #166534;
	margin: 0 0 0.5rem;
}

.mini-cart-progress {
	height: 4px;
	background: #dcfce7;
	border-radius: 9999px;
	overflow: hidden;
}

.mini-cart-progress span {
	display: block;
	height: 100%;
	background: linear-gradient(90deg, #10b981, #059669);
	border-radius: 9999px;
	transition: width 0.5s ease;
}

/* WC mini-cart item styling */
.mini-cart-offcanvas__items .woocommerce-mini-cart {
	list-style: none;
	padding: 0;
	margin: 0;
}

.mini-cart-offcanvas__items .woocommerce-mini-cart-item {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.875rem 0;
	border-bottom: 1px solid #f1f5f9;
}

.mini-cart-offcanvas__items .woocommerce-mini-cart-item:last-child {
	border-bottom: none;
}

.mini-cart-offcanvas__items .woocommerce-mini-cart-item img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 0.5rem;
	border: 1px solid #e2e8f0;
	flex-shrink: 0;
}

.mini-cart-offcanvas__items .woocommerce-mini-cart-item .remove {
	color: #ef4444 !important;
	font-size: 1.125rem;
	line-height: 1;
	text-decoration: none;
	margin-left: auto;
	flex-shrink: 0;
	opacity: 0.6;
	transition: opacity 0.2s;
}

.mini-cart-offcanvas__items .woocommerce-mini-cart-item .remove:hover {
	opacity: 1;
}

/* Quantity controls */
.mini-cart-quantity {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.mini-cart-quantity__price {
	font-size: 0.75rem;
	color: #64748b;
}

.mini-cart-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid #e2e8f0;
	border-radius: 0.375rem;
	overflow: hidden;
}

.mini-cart-qty button {
	width: 1.75rem;
	height: 1.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f8fafc;
	border: none;
	color: #64748b;
	cursor: pointer;
	font-size: 0.875rem;
	font-weight: 600;
	transition: background 0.15s;
}

.mini-cart-qty button:hover {
	background: #e2e8f0;
}

.mini-cart-qty input {
	width: 2rem;
	height: 1.75rem;
	text-align: center;
	border: none;
	border-left: 1px solid #e2e8f0;
	border-right: 1px solid #e2e8f0;
	font-size: 0.75rem;
	font-weight: 600;
	color: #1e293b;
	background: #fff;
	-moz-appearance: textfield;
}

.mini-cart-qty input::-webkit-outer-spin-button,
.mini-cart-qty input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Empty cart */
.mini-cart-offcanvas__items .woocommerce-mini-cart__empty-message {
	text-align: center;
	padding: 3rem 0;
	font-size: 0.8125rem;
	color: #94a3b8;
}

/* Drawer Footer */
.dxd-cart-drawer__footer {
	padding: 1rem 1.5rem 1.25rem;
	border-top: 1px solid #f1f5f9;
	flex-shrink: 0;
	background: #fafbfc;
}

.dxd-cart-drawer__total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.875rem;
	margin-bottom: 0.75rem;
}

.dxd-cart-drawer__total span {
	color: #64748b;
	font-weight: 500;
}

.dxd-cart-drawer__total strong {
	font-size: 1.125rem;
	font-weight: 800;
	color: #dc2626;
}

.dxd-cart-drawer__actions {
	display: flex;
	gap: 0.5rem;
}

.dxd-cart-drawer__btn {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.375rem;
	padding: 0.75rem 1rem;
	font-size: 0.75rem;
	font-weight: 700;
	border-radius: 0.625rem;
	text-decoration: none;
	transition: all 0.2s;
	text-align: center;
	white-space: nowrap;
}

.dxd-cart-drawer__btn--outline {
	background: #fff;
	color: #475569;
	border: 1.5px solid #e2e8f0;
}

.dxd-cart-drawer__btn--outline:hover {
	border-color: #94a3b8;
	color: #1e293b;
}

.dxd-cart-drawer__btn--primary {
	background: #1e73be;
	color: #fff;
	border: 1.5px solid #1e73be;
	box-shadow: 0 2px 8px rgba(30, 115, 190, 0.25);
}

.dxd-cart-drawer__btn--primary:hover {
	background: #1861a0;
	border-color: #1861a0;
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(30, 115, 190, 0.3);
}

/* ==========================================================================
   Mobile Bottom Navigation
   ========================================================================== */

#mobile-bottom-nav {
	display: none;
}

@media (max-width: 767px) {
	#mobile-bottom-nav {
		display: flex;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		z-index: 90;
		background: #fff;
		border-top: 1px solid #e3e8ef;
		box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
		padding: 0.25rem 0;
		padding-bottom: calc(0.25rem + env(safe-area-inset-bottom, 0px));
	}

	#mobile-bottom-nav a,
	#mobile-bottom-nav button {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		flex: 1;
		gap: 0.15rem;
		padding: 0.35rem 0;
		color: #637083;
		text-decoration: none;
		font-size: 0.625rem;
		font-weight: 600;
		transition: color 0.2s;
		-webkit-tap-highlight-color: transparent;
		position: relative;
		background: none;
		border: none;
		cursor: pointer;
		font-family: inherit;
	}

	#mobile-bottom-nav a svg,
	#mobile-bottom-nav button svg {
		width: 1.15rem;
		height: 1.15rem;
	}

	#mobile-bottom-nav a.active,
	#mobile-bottom-nav button.active {
		color: #0758b7;
	}

	#mobile-bottom-nav a.active::before,
	#mobile-bottom-nav button.active::before {
		content: '';
		position: absolute;
		top: 0;
		left: 25%;
		right: 25%;
		height: 2px;
		background: #0758b7;
		border-radius: 0 0 2px 2px;
	}

	/* Hotline special color */
	#mobile-bottom-nav a.nav-hotline {
		color: #dc2626;
	}

	/* Zalo special color */
	#mobile-bottom-nav a.nav-zalo {
		color: #0068ff;
	}

	/* Cart badge on bottom nav */
	.dxd-bottom-nav__badge {
		position: absolute;
		top: 0;
		right: 50%;
		transform: translateX(70%);
		background: #ef4444;
		color: #fff;
		font-size: 0.5625rem;
		font-weight: 700;
		min-width: 1rem;
		height: 1rem;
		padding: 0 0.25rem;
		border-radius: 9999px;
		display: flex;
		align-items: center;
		justify-content: center;
		line-height: 1;
	}

	/* Hide floating buttons on mobile — bottom nav replaces them */
	#floating-btns {
		display: none !important;
	}

	/* Adjust back-to-top above bottom nav */
	#back-to-top {
		bottom: 4.5rem !important;
	}

	/* Add safe bottom padding so content isn't hidden behind nav */
	body {
		padding-bottom: 3.75rem;
	}
}

/* ==========================================================================
   Category Slide-Up Panel
   ========================================================================== */

#category-panel-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	z-index: 95;
	opacity: 0;
	transition: opacity 0.25s ease;
}

#category-panel-overlay.open {
	opacity: 1;
}

#category-panel {
	display: none;
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 96;
	background: #fff;
	border-radius: 1rem 1rem 0 0;
	box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.12);
	padding: 0;
	transform: translateY(100%);
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	max-height: 70vh;
	overflow-y: auto;
}

#category-panel.open {
	transform: translateY(0);
}

#category-panel .cat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem 0.75rem;
	border-bottom: 1px solid #e3e8ef;
	position: sticky;
	top: 0;
	background: #fff;
	z-index: 1;
}

#category-panel .cat-header h3 {
	font-size: 0.875rem;
	font-weight: 800;
	color: #172033;
	margin: 0;
}

#category-panel .cat-header button {
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: #f1f5f9;
	border: none;
	color: #64748b;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s;
}

#category-panel .cat-header button:hover {
	background: #e2e8f0;
}

#category-panel .cat-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.5rem;
	padding: 1rem 1.25rem 1.5rem;
}

#category-panel .cat-grid a {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	padding: 0.875rem 0.5rem;
	border-radius: 0.5rem;
	border: 1px solid #e3e8ef;
	text-decoration: none;
	transition: all 0.2s;
	-webkit-tap-highlight-color: transparent;
}

#category-panel .cat-grid a:active {
	transform: scale(0.96);
	background: #f0f5ff;
	border-color: #0758b7;
}

#category-panel .cat-grid a .cat-icon {
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 0.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

#category-panel .cat-grid a span {
	font-size: 0.6875rem;
	font-weight: 700;
	color: #172033;
	text-align: center;
	line-height: 1.2;
}
