/**
 * نوار پایین موبایل سایت - viraving
 *
 * نمایش در صفحات اصلی (خانه، نمونه‌کارها، تماس، پروفایل)
 * مشابه طرح SVG آپلود شده:
 *   - کپسول گوشه‌گرد شناور در پایین
 *   - آیتم فعال با نوار رنگی بالای آیکون
 *   - آیکون‌ها سمت راست: خانه | نمونه‌کارها | تماس با ما | پروفایل
 *
 * @package Viraving
 */

/* ============================================================
   نوار پایین موبایل - فقط در موبایل نمایش داده می‌شود
   ============================================================ */
.site-bottom-nav {
	display: none;
}

@media (max-width: 1024px) {

	/* فضای پایین صفحه برای جلوگیری از پنهان شدن محتوا */
	body.has-mobile-bottom-nav #primary {
		padding-bottom: 40px;
	}

	body.is-panel-page .viraving-panel {
		padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
	}

	/* ============================================================
	   ظرف اصلی نوار پایین (کپسول شناور)
	   ============================================================ */
	.site-bottom-nav {
		display: block;
		position: fixed;
		bottom: 16px;
		left: 50%;
		transform: translateX(-50%);
		z-index: 998;
		width: calc(100% - 32px);
		max-width: 420px;
		pointer-events: none;
	}

	.site-bottom-nav-inner {
		position: relative;
		pointer-events: auto;
		display: flex;
		align-items: stretch;
		justify-content: space-around;
		background: var(--bg-glass-strong, rgba(255, 255, 255, 0.95));
		backdrop-filter: blur(24px) saturate(200%);
		-webkit-backdrop-filter: blur(24px) saturate(200%);
		border: 1px solid var(--border-glass, rgba(0, 0, 0, 0.06));
		border-radius: 12px;
		box-shadow:
			0 12px 40px rgba(0, 0, 0, 0.12),
			0 4px 12px rgba(0, 0, 0, 0.06),
			0 0 0 1px rgba(255, 255, 255, 0.6) inset;
		padding: 8px;
		gap: 4px;
	}

	/* حالت دارک */
	html[data-theme="dark"] .site-bottom-nav-inner,
	body.color-mode-dark .site-bottom-nav-inner {
		background: rgba(30, 30, 30, 0.92);
		border-color: rgba(255, 255, 255, 0.08);
		box-shadow:
			0 12px 40px rgba(0, 0, 0, 0.5),
			0 4px 12px rgba(0, 0, 0, 0.3),
			0 0 0 1px rgba(255, 255, 255, 0.04) inset;
	}

	/* ============================================================
	   آیتم‌های ناوبری
	   ============================================================ */
	.site-bottom-nav-item {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 4px;
		flex: 1;
		min-width: 0;
		padding: 10px 6px;
		border-radius: 12px;
		color: var(--text-tertiary, #9db2ce);
		text-decoration: none;
		font-size: 10px;
		font-weight: 600;
		line-height: 1.2;
		transition: color 0.25s ease, background 0.25s ease, transform 0.25s ease;
		overflow: hidden;
	}

	.site-bottom-nav-item:hover {
		color: var(--text-secondary, #6b7280);
	}

	/* آیکون */
	.site-bottom-nav-item .nav-icon {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 26px;
		height: 26px;
		border-radius: 12px;
		transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.25s ease;
	}

	.site-bottom-nav-item .nav-icon svg {
		width: 22px;
		height: 22px;
		stroke-width: 1.8;
	}

	/* برچسب */
	.site-bottom-nav-item .nav-label {
		display: block;
		text-align: center;
		opacity: 0.85;
		transition: opacity 0.25s ease;
	}

	/* ============================================================
	   حالت فعال (Active)
	   ============================================================ */
	.site-bottom-nav-item.active {
		color: var(--color-primary, #267466);
	}

	.site-bottom-nav-item.active .nav-icon {
		background: rgba(var(--color-primary-rgb, 38, 116, 102), 0.12);
		transform: translateY(-2px) scale(1.08);
		box-shadow: 0 4px 12px rgba(var(--color-primary-rgb, 38, 116, 102), 0.25);
	}

	.site-bottom-nav-item.active .nav-label {
		opacity: 1;
		font-weight: 700;
	}

	/* نوار نشانگر بالای آیتم فعال (مطابق SVG) */
	.site-bottom-nav-item.active::before {
		content: '';
		position: absolute;
		top: 2px;
		left: 50%;
		transform: translateX(-50%);
		width: 24px;
		height: 3px;
		border-radius: 12px;
		background: var(--color-primary, #267466);
		box-shadow: 0 0 8px rgba(var(--color-primary-rgb, 38, 116, 102), 0.6);
	}

	/* ============================================================
	   پنل کاربری — ۵ آیتم در کپسول
	   ============================================================ */
	body.is-panel-page .panel-bottom-nav {
		max-width: 480px;
	}

	body.is-panel-page .panel-bottom-nav .site-bottom-nav-item {
		padding: 8px 4px;
		font-size: 9px;
	}

	body.is-panel-page .panel-bottom-nav .nav-icon {
		width: 24px;
		height: 24px;
	}

	body.is-panel-page .panel-bottom-nav .nav-icon svg {
		width: 20px;
		height: 20px;
	}

	/* ============================================================
	   جلوگیری از تداخل با منوی همبرگری باز
	   ============================================================ */
	body.menu-open .site-bottom-nav {
		transform: translateX(-50%) translateY(120%);
		opacity: 0;
		pointer-events: none;
	}

	.site-bottom-nav {
		transition: transform 0.3s ease, opacity 0.3s ease;
	}

	/* ============================================================
	   پشتیبانی از safe-area برای دستگاه‌های دارای notch
	   ============================================================ */
	@supports (padding: env(safe-area-inset-bottom)) {
		.site-bottom-nav {
			bottom: calc(16px + env(safe-area-inset-bottom));
		}
	}

	/* ============================================================
	   موبایل‌های کوچک (زیر 380px) - کاهش سایز
	   ============================================================ */
	@media (max-width: 380px) {
		.site-bottom-nav-item {
			padding: 8px 4px;
			font-size: 9px;
		}

		.site-bottom-nav-item .nav-icon {
			width: 24px;
			height: 24px;
		}

		.site-bottom-nav-item .nav-icon svg {
			width: 20px;
			height: 20px;
		}
	}
}
