/**
 * Mobile Bottom Navigation Bar
 * 
 * Fixed bottom tab bar for primary navigation on mobile devices.
 * Bloomberg/TradingView-inspired finance UX.
 * 
 * @package ZL\Theme
 */

/* ============================================
   MOBILE BOTTOM NAVIGATION
   ============================================ */

.mobile-bottom-nav {
	display: none; /* Hidden by default (desktop) */
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 999;
	background: var(--bg-primary);
	border-top: 1px solid var(--border-primary);
	box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
	
	/* Safe area inset for iPhone X+ notch/island */
	padding-bottom: env(safe-area-inset-bottom);
}

/* Show only on mobile/tablet for logged-in users */
@media (max-width: 1023px) {
	.mobile-bottom-nav {
		display: flex;
		justify-content: space-around;
		align-items: center;
	}
}

/* ============================================
   NAVIGATION ITEMS
   ============================================ */

.bottom-nav-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.25rem;
	padding: 0.625rem 0.5rem;
	flex: 1;
	color: var(--text-secondary);
	transition: all 0.2s ease;
	text-decoration: none;
	position: relative;
	
	/* Touch target: 60px height minimum */
	min-height: 60px;
	
	/* Prevent text selection on tap */
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

/* Hover state (desktop/tablet with mouse) */
@media (min-width: 768px) {
	.bottom-nav-item:hover {
		color: var(--text-primary);
		background: var(--bg-secondary);
	}
}

/* Active (current page) state */
.bottom-nav-item[aria-current="page"] {
	color: var(--accent-primary);
}

.bottom-nav-item[aria-current="page"]::before {
	content: '';
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 32px;
	height: 3px;
	background: var(--accent-primary);
	border-radius: 0 0 2px 2px;
}

/* Active state animation */
@media (prefers-reduced-motion: no-preference) {
	.bottom-nav-item[aria-current="page"]::before {
		animation: slideIn 0.3s ease-out;
	}
	
	@keyframes slideIn {
		from {
			width: 0;
			opacity: 0;
		}
		to {
			width: 32px;
			opacity: 1;
		}
	}
}

/* Touch feedback (mobile only) */
@media (max-width: 767px) {
	.bottom-nav-item:active {
		background: var(--bg-secondary);
		transform: scale(0.95);
	}
}

/* ============================================
   ICONS & LABELS
   ============================================ */

.bottom-nav-item .nav-icon {
	width: 24px;
	height: 24px;
	flex-shrink: 0;
	stroke-width: 2;
}

.bottom-nav-item[aria-current="page"] .nav-icon {
	stroke-width: 2.5;
}

.bottom-nav-item .nav-label {
	font-size: 0.688rem; /* 11px */
	font-weight: 500;
	letter-spacing: 0.01em;
	line-height: 1;
}

/* Emphasize active label */
.bottom-nav-item[aria-current="page"] .nav-label {
	font-weight: 600;
}

/* ============================================
   LIGHT MODE OVERRIDES
   ============================================ */

html:not(.dark) .mobile-bottom-nav {
	background: #ffffff;
	border-top-color: #e5e7eb;
	box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

html:not(.dark) .bottom-nav-item {
	color: #6b7280;
}

html:not(.dark) .bottom-nav-item[aria-current="page"] {
	color: #3b82f6;
}

html:not(.dark) .bottom-nav-item[aria-current="page"]::before {
	background: #3b82f6;
}

@media (min-width: 768px) {
	html:not(.dark) .bottom-nav-item:hover {
		color: #1f2937;
		background: #f9fafb;
	}
}

/* ============================================
   SPACING COMPENSATION
   ============================================ */

/**
 * Add padding-bottom to main content to prevent overlap with fixed bottom nav.
 * This ensures content is not hidden behind the nav bar.
 */
@media (max-width: 1023px) {
	body.logged-in main {
		padding-bottom: calc(60px + env(safe-area-inset-bottom));
	}
	
	/* Extra padding for footer */
	body.logged-in footer {
		margin-bottom: calc(60px + env(safe-area-inset-bottom));
	}
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus visible for keyboard navigation (tablet+) */
.bottom-nav-item:focus-visible {
	outline: 2px solid var(--accent-primary);
	outline-offset: -2px;
	background: var(--bg-secondary);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
	.bottom-nav-item,
	.bottom-nav-item[aria-current="page"]::before {
		animation: none !important;
		transition: none !important;
	}
	
	.bottom-nav-item:active {
		transform: none !important;
	}
}

/* ============================================
   PRINT - HIDE NAVIGATION
   ============================================ */

@media print {
	.mobile-bottom-nav {
		display: none !important;
	}
}

