/* ==========================================================================
   Dravin Bottom Bar — Public Styles
   Prefix: .dbb-
   ========================================================================== */

/* ── Sticky bar ─────────────────────────────────────────────── */
.dbb-sticky-bar {
	position: fixed !important;
	bottom: 0 !important;
	left: 0 !important;
	right: 0 !important;
	width: 100% !important;
	z-index: 999999 !important;
	padding-bottom: var(--dbb-safe-area-bottom, 0px) !important;
	box-sizing: border-box !important;
	opacity: 0;
	transition: opacity 0.2s ease;
}

body.dbb-has-sticky-bar .dbb-sticky-bar {
	opacity: 1;
}

body.dbb-has-sticky-bar {
	/* padding-bottom set dynamically by JS */
}

/* ── Shared widget base ─────────────────────────────────────── */
.dbb-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.dbb-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	background: none;
	border: none;
	cursor: pointer;
	text-decoration: none;
	color: inherit;
	padding: 6px 10px;
	font-family: inherit;
	transition: color 0.2s ease, background-color 0.2s ease;
	-webkit-tap-highlight-color: transparent;
	outline: none;
}

.dbb-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.dbb-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.dbb-icon svg,
.dbb-icon i {
	display: block;
}

.dbb-label {
	font-size: 10px;
	margin-top: 2px;
	line-height: 1;
	white-space: nowrap;
}

/* ── Icon wrapper (for badge positioning) ───────────────────── */
.dbb-icon-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* ── Badge (Cart & Filter) ──────────────────────────────────── */
.dbb-cart-badge,
.dbb-badge {
	position: absolute;
	top: -6px;
	right: -8px;
	background: #e53935;
	color: #fff;
	border-radius: 50%;
	font-size: 10px;
	font-weight: 600;
	min-width: 16px;
	height: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	padding: 0 3px;
	pointer-events: none;
	box-sizing: border-box;
}

.dbb-cart-badge[hidden],
.dbb-badge[hidden] {
	display: none;
}

/* ── Menu Drawer ─────────────────────────────────────────────── */
.dbb-menu-drawer {
	position: fixed;
	inset: 0;
	z-index: 1000002;
	display: flex;
	align-items: stretch;
	visibility: hidden;
	pointer-events: none;
}

.dbb-menu-drawer.is-open {
	visibility: visible;
	pointer-events: auto;
}

.dbb-menu-backdrop {
	position: absolute;
	inset: 0;
	background: var(--dbb-backdrop-bg, rgba(0, 0, 0, 0.5));
	opacity: 0;
	transition: opacity var(--dbb-anim-duration, 300ms) ease;
}

.dbb-menu-drawer.is-open .dbb-menu-backdrop {
	opacity: 1;
}

.dbb-menu-panel {
	position: relative;
	width: var(--dbb-drawer-width, 90%);
	max-width: 480px;
	background: var(--dbb-drawer-bg, #fff);
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	transform: translateX(-100%);
	transition: transform var(--dbb-anim-duration, 300ms) ease;
	z-index: 1;
	box-sizing: border-box;
}

.dbb-menu-drawer.is-open .dbb-menu-panel {
	transform: translateX(0);
}

.dbb-menu-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 24px;
	line-height: 1;
	background: none;
	border: none;
	cursor: pointer;
	color: #333;
	z-index: 2;
	border-radius: 50%;
	transition: background-color 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.dbb-menu-close:hover {
	background: rgba(0, 0, 0, 0.05);
}

.dbb-menu-content {
	padding: 0;
	padding-top: 48px;
}

/* ── Sort Panel ──────────────────────────────────────────────── */
.dbb-sort-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000002;
	display: flex;
	align-items: flex-end;
	visibility: hidden;
	pointer-events: none;
}

.dbb-sort-overlay.is-open {
	visibility: visible;
	pointer-events: auto;
}

.dbb-sort-backdrop {
	position: absolute;
	inset: 0;
	background: var(--dbb-sort-backdrop-bg, rgba(0, 0, 0, 0.5));
	opacity: 0;
	transition: opacity 0.3s ease;
}

.dbb-sort-overlay.is-open .dbb-sort-backdrop {
	opacity: 1;
}

.dbb-sort-panel {
	position: relative;
	width: 100%;
	background: var(--dbb-sort-panel-bg, #fff);
	border-radius: var(--dbb-sort-border-radius, 16px 16px 0 0);
	transform: translateY(100%);
	transition: transform 0.3s ease;
	z-index: 1;
	max-height: 80vh;
	display: flex;
	flex-direction: column;
	padding-bottom: var(--dbb-safe-area-bottom, 0px);
}

.dbb-sort-overlay.is-open .dbb-sort-panel {
	transform: translateY(0);
}

.dbb-sort-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.dbb-sort-title {
	font-size: 16px;
	font-weight: 600;
	color: #111;
}

.dbb-sort-close {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 22px;
	line-height: 1;
	background: none;
	border: none;
	cursor: pointer;
	color: #666;
	border-radius: 50%;
	transition: background-color 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.dbb-sort-close:hover {
	background: rgba(0, 0, 0, 0.05);
}

.dbb-sort-body {
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	flex: 1;
}

.dbb-sort-options {
	list-style: none;
	margin: 0;
	padding: 0;
}

.dbb-sort-option {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	cursor: pointer;
	border-bottom: 1px solid #f5f5f5;
	transition: background-color 0.15s ease;
	-webkit-tap-highlight-color: transparent;
}

.dbb-sort-option:last-child {
	border-bottom: none;
}

.dbb-sort-option:hover {
	background: #fafafa;
}

.dbb-sort-option.is-active {
	background: #f8f8f8;
}

/* Radio indicator */
.dbb-sort-radio-indicator {
	position: relative;
	width: 20px;
	height: 20px;
	border: 2px solid #ccc;
	border-radius: 50%;
	flex-shrink: 0;
	box-sizing: border-box;
	transition: border-color 0.2s ease;
}

.dbb-sort-option.is-active .dbb-sort-radio-indicator {
	border-color: var(--dbb-sort-indicator-color, #111);
}

.dbb-sort-radio-indicator::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	background: var(--dbb-sort-indicator-color, #111);
	border-radius: 50%;
	transform: translate(-50%, -50%) scale(0);
	transition: transform 0.2s ease;
}

.dbb-sort-option.is-active .dbb-sort-radio-indicator::after {
	transform: translate(-50%, -50%) scale(1);
}

.dbb-sort-option-label {
	font-size: 15px;
	color: var(--dbb-sort-option-color, #333);
	line-height: 1.3;
}

.dbb-sort-option.is-active .dbb-sort-option-label {
	color: var(--dbb-sort-option-active-color, #111);
	font-weight: 500;
}

.dbb-sort-footer {
	display: flex;
	gap: 12px;
	padding: 16px 20px;
	border-top: 1px solid #eee;
	flex-shrink: 0;
}

.dbb-sort-cancel,
.dbb-sort-apply {
	flex: 1;
	padding: 12px;
	border-radius: 8px;
	border: none;
	cursor: pointer;
	font-size: 15px;
	font-weight: 600;
	font-family: inherit;
	transition: opacity 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.dbb-sort-cancel:hover,
.dbb-sort-apply:hover {
	opacity: 0.85;
}

.dbb-sort-cancel {
	background: var(--dbb-sort-cancel-bg, #f5f5f5);
	color: var(--dbb-sort-cancel-color, #333);
}

.dbb-sort-apply {
	background: var(--dbb-sort-apply-bg, #111);
	color: var(--dbb-sort-apply-color, #fff);
}

/* ── Integration offsets ────────────────────────────────────── */

/* Push Dravin Live Search overlay above the bottom bar */
.dravin-search-wrap .dls-mobile-overlay {
	--dls-mobile-bottom-offset: var(--dbb-bar-height, 0px);
}

/* Push Dravin Filter drawer above the bottom bar */
body.dbb-has-sticky-bar .df-drawer {
	--df-mobile-bottom-offset: var(--dbb-bar-height, 0px);
	z-index: 1000001 !important;
}

/* Push Dravin Filter inline sidebar above the bottom bar (mobile) */
body.dbb-has-sticky-bar .df-archive-filter-sidebar {
	--df-mobile-bottom-offset: var(--dbb-bar-height, 0px);
	z-index: 1000001 !important;
}

/* Push Dravin Filter backdrop above the bottom bar too */
body.dbb-has-sticky-bar .df-backdrop {
	z-index: 1000000 !important;
}

/* ── Hidden attribute support ───────────────────────────────── */
.dbb-menu-drawer[hidden],
.dbb-sort-overlay[hidden] {
	display: none !important;
}
